| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Histogram for boolean values. | 46 // Histogram for boolean values. |
| 47 | 47 |
| 48 // Sample usage: | 48 // Sample usage: |
| 49 // UMA_HISTOGRAM_BOOLEAN("Histogram.Boolean", bool); | 49 // UMA_HISTOGRAM_BOOLEAN("Histogram.Boolean", bool); |
| 50 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \ | 50 #define UMA_HISTOGRAM_BOOLEAN(name, sample) \ |
| 51 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ | 51 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ |
| 52 base::BooleanHistogram::FactoryGet(name, \ | 52 base::BooleanHistogram::FactoryGet(name, \ |
| 53 base::HistogramBase::kUmaTargetedHistogramFlag)) | 53 base::HistogramBase::kUmaTargetedHistogramFlag)) |
| 54 | 54 |
| 55 //------------------------------------------------------------------------------ | 55 //------------------------------------------------------------------------------ |
| 56 // Percentage histograms. | 56 // Linear histograms. |
| 57 | 57 |
| 58 // All of these macros must be called with |name| as a runtime constant. | 58 // All of these macros must be called with |name| as a runtime constant. |
| 59 | 59 |
| 60 // Used for capturing integer data with a linear bucketing scheme. This can be |
| 61 // used when you want the exact value of some small numeric count, with a max of |
| 62 // 100 or less. If you need to capture a range of greater than 100, we recommend |
| 63 // the use of the COUNT histograms below. |
| 64 |
| 65 // Sample usage: |
| 66 // UMA_HISTOGRAM_EXACT_LINEAR("Histogram.Linear", count, 10); |
| 67 #define UMA_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) \ |
| 68 UMA_HISTOGRAM_ENUMERATION(name, sample, value_max+1) |
| 69 |
| 60 // Used for capturing basic percentages. This will be 100 buckets of size 1. | 70 // Used for capturing basic percentages. This will be 100 buckets of size 1. |
| 61 | 71 |
| 62 // Sample usage: | 72 // Sample usage: |
| 63 // UMA_HISTOGRAM_PERCENTAGE("Histogram.Percent", percent_as_int); | 73 // UMA_HISTOGRAM_PERCENTAGE("Histogram.Percent", percent_as_int); |
| 64 #define UMA_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ | 74 #define UMA_HISTOGRAM_PERCENTAGE(name, percent_as_int) \ |
| 65 UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) | 75 UMA_HISTOGRAM_ENUMERATION(name, percent_as_int, 101) |
| 66 | |
| 67 | 76 |
| 68 //------------------------------------------------------------------------------ | 77 //------------------------------------------------------------------------------ |
| 69 // Count histograms. These are used for collecting numeric data. Note that we | 78 // Count histograms. These are used for collecting numeric data. Note that we |
| 70 // have macros for more specialized use cases below (memory, time, percentages). | 79 // have macros for more specialized use cases below (memory, time, percentages). |
| 71 | 80 |
| 72 // The number suffixes here refer to the max size of the sample, i.e. COUNT_1000 | 81 // The number suffixes here refer to the max size of the sample, i.e. COUNT_1000 |
| 73 // will be able to collect samples of counts up to 1000. The default number of | 82 // will be able to collect samples of counts up to 1000. The default number of |
| 74 // buckets in all default macros is 50. We recommend erring on the side of too | 83 // buckets in all default macros is 50. We recommend erring on the side of too |
| 75 // large a range versus too short a range. | 84 // large a range versus too short a range. |
| 76 // These macros default to exponential histograms - i.e. the lengths of the | 85 // These macros default to exponential histograms - i.e. the lengths of the |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // buckets. Min values should be >=1 as emitted 0s will still go into the | 119 // buckets. Min values should be >=1 as emitted 0s will still go into the |
| 111 // underflow bucket. | 120 // underflow bucket. |
| 112 | 121 |
| 113 // Sample usage: | 122 // Sample usage: |
| 114 // UMA_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", 1, 100000000, 100); | 123 // UMA_HISTOGRAM_CUSTOM_COUNTS("My.Histogram", 1, 100000000, 100); |
| 115 #define UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ | 124 #define UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ |
| 116 INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \ | 125 INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \ |
| 117 name, sample, min, max, bucket_count, \ | 126 name, sample, min, max, bucket_count, \ |
| 118 base::HistogramBase::kUmaTargetedHistogramFlag) | 127 base::HistogramBase::kUmaTargetedHistogramFlag) |
| 119 | 128 |
| 120 | |
| 121 //------------------------------------------------------------------------------ | 129 //------------------------------------------------------------------------------ |
| 122 // Timing histograms. These are used for collecting timing data (generally | 130 // Timing histograms. These are used for collecting timing data (generally |
| 123 // latencies). | 131 // latencies). |
| 124 | 132 |
| 125 // These macros create exponentially sized histograms (lengths of the bucket | 133 // These macros create exponentially sized histograms (lengths of the bucket |
| 126 // ranges exponentially increase as the sample range increases). The input | 134 // ranges exponentially increase as the sample range increases). The input |
| 127 // sample is a base::TimeDelta. The output data is measured in ms granularity. | 135 // sample is a base::TimeDelta. The output data is measured in ms granularity. |
| 128 // All of these macros must be called with |name| as a runtime constant. | 136 // All of these macros must be called with |name| as a runtime constant. |
| 129 | 137 |
| 130 // Sample usage: | 138 // Sample usage: |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the | 255 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the |
| 248 // requirement of |custom_ranges|. You can use the helper function | 256 // requirement of |custom_ranges|. You can use the helper function |
| 249 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid | 257 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid |
| 250 // sample values to a std::vector<int>. | 258 // sample values to a std::vector<int>. |
| 251 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 259 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
| 252 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 260 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
| 253 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 261 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
| 254 base::HistogramBase::kUmaTargetedHistogramFlag)) | 262 base::HistogramBase::kUmaTargetedHistogramFlag)) |
| 255 | 263 |
| 256 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 264 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
| OLD | NEW |