OLD | NEW |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // Support histograming of an enumerated value. Samples should be one of the | 210 // Support histograming of an enumerated value. Samples should be one of the |
211 // std::vector<int> list provided via |custom_ranges|. See comments above | 211 // std::vector<int> list provided via |custom_ranges|. See comments above |
212 // CustomRanges::FactoryGet about the requirement of |custom_ranges|. | 212 // CustomRanges::FactoryGet about the requirement of |custom_ranges|. |
213 // You can use the helper function CustomHistogram::ArrayToCustomRanges to | 213 // You can use the helper function CustomHistogram::ArrayToCustomRanges to |
214 // transform a C-style array of valid sample values to a std::vector<int>. | 214 // transform a C-style array of valid sample values to a std::vector<int>. |
215 #define HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 215 #define HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
216 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 216 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
217 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 217 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
218 base::HistogramBase::kNoFlags)) | 218 base::HistogramBase::kNoFlags)) |
219 | 219 |
| 220 #define HISTOGRAM_MEMORY_KB(name, sample) HISTOGRAM_CUSTOM_COUNTS( \ |
| 221 name, sample, 1000, 500000, 50) |
| 222 |
220 //------------------------------------------------------------------------------ | 223 //------------------------------------------------------------------------------ |
221 // Define Debug vs non-debug flavors of macros. | 224 // Define Debug vs non-debug flavors of macros. |
222 #ifndef NDEBUG | 225 #ifndef NDEBUG |
223 | 226 |
224 #define DHISTOGRAM_TIMES(name, sample) HISTOGRAM_TIMES(name, sample) | 227 #define DHISTOGRAM_TIMES(name, sample) HISTOGRAM_TIMES(name, sample) |
225 #define DHISTOGRAM_COUNTS(name, sample) HISTOGRAM_COUNTS(name, sample) | 228 #define DHISTOGRAM_COUNTS(name, sample) HISTOGRAM_COUNTS(name, sample) |
226 #define DHISTOGRAM_PERCENTAGE(name, under_one_hundred) HISTOGRAM_PERCENTAGE(\ | 229 #define DHISTOGRAM_PERCENTAGE(name, under_one_hundred) HISTOGRAM_PERCENTAGE(\ |
227 name, under_one_hundred) | 230 name, under_one_hundred) |
228 #define DHISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ | 231 #define DHISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ |
229 HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) | 232 HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); | 697 static bool ValidateCustomRanges(const std::vector<Sample>& custom_ranges); |
695 static BucketRanges* CreateBucketRangesFromCustomRanges( | 698 static BucketRanges* CreateBucketRangesFromCustomRanges( |
696 const std::vector<Sample>& custom_ranges); | 699 const std::vector<Sample>& custom_ranges); |
697 | 700 |
698 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); | 701 DISALLOW_COPY_AND_ASSIGN(CustomHistogram); |
699 }; | 702 }; |
700 | 703 |
701 } // namespace base | 704 } // namespace base |
702 | 705 |
703 #endif // BASE_METRICS_HISTOGRAM_H_ | 706 #endif // BASE_METRICS_HISTOGRAM_H_ |
OLD | NEW |