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

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 patchset 7's comments Created 6 years, 10 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 name, sample, 1, 1000, 50) 339 name, sample, 1, 1000, 50)
340 340
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 // This is a helper macro used by other macros and shouldn't be used directly.
350 #define UMA_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary_value, flag) \
Alexei Svitkine (slow) 2014/01/29 16:54:09 Nit: Seems this goes over the 80 char limit. Maybe
Kibeom Kim (inactive) 2014/01/29 20:16:07 Done.
351 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
352 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
353 boundary_value + 1, flag))
354
349 // The samples should always be strictly less than |boundary_value|. For more 355 // The samples should always be strictly less than |boundary_value|. For more
350 // details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above. 356 // details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above.
351 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ 357 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
352 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 358 UMA_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary_value, \
353 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ 359 base::HistogramBase::kUmaTargetedHistogramFlag)
354 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag)) 360
361 // In addition to UMA_HISTOGRAM_ENUMERATION, this adds |kStabilityHistogramFlag|
362 // to the histogram. Use this if you are recording stability histogram, that
363 // should be a part of the initial stability log.
364 #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
365 UMA_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary_value, \
366 base::HistogramBase::kUmaStabilityHistogramFlag)
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