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

Side by Side Diff: media/base/scoped_histogram_timer.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 | « media/base/BUILD.gn ('k') | media/base/scoped_histogram_timer_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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
6 #define MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
7
8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h"
10
11 // Scoped class which logs its time on this earth as a UMA statistic. Must be
12 // a #define macro since UMA macros prevent variables as names. The nested
13 // macro is necessary to expand __COUNTER__ to an actual value.
14 #define SCOPED_UMA_HISTOGRAM_TIMER(name) \
15 SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, __COUNTER__)
16
17 #define SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, key) \
18 SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key)
19
20 #define SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key) \
21 class ScopedHistogramTimer##key { \
22 public: \
23 ScopedHistogramTimer##key() : constructed_(base::TimeTicks::Now()) {} \
24 ~ScopedHistogramTimer##key() { \
25 base::TimeDelta elapsed = base::TimeTicks::Now() - constructed_; \
26 UMA_HISTOGRAM_TIMES(name, elapsed); \
27 } \
28 private: \
29 base::TimeTicks constructed_; \
30 } scoped_histogram_timer_##key
31
32 #endif // MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
OLDNEW
« no previous file with comments | « media/base/BUILD.gn ('k') | media/base/scoped_histogram_timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698