| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 // Sparse histograms are well suited for recording counts of exact sample values | 245 // Sparse histograms are well suited for recording counts of exact sample values |
| 246 // that are sparsely distributed over a large range. | 246 // that are sparsely distributed over a large range. |
| 247 // | 247 // |
| 248 // UMA_HISTOGRAM_SPARSE_SLOWLY is good for sparsely distributed and/or | 248 // UMA_HISTOGRAM_SPARSE_SLOWLY is good for sparsely distributed and/or |
| 249 // infrequently recorded values since the implementation is slower | 249 // infrequently recorded values since the implementation is slower |
| 250 // and takes more memory. | 250 // and takes more memory. |
| 251 // | 251 // |
| 252 // For instance, Sqlite.Version.* are sparse because for any given database, | 252 // For instance, Sqlite.Version.* are sparse because for any given database, |
| 253 // there's going to be exactly one version logged. | 253 // there's going to be exactly one version logged. |
| 254 // The |sample| can be a negative or non-negative number. |
| 254 #define UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ | 255 #define UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ |
| 255 INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) | 256 INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) |
| 256 | 257 |
| 257 //------------------------------------------------------------------------------ | 258 //------------------------------------------------------------------------------ |
| 258 // Deprecated histogram macros. Not recommended for current use. | 259 // Deprecated histogram macros. Not recommended for current use. |
| 259 | 260 |
| 260 // Legacy name for UMA_HISTOGRAM_COUNTS_1M. Suggest using explicit naming | 261 // Legacy name for UMA_HISTOGRAM_COUNTS_1M. Suggest using explicit naming |
| 261 // and not using this macro going forward. | 262 // and not using this macro going forward. |
| 262 #define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 263 #define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
| 263 name, sample, 1, 1000000, 50) | 264 name, sample, 1, 1000000, 50) |
| 264 | 265 |
| 265 // MB-granularity memory metric. This has a short max (1G). | 266 // MB-granularity memory metric. This has a short max (1G). |
| 266 #define UMA_HISTOGRAM_MEMORY_MB(name, sample) \ | 267 #define UMA_HISTOGRAM_MEMORY_MB(name, sample) \ |
| 267 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000, 50) | 268 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000, 50) |
| 268 | 269 |
| 269 // For an enum with customized range. In general, sparse histograms should be | 270 // For an enum with customized range. In general, sparse histograms should be |
| 270 // used instead. | 271 // used instead. |
| 271 // Samples should be one of the std::vector<int> list provided via | 272 // Samples should be one of the std::vector<int> list provided via |
| 272 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the | 273 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the |
| 273 // requirement of |custom_ranges|. You can use the helper function | 274 // requirement of |custom_ranges|. You can use the helper function |
| 274 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid | 275 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid |
| 275 // sample values to a std::vector<int>. | 276 // sample values to a std::vector<int>. |
| 276 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 277 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
| 277 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 278 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
| 278 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 279 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
| 279 base::HistogramBase::kUmaTargetedHistogramFlag)) | 280 base::HistogramBase::kUmaTargetedHistogramFlag)) |
| 280 | 281 |
| 281 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 282 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
| OLD | NEW |