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

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

Issue 8273022: Expand the inline documentation for the HISTOGRAM_ENUMERATION macros. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) 156 HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
157 157
158 // For folks that need real specific times, use this to select a precise range 158 // For folks that need real specific times, use this to select a precise range
159 // of times you want plotted, and the number of buckets you want used. 159 // of times you want plotted, and the number of buckets you want used.
160 #define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ 160 #define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
161 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \ 161 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \
162 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ 162 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \
163 base::Histogram::kNoFlags)) 163 base::Histogram::kNoFlags))
164 164
165 // Support histograming of an enumerated value. The samples should always be 165 // Support histograming of an enumerated value. The samples should always be
166 // less than boundary_value. 166 // strictly less than |boundary_value| -- this prevents you from running into
167 // problems down the line if you add additional buckets to the histogram. Note
168 // also that, despite explicitly setting the minimum bucket value to |1| below,
169 // it is fine for enumerated histograms to be 0-indexed -- this is because
170 // enumerated histograms should never have underflow.
167 #define HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ 171 #define HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
168 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 172 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
169 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ 173 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
170 boundary_value + 1, base::Histogram::kNoFlags)) 174 boundary_value + 1, base::Histogram::kNoFlags))
171 175
172 // Support histograming of an enumerated value. Samples should be one of the 176 // Support histograming of an enumerated value. Samples should be one of the
173 // std::vector<int> list provided via |custom_ranges|. You can use the helper 177 // std::vector<int> list provided via |custom_ranges|. You can use the helper
174 // function |base::CustomHistogram::ArrayToCustomRanges(samples, num_samples)| 178 // function |base::CustomHistogram::ArrayToCustomRanges(samples, num_samples)|
175 // to transform a C-style array of valid sample values to a std::vector<int>. 179 // to transform a C-style array of valid sample values to a std::vector<int>.
176 #define HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ 180 #define HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 name, sample, 1, 1000, 50) 263 name, sample, 1, 1000, 50)
260 264
261 #define UMA_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ 265 #define UMA_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
262 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) 266 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
263 267
264 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \ 268 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \
265 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ 269 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
266 base::BooleanHistogram::FactoryGet(name, \ 270 base::BooleanHistogram::FactoryGet(name, \
267 base::Histogram::kUmaTargetedHistogramFlag)) 271 base::Histogram::kUmaTargetedHistogramFlag))
268 272
273 // The samples should always be strictly less than |boundary_value|. For more
274 // details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above.
269 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ 275 #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
270 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 276 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
271 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ 277 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
272 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag)) 278 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag))
273 279
274 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ 280 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
275 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 281 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
276 base::CustomHistogram::FactoryGet(name, custom_ranges, \ 282 base::CustomHistogram::FactoryGet(name, custom_ranges, \
277 base::Histogram::kUmaTargetedHistogramFlag)) 283 base::Histogram::kUmaTargetedHistogramFlag))
278 284
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 767
762 // Dump all known histograms to log. 768 // Dump all known histograms to log.
763 static bool dump_on_exit_; 769 static bool dump_on_exit_;
764 770
765 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); 771 DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
766 }; 772 };
767 773
768 } // namespace base 774 } // namespace base
769 775
770 #endif // BASE_METRICS_HISTOGRAM_H_ 776 #endif // BASE_METRICS_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698