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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 base::HistogramBase::kUmaStabilityHistogramFlag) | 240 base::HistogramBase::kUmaStabilityHistogramFlag) |
241 | 241 |
242 //------------------------------------------------------------------------------ | 242 //------------------------------------------------------------------------------ |
243 // Sparse histograms. | 243 // Sparse histograms. |
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. For sparse data, sparse histograms have the advantage |
251 // of using less memory client-side, because they allocate buckets on demand | |
252 // rather than preallocating. However, server-side, we still need to load all | |
253 // buckets, across all users, at once. Thus, please avoid exploding such | |
254 // histograms, i.e. uploading many many distinct values to the server (across | |
jkrcal
2017/04/19 07:58:06
Maybe we can make the "many many" more concrete. R
Ilya Sherman
2017/04/19 17:22:07
<= 100 is best, and <= 1000 is okay (but more expe
jkrcal
2017/04/26 07:39:14
Done.
| |
255 // all users). | |
251 // | 256 // |
252 // For instance, Sqlite.Version.* are sparse because for any given database, | 257 // For instance, Sqlite.Version.* are sparse because for any given database, |
253 // there's going to be exactly one version logged. | 258 // there's going to be exactly one version logged. |
254 // The |sample| can be a negative or non-negative number. | 259 // The |sample| can be a negative or non-negative number. |
255 #define UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ | 260 #define UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ |
256 INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) | 261 INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) |
257 | 262 |
258 //------------------------------------------------------------------------------ | 263 //------------------------------------------------------------------------------ |
259 // Histogram instantiation helpers. | 264 // Histogram instantiation helpers. |
260 | 265 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the | 311 // |custom_ranges|. See comments above CustomRanges::FactoryGet about the |
307 // requirement of |custom_ranges|. You can use the helper function | 312 // requirement of |custom_ranges|. You can use the helper function |
308 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid | 313 // CustomHistogram::ArrayToCustomRanges to transform a C-style array of valid |
309 // sample values to a std::vector<int>. | 314 // sample values to a std::vector<int>. |
310 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ | 315 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ |
311 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 316 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
312 base::CustomHistogram::FactoryGet(name, custom_ranges, \ | 317 base::CustomHistogram::FactoryGet(name, custom_ranges, \ |
313 base::HistogramBase::kUmaTargetedHistogramFlag)) | 318 base::HistogramBase::kUmaTargetedHistogramFlag)) |
314 | 319 |
315 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 320 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
OLD | NEW |