Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef BASE_METRICS_HISTOGRAM_MACROS_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_MACROS_H_ |
| 6 #define BASE_METRICS_HISTOGRAM_MACROS_H_ | 6 #define BASE_METRICS_HISTOGRAM_MACROS_H_ |
| 7 | 7 |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/histogram_macros_internal.h" | 9 #include "base/metrics/histogram_macros_internal.h" |
| 10 #include "base/metrics/histogram_macros_local.h" | 10 #include "base/metrics/histogram_macros_local.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 // All of these macros must be called with |name| as a runtime constant. | 61 // All of these macros must be called with |name| as a runtime constant. |
| 62 | 62 |
| 63 // Used for capturing integer data with a linear bucketing scheme. This can be | 63 // Used for capturing integer data with a linear bucketing scheme. This can be |
| 64 // used when you want the exact value of some small numeric count, with a max of | 64 // used when you want the exact value of some small numeric count, with a max of |
| 65 // 100 or less. If you need to capture a range of greater than 100, we recommend | 65 // 100 or less. If you need to capture a range of greater than 100, we recommend |
| 66 // the use of the COUNT histograms below. | 66 // the use of the COUNT histograms below. |
| 67 | 67 |
| 68 // Sample usage: | 68 // Sample usage: |
| 69 // UMA_HISTOGRAM_EXACT_LINEAR("Histogram.Linear", count, 10); | 69 // UMA_HISTOGRAM_EXACT_LINEAR("Histogram.Linear", count, 10); |
| 70 #define UMA_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) \ | 70 #define UMA_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) \ |
| 71 UMA_HISTOGRAM_ENUMERATION(name, sample, value_max+1) | 71 UMA_HISTOGRAM_ENUMERATION(name, sample, value_max) |
|
wychen
2016/11/14 23:56:11
Ah. I was confused why we have to +1 twice.
| |
| 72 | 72 |
| 73 // Used for capturing basic percentages. This will be 100 buckets of size 1. | 73 // Used for capturing basic percentages. This will be 100 buckets of size 1. |
| 74 | 74 |
| 75 // Sample usage: | 75 // Sample usage: |
| 76 // UMA_HISTOGRAM_PERCENTAGE("Histogram.Percent", percent_as_int); | 76 // UMA_HISTOGRAM_PERCENTAGE("Histogram.Percent", percent_as_int); |
| 77 #define UMA_HISTOGRAM_PERCENTAGE(name, percent_as_int) \ | 77 #define UMA_HISTOGRAM_PERCENTAGE(name, percent_as_int) \ |
| 78 UMA_HISTOGRAM_ENUMERATION(name, percent_as_int, 101) | 78 UMA_HISTOGRAM_ENUMERATION(name, percent_as_int, 101) |
| 79 | 79 |
| 80 //------------------------------------------------------------------------------ | 80 //------------------------------------------------------------------------------ |
| 81 // Count histograms. These are used for collecting numeric data. Note that we | 81 // Count histograms. These are used for collecting numeric data. Note that we |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the | 273 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the |
| 274 // requirement of |custom_ranges|. You can use the helper function | 274 // requirement of |custom_ranges|. You can use the helper function |
| 275 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid | 275 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid |
| 276 // sample values to a std::vector<int>. | 276 // sample values to a std::vector<int>. |
| 277 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 277 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
| 278 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 278 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
| 279 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 279 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
| 280 base::HistogramBase::kUmaTargetedHistogramFlag)) | 280 base::HistogramBase::kUmaTargetedHistogramFlag)) |
| 281 | 281 |
| 282 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 282 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
| OLD | NEW |