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

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: rebase 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 name, sample, 1, 100, 50) 183 name, sample, 1, 100, 50)
184 184
185 #define HISTOGRAM_COUNTS_10000(name, sample) HISTOGRAM_CUSTOM_COUNTS( \ 185 #define HISTOGRAM_COUNTS_10000(name, sample) HISTOGRAM_CUSTOM_COUNTS( \
186 name, sample, 1, 10000, 50) 186 name, sample, 1, 10000, 50)
187 187
188 #define HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ 188 #define HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
189 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 189 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
190 base::Histogram::FactoryGet(name, min, max, bucket_count, \ 190 base::Histogram::FactoryGet(name, min, max, bucket_count, \
191 base::HistogramBase::kNoFlags)) 191 base::HistogramBase::kNoFlags))
192 192
193 // This is a helper macro used by other macros and shouldn't be used directly.
194 #define HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \
195 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
196 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, \
197 flag))
198
193 #define HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ 199 #define HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
194 HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) 200 HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
195 201
196 #define HISTOGRAM_BOOLEAN(name, sample) \ 202 #define HISTOGRAM_BOOLEAN(name, sample) \
197 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ 203 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
198 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags)) 204 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags))
199 205
200 // Support histograming of an enumerated value. The samples should always be 206 // Support histograming of an enumerated value. The samples should always be
201 // strictly less than |boundary_value| -- this prevents you from running into 207 // strictly less than |boundary_value| -- this prevents you from running into
202 // problems down the line if you add additional buckets to the histogram. Note 208 // problems down the line if you add additional buckets to the histogram. Note
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) 348 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
343 349
344 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \ 350 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \
345 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ 351 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
346 base::BooleanHistogram::FactoryGet(name, \ 352 base::BooleanHistogram::FactoryGet(name, \
347 base::HistogramBase::kUmaTargetedHistogramFlag)) 353 base::HistogramBase::kUmaTargetedHistogramFlag))
348 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 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 // Similar to UMA_HISTOGRAM_ENUMERATION, but used for recording stability
362 // histograms. Use this if recording a histogram that should be part of the
363 // initial stability log.
364 #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
365 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