Chromium Code Reviews| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 { \ | 103 do { \ |
| 104 static_assert( \ | 104 static_assert( \ |
| 105 !std::is_enum<decltype(sample)>::value || \ | 105 !std::is_enum<decltype(sample)>::value || \ |
| 106 !std::is_enum<decltype(boundary)>::value || \ | 106 !std::is_enum<decltype(boundary)>::value || \ |
| 107 std::is_same<std::remove_const<decltype(sample)>::type, \ | 107 std::is_same< \ |
| 108 std::remove_const<decltype(boundary)>::type>::value, \ | 108 typename std::remove_const<decltype(sample)>::type, \ |
|
pasko
2016/12/19 14:26:49
please explain why this is relevant to this change
Roger McFarlane (Chromium)
2017/02/08 23:08:07
This macro cannot be used to reference template pa
| |
| 109 typename std::remove_const<decltype(boundary)>::type>::value, \ | |
| 109 "|sample| and |boundary| shouldn't be of different enums"); \ | 110 "|sample| and |boundary| shouldn't be of different enums"); \ |
| 110 STATIC_HISTOGRAM_POINTER_BLOCK( \ | 111 STATIC_HISTOGRAM_POINTER_BLOCK( \ |
| 111 name, Add(sample), base::LinearHistogram::FactoryGet( \ | 112 name, Add(sample), base::LinearHistogram::FactoryGet( \ |
| 112 name, 1, boundary, boundary + 1, flag)); \ | 113 name, 1, boundary, boundary + 1, flag)); \ |
| 113 } while (0) | 114 } while (0) |
| 114 | 115 |
| 115 // This is a helper macro used by other macros and shouldn't be used directly. | 116 // This is a helper macro used by other macros and shouldn't be used directly. |
| 116 // This is necessary to expand __COUNTER__ to an actual value. | 117 // This is necessary to expand __COUNTER__ to an actual value. |
| 117 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, is_long, key) \ | 118 #define INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, is_long, key) \ |
| 118 INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) | 119 INTERNAL_SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 140 // may be more efficient in memory if the total number of sample values is small | 141 // may be more efficient in memory if the total number of sample values is small |
| 141 // compared to the range of their values. | 142 // compared to the range of their values. |
| 142 #define INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ | 143 #define INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) \ |
| 143 do { \ | 144 do { \ |
| 144 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \ | 145 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \ |
| 145 name, base::HistogramBase::kUmaTargetedHistogramFlag); \ | 146 name, base::HistogramBase::kUmaTargetedHistogramFlag); \ |
| 146 histogram->Add(sample); \ | 147 histogram->Add(sample); \ |
| 147 } while (0) | 148 } while (0) |
| 148 | 149 |
| 149 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ | 150 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ |
| OLD | NEW |