Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: base/metrics/histogram_macros.h

Issue 920963003: Moved scoped_histogram_timer to the main histogram_macros.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove gyp entries for old unit test in media/ Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/base.gyp ('k') | base/metrics/histogram_macros_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // initial stability log. 222 // initial stability log.
223 #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \ 223 #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
224 HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary_value, \ 224 HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary_value, \
225 base::HistogramBase::kUmaStabilityHistogramFlag) 225 base::HistogramBase::kUmaStabilityHistogramFlag)
226 226
227 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \ 227 #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
228 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \ 228 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
229 base::CustomHistogram::FactoryGet(name, custom_ranges, \ 229 base::CustomHistogram::FactoryGet(name, custom_ranges, \
230 base::HistogramBase::kUmaTargetedHistogramFlag)) 230 base::HistogramBase::kUmaTargetedHistogramFlag))
231 231
232 // Scoped class which logs its time on this earth as a UMA statistic. Must be
233 // a #define macro since UMA macros prevent variables as names. The nested
234 // macro is necessary to expand __COUNTER__ to an actual value.
235 #define SCOPED_UMA_HISTOGRAM_TIMER(name) \
236 SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, __COUNTER__)
237
238 #define SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, key) \
239 SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key)
240
241 #define SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key) \
242 class ScopedHistogramTimer##key { \
243 public: \
244 ScopedHistogramTimer##key() : constructed_(base::TimeTicks::Now()) {} \
245 ~ScopedHistogramTimer##key() { \
246 base::TimeDelta elapsed = base::TimeTicks::Now() - constructed_; \
247 UMA_HISTOGRAM_TIMES(name, elapsed); \
248 } \
249 private: \
250 base::TimeTicks constructed_; \
251 } scoped_histogram_timer_##key
252
232 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_ 253 #endif // BASE_METRICS_HISTOGRAM_MACROS_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/metrics/histogram_macros_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698