Chromium Code Reviews| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 | 141 |
| 142 #define LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ | 142 #define LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ |
| 143 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 143 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ |
| 144 base::Histogram::FactoryGet(name, min, max, bucket_count, \ | 144 base::Histogram::FactoryGet(name, min, max, bucket_count, \ |
| 145 base::HistogramBase::kNoFlags)) | 145 base::HistogramBase::kNoFlags)) |
| 146 | 146 |
| 147 // This is a helper macro used by other macros and shouldn't be used directly. | 147 // This is a helper macro used by other macros and shouldn't be used directly. |
| 148 // One additional bucket is created in the LinearHistogram for the illegal | 148 // One additional bucket is created in the LinearHistogram for the illegal |
| 149 // values >= boundary_value so that mistakes in calling the UMA enumeration | 149 // values >= boundary_value so that mistakes in calling the UMA enumeration |
| 150 // macros can be detected. | 150 // macros can be detected. |
| 151 #define HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \ | 151 #define HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \ |
| 152 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ | 152 STATIC_HISTOGRAM_POINTER_BLOCK( \ |
| 153 base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, \ | 153 name, Add(static_cast<base::HistogramBase::Sample>(sample)), \ |
| 154 flag)) | 154 base::LinearHistogram::FactoryGet( \ |
| 155 name, 1, static_cast<base::HistogramBase::Sample>(boundary), \ | |
| 156 static_cast<uint32_t>(boundary) + 1, flag)) | |
|
Ilya Sherman
2016/08/22 20:52:12
I'm not comfortable with adding a blanket static_c
Sidney San Martín
2016/08/25 00:55:11
Thanks, in retrospect that was careless. I created
Ilya Sherman
2016/08/25 01:12:56
Very cool! What does a compile error look like if
Sidney San Martín
2016/08/30 18:46:37
It passed doubles through, since existing code alr
| |
| 155 | 157 |
| 156 #define LOCAL_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ | 158 #define LOCAL_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \ |
| 157 LOCAL_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) | 159 LOCAL_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) |
| 158 | 160 |
| 159 #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ | 161 #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ |
| 160 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ | 162 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ |
| 161 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags)) | 163 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags)) |
| 162 | 164 |
| 163 // Support histograming of an enumerated value. The samples should always be | 165 // Support histograming of an enumerated value. The samples should always be |
| 164 // strictly less than |boundary_value| -- this prevents you from running into | 166 // strictly less than |boundary_value| -- this prevents you from running into |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \ | 296 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \ |
| 295 } else { \ | 297 } else { \ |
| 296 UMA_HISTOGRAM_TIMES(name, elapsed); \ | 298 UMA_HISTOGRAM_TIMES(name, elapsed); \ |
| 297 } \ | 299 } \ |
| 298 } \ | 300 } \ |
| 299 private: \ | 301 private: \ |
| 300 base::TimeTicks constructed_; \ | 302 base::TimeTicks constructed_; \ |
| 301 } scoped_histogram_timer_##key | 303 } scoped_histogram_timer_##key |
| 302 | 304 |
| 303 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ | 305 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ |
| OLD | NEW |