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 | |
|
Alexei Svitkine (slow)
2016/09/26 20:35:48
Remove extra blank.
| |
| 9 #include "base/logging.h" | |
| 10 #include "base/metrics/histogram.h" | |
| 11 #include "base/metrics/histogram_macros_internal.h" | |
| 12 #include "base/time/time.h" | |
| 13 | |
| 14 // TODO(rkaplow): Migrate all LOCAL_* usage within Chromium to include this | |
| 15 // file instead of the histogram_macros.h file. | |
| 16 | |
| 17 //------------------------------------------------------------------------------ | |
| 18 // Count histograms. These are used for collecting numeric data. Note that we | |
| 19 // have macros for more specialized use cases below (memory, time, percentages). | |
| 20 // For usage details, see the equivalents in histogram_macros.h. | |
| 21 | |
| 22 #define LOCAL_HISTOGRAM_COUNTS_100(name, sample) \ | |
| 23 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50) | |
| 24 | |
| 25 #define LOCAL_HISTOGRAM_COUNTS_10000(name, sample) \ | |
| 26 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50) | |
| 27 | |
| 28 #define LOCAL_HISTOGRAM_COUNTS_1000000(name, sample) \ | |
| 29 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50) | |
| 30 | |
| 31 #define LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ | |
| 32 INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \ | |
| 33 name, sample, min, max, bucket_count, base::HistogramBase::kNoFlags) | |
| 34 | |
| 35 //------------------------------------------------------------------------------ | |
| 36 // Timing histograms. These are used for collecting timing data (generally | |
| 37 // latencies). | |
| 38 // | |
| 39 // For usage details, see the equivalents in histogram_macros.h. | |
| 40 | |
| 41 #define LOCAL_HISTOGRAM_TIMES(name, sample) LOCAL_HISTOGRAM_CUSTOM_TIMES( \ | |
| 42 name, sample, base::TimeDelta::FromMilliseconds(1), \ | |
| 43 base::TimeDelta::FromSeconds(10), 50) | |
| 44 | |
| 45 #define LOCAL_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ | |
| 46 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \ | |
| 47 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ | |
| 48 base::HistogramBase::kNoFlags)) | |
| 49 | |
| 50 //------------------------------------------------------------------------------ | |
| 51 // Memory histograms. | |
| 52 // | |
| 53 // For usage details, see the equivalents in histogram_macros.h. | |
| 54 | |
| 55 #define LOCAL_HISTOGRAM_MEMORY_KB(name, sample) LOCAL_HISTOGRAM_CUSTOM_COUNTS( \ | |
| 56 name, sample, 1000, 500000, 50) | |
| 57 | |
| 58 //------------------------------------------------------------------------------ | |
| 59 // Enumeration histograms. | |
| 60 // | |
| 61 // For usage details, see the equivalents in histogram_macros.h. | |
| 62 | |
| 63 #define LOCAL_HISTOGRAM_ENUMERATION(name, sample, enum_max) \ | |
| 64 INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG( \ | |
| 65 name, sample, enum_max, \ | |
| 66 base::HistogramBase::kNoFlags) | |
| 67 | |
| 68 #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ | |
| 69 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ | |
| 70 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags)) | |
| 71 | |
| 72 #define LOCAL_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ | |
| 73 LOCAL_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) | |
| 74 | |
| 75 //------------------------------------------------------------------------------ | |
| 76 // Deprecated histograms. Not recommended for current use. | |
| 77 | |
| 78 // TODO(rkaplow): See if we can clean up this macro and usage. | |
| 79 // Legacy non-explicit version. We suggest using LOCAL_HISTOGRAM_COUNTS_1000000 | |
| 80 // instead. | |
| 81 #define LOCAL_HISTOGRAM_COUNTS(name, sample) \ | |
| 82 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50) | |
| 83 | |
| 84 #endif // BASE_METRICS_HISTOGRAM_MACROS_LOCAL_H_ | |
| OLD | NEW |