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" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 | 12 |
| 13 // Macros for efficient use of histograms. |
| 14 // |
| 15 // For best practices on deciding when to emit to a histogram and what form |
| 16 // the histogram should take, see tools/metrics/histograms/README.md |
| 17 // |
13 // TODO(nikunjb): Move sparse macros to this file. | 18 // TODO(nikunjb): Move sparse macros to this file. |
| 19 // |
14 // UMA_HISTOGRAM_SPARSE_SLOWLY is defined in sparse_histogram.h as it has | 20 // UMA_HISTOGRAM_SPARSE_SLOWLY is defined in sparse_histogram.h as it has |
15 // different #include dependencies. | 21 // different #include dependencies. |
16 | 22 |
17 // TODO(rkaplow): Link to proper documentation on metric creation once we have | 23 // TODO(rkaplow): Link to proper documentation on metric creation once we have |
18 // it in a good state. | 24 // it in a good state. |
19 | 25 |
20 // All of these macros must be called with |name| as a runtime constant - it | 26 // All of these macros must be called with |name| as a runtime constant - it |
21 // doesn't have to literally be a constant, but it must be the same string on | 27 // doesn't have to literally be a constant, but it must be the same string on |
22 // all calls from a particular call site. If this rule is violated, it is | 28 // all calls from a particular call site. If this rule is violated, it is |
23 // possible the data will be written to the wrong histogram. | 29 // possible the data will be written to the wrong histogram. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the | 253 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the |
248 // requirement of |custom_ranges|. You can use the helper function | 254 // requirement of |custom_ranges|. You can use the helper function |
249 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid | 255 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid |
250 // sample values to a std::vector<int>. | 256 // sample values to a std::vector<int>. |
251 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 257 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
252 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 258 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
253 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 259 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
254 base::HistogramBase::kUmaTargetedHistogramFlag)) | 260 base::HistogramBase::kUmaTargetedHistogramFlag)) |
255 | 261 |
256 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 262 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
OLD | NEW |