Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Side by Side Diff: base/metrics/histogram.h

Issue 137623002: Let MetricsService know about some Android Activities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments on patch set 5 + a unit test Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 8
9 // It supports calls to accumulate either time intervals (which are processed 9 // It supports calls to accumulate either time intervals (which are processed
10 // as integral number of milliseconds), or arbitrary integral units. 10 // as integral number of milliseconds), or arbitrary integral units.
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #define UMA_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ 341 #define UMA_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
342 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) 342 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
343 343
344 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \ 344 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \
345 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ 345 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
346 base::BooleanHistogram::FactoryGet(name, \ 346 base::BooleanHistogram::FactoryGet(name, \
347 base::HistogramBase::kUmaTargetedHistogramFlag)) 347 base::HistogramBase::kUmaTargetedHistogramFlag))
348 348
349 // The samples should always be strictly less than |boundary_value|. For more 349 // The samples should always be strictly less than |boundary_value|. For more
350 // details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above. 350 // details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above.
351 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ 351 #define UMA_HISTOGRAM_ENUMERATION_WITH_FLAGS(name, sample, boundary_value, flags ) \
352 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 352 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
353 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ 353 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
354 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag)) 354 boundary_value + 1, flags))
355
356 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
357 UMA_HISTOGRAM_ENUMERATION_WITH_FLAGS(name, sample, boundary_value, \
358 base::HistogramBase::kUmaTargetedHistogramFlag)
359
360 // In addition to UMA_HISTOGRAM_ENUMERATION, this adds |kStabilityHistogramFlag|
361 // to the histogram. Use this if you are recording stability histogram, that
362 // should be a part of the initial stability log.
363 #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
364 UMA_HISTOGRAM_ENUMERATION_WITH_FLAGS(name, sample, boundary_value, \
365 base::HistogramBase::kUmaTargetedHistogramFlag | \
366 base::HistogramBase::kStabilityHistogramFlag)
355 367
356 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ 368 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
357 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 369 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
358 base::CustomHistogram::FactoryGet(name, custom_ranges, \ 370 base::CustomHistogram::FactoryGet(name, custom_ranges, \
359 base::HistogramBase::kUmaTargetedHistogramFlag)) 371 base::HistogramBase::kUmaTargetedHistogramFlag))
360 372
361 //------------------------------------------------------------------------------ 373 //------------------------------------------------------------------------------
362 374
363 class BucketRanges; 375 class BucketRanges;
364 class SampleVector; 376 class SampleVector;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); 684 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges);
673 static BucketRanges* CreateBucketRangesFromCustomRanges( 685 static BucketRanges* CreateBucketRangesFromCustomRanges(
674 const std::vector<Sample>& custom_ranges); 686 const std::vector<Sample>& custom_ranges);
675 687
676 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); 688 DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
677 }; 689 };
678 690
679 } // namespace base 691 } // namespace base
680 692
681 #endif // BASE_METRICS_HISTOGRAM_H_ 693 #endif // BASE_METRICS_HISTOGRAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698