Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_METRICS_HISTOGRAM_MACROS_LOCAL_H_ | |
| 6 #define BASE_METRICS_HISTOGRAM_MACROS_LOCAL_H_ | |
| 7 | |
| 8 #include "base/logging.h" | |
| 9 #include "base/metrics/histogram.h" | |
| 10 #include "base/metrics/histogram_macros_internal.h" | |
| 11 #include "base/time/time.h" | |
| 12 | |
| 13 // TODO(rkaplow): Migrate all LOCAL_* usage within Chromium to include this | |
| 14 // file instead of the histogram_macros.h file. | |
| 15 | |
| 16 //------------------------------------------------------------------------------ | |
| 17 // Enumeration histograms. | |
| 18 // | |
| 19 // For usage details, see the equivalents in histogram_macros.h. | |
| 20 | |
| 21 #define LOCAL_HISTOGRAM_ENUMERATION(name, sample, enum_max) \ | |
| 22 INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG( \ | |
| 23 name, sample, enum_max, \ | |
| 24 base::HistogramBase::kNoFlags) | |
| 25 | |
| 26 #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ | |
| 27 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ | |
| 28 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags)) | |
| 29 | |
| 30 //------------------------------------------------------------------------------ | |
| 31 // Percentage histograms. | |
| 32 // | |
| 33 // For usage details, see the equivalents in histogram_macros.h | |
| 34 | |
| 35 #define LOCAL_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ | |
| 36 LOCAL_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) | |
| 37 | |
| 38 //------------------------------------------------------------------------------ | |
|
Mark P
2016/09/26 23:06:47
optional: I suggest the counts section should go f
rkaplow
2016/09/27 15:08:26
Ok - I don't personally care much, so will leave a
| |
| 39 // Count histograms. These are used for collecting numeric data. Note that we | |
| 40 // have macros for more specialized use cases below (memory, time, percentages). | |
| 41 // For usage details, see the equivalents in histogram_macros.h. | |
| 42 | |
| 43 #define LOCAL_HISTOGRAM_COUNTS_100(name, sample) \ | |
| 44 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50) | |
| 45 | |
| 46 #define LOCAL_HISTOGRAM_COUNTS_10000(name, sample) \ | |
| 47 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50) | |
| 48 | |
| 49 #define LOCAL_HISTOGRAM_COUNTS_1000000(name, sample) \ | |
| 50 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50) | |
| 51 | |
| 52 #define LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ | |
| 53 INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \ | |
| 54 name, sample, min, max, bucket_count, base::HistogramBase::kNoFlags) | |
| 55 | |
| 56 //------------------------------------------------------------------------------ | |
| 57 // Timing histograms. These are used for collecting timing data (generally | |
| 58 // latencies). | |
| 59 // | |
| 60 // For usage details, see the equivalents in histogram_macros.h. | |
| 61 | |
| 62 #define LOCAL_HISTOGRAM_TIMES(name, sample) LOCAL_HISTOGRAM_CUSTOM_TIMES( \ | |
| 63 name, sample, base::TimeDelta::FromMilliseconds(1), \ | |
| 64 base::TimeDelta::FromSeconds(10), 50) | |
| 65 | |
| 66 #define LOCAL_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ | |
| 67 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \ | |
| 68 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ | |
| 69 base::HistogramBase::kNoFlags)) | |
| 70 | |
| 71 //------------------------------------------------------------------------------ | |
| 72 // Memory histograms. | |
| 73 // | |
| 74 // For usage details, see the equivalents in histogram_macros.h. | |
| 75 | |
| 76 #define LOCAL_HISTOGRAM_MEMORY_KB(name, sample) LOCAL_HISTOGRAM_CUSTOM_COUNTS( \ | |
| 77 name, sample, 1000, 500000, 50) | |
| 78 | |
| 79 //------------------------------------------------------------------------------ | |
| 80 // Deprecated histograms. Not recommended for current use. | |
| 81 | |
| 82 // TODO(rkaplow): See if we can clean up this macro and usage. | |
| 83 // Legacy non-explicit version. We suggest using LOCAL_HISTOGRAM_COUNTS_1000000 | |
| 84 // instead. | |
| 85 #define LOCAL_HISTOGRAM_COUNTS(name, sample) \ | |
| 86 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50) | |
| 87 | |
| 88 #endif // BASE_METRICS_HISTOGRAM_MACROS_LOCAL_H_ | |
| OLD | NEW |