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/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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 #define UMA_HISTOGRAM_LONG_TIMES(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \ | 175 #define UMA_HISTOGRAM_LONG_TIMES(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \ |
176 name, sample, base::TimeDelta::FromMilliseconds(1), \ | 176 name, sample, base::TimeDelta::FromMilliseconds(1), \ |
177 base::TimeDelta::FromHours(1), 50) | 177 base::TimeDelta::FromHours(1), 50) |
178 | 178 |
179 // Use this macro when times can routinely be much longer than 10 seconds and | 179 // Use this macro when times can routinely be much longer than 10 seconds and |
180 // you want 100 buckets. | 180 // you want 100 buckets. |
181 #define UMA_HISTOGRAM_LONG_TIMES_100(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \ | 181 #define UMA_HISTOGRAM_LONG_TIMES_100(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \ |
182 name, sample, base::TimeDelta::FromMilliseconds(1), \ | 182 name, sample, base::TimeDelta::FromMilliseconds(1), \ |
183 base::TimeDelta::FromHours(1), 100) | 183 base::TimeDelta::FromHours(1), 100) |
184 | 184 |
185 // Use this macro to capture fine-grained timing variations from a millisecond | |
186 // up to a minute, using 100 buckets. | |
Ilya Sherman
2016/01/26 22:39:04
This description says that the lower bound is a mi
Joe Mason
2016/01/27 16:51:21
There's a design doc for this feature at https://d
| |
187 #define UMA_HISTOGRAM_FINE_TIMES_100(name, sample) UMA_HISTOGRAM_CUSTOM_TIMES( \ | |
188 name, sample, base::TimeDelta::FromMicroseconds(100), \ | |
189 base::TimeDelta::FromMinutes(1), 100) | |
Ilya Sherman
2016/01/26 22:39:04
I'm not sure that it makes sense to add this macro
Joe Mason
2016/01/27 16:51:21
Yeah, it's a judgement call - I thought it was a g
Ilya Sherman
2016/01/28 05:25:26
You could also define a macro in the component, an
| |
190 | |
185 #define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ | 191 #define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ |
186 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \ | 192 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \ |
187 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ | 193 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ |
188 base::HistogramBase::kUmaTargetedHistogramFlag)) | 194 base::HistogramBase::kUmaTargetedHistogramFlag)) |
189 | 195 |
190 #define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 196 #define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
191 name, sample, 1, 1000000, 50) | 197 name, sample, 1, 1000000, 50) |
192 | 198 |
193 #define UMA_HISTOGRAM_COUNTS_100(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 199 #define UMA_HISTOGRAM_COUNTS_100(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
194 name, sample, 1, 100, 50) | 200 name, sample, 1, 100, 50) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \ | 271 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \ |
266 } else { \ | 272 } else { \ |
267 UMA_HISTOGRAM_TIMES(name, elapsed); \ | 273 UMA_HISTOGRAM_TIMES(name, elapsed); \ |
268 } \ | 274 } \ |
269 } \ | 275 } \ |
270 private: \ | 276 private: \ |
271 base::TimeTicks constructed_; \ | 277 base::TimeTicks constructed_; \ |
272 } scoped_histogram_timer_##key | 278 } scoped_histogram_timer_##key |
273 | 279 |
274 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 280 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
OLD | NEW |