OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_INTERNAL_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ |
6 #define BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ | 6 #define BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ |
7 | 7 |
8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 bucket_count, flag) \ | 93 bucket_count, flag) \ |
94 STATIC_HISTOGRAM_POINTER_BLOCK( \ | 94 STATIC_HISTOGRAM_POINTER_BLOCK( \ |
95 name, Add(sample), \ | 95 name, Add(sample), \ |
96 base::Histogram::FactoryGet(name, min, max, bucket_count, flag)) | 96 base::Histogram::FactoryGet(name, min, max, bucket_count, flag)) |
97 | 97 |
98 // This is a helper macro used by other macros and shouldn't be used directly. | 98 // This is a helper macro used by other macros and shouldn't be used directly. |
99 // One additional bucket is created in the LinearHistogram for the illegal | 99 // One additional bucket is created in the LinearHistogram for the illegal |
100 // values >= boundary_value so that mistakes in calling the UMA enumeration | 100 // values >= boundary_value so that mistakes in calling the UMA enumeration |
101 // macros can be detected. | 101 // macros can be detected. |
102 #define INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \ | 102 #define INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \ |
103 do { \ | |
104 static_assert( \ | |
105 !std::is_enum<decltype(sample)>::value || \ | |
106 !std::is_enum<decltype(boundary)>::value || \ | |
107 std::is_same<std::remove_const<decltype(sample)>::type, \ | |
108 std::remove_const<decltype(boundary)>::type>::value, \ | |
109 "|sample| and |boundary| shouldn't be of different enums"); \ | |
103 STATIC_HISTOGRAM_POINTER_BLOCK( \ | 110 STATIC_HISTOGRAM_POINTER_BLOCK( \ |
104 name, Add(sample), \ | 111 name, Add(sample), base::LinearHistogram::FactoryGet( \ |
105 base::LinearHistogram::FactoryGet( \ | 112 name, 1, boundary, boundary + 1, flag)); \ |
dcheng
2016/11/17 05:09:55
I know the ship has sailed (and we're migrating of
| |
106 name, 1, boundary, boundary + 1, flag)) | 113 } while (0) |
107 | 114 |
108 // This is a helper macro used by other macros and shouldn't be used directly. | 115 // This is a helper macro used by other macros and shouldn't be used directly. |
109 // This is necessary to expand __COUNTER__ to an actual value. | 116 // This is necessary to expand __COUNTER__ to an actual value. |
110 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, is_long, key) \ | 117 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, is_long, key) \ |
111 INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) | 118 INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) |
112 | 119 |
113 // This is a helper macro used by other macros and shouldn't be used directly. | 120 // This is a helper macro used by other macros and shouldn't be used directly. |
114 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) \ | 121 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) \ |
115 class ScopedHistogramTimer##key { \ | 122 class ScopedHistogramTimer##key { \ |
116 public: \ | 123 public: \ |
(...skipping 16 matching lines...) Expand all Loading... | |
133 // may be more efficient in memory if the total number of sample values is small | 140 // may be more efficient in memory if the total number of sample values is small |
134 // compared to the range of their values. | 141 // compared to the range of their values. |
135 #define INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ | 142 #define INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ |
136 do { \ | 143 do { \ |
137 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \ | 144 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \ |
138 name, base::HistogramBase::kUmaTargetedHistogramFlag); \ | 145 name, base::HistogramBase::kUmaTargetedHistogramFlag); \ |
139 histogram->Add(sample); \ | 146 histogram->Add(sample); \ |
140 } while (0) | 147 } while (0) |
141 | 148 |
142 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ | 149 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ |
OLD | NEW |