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

Side by Side Diff: media/base/scoped_histogram_timer.h

Issue 18052007: Use a direct include of time headers in media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/base/ranges.h ('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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_ 5 #ifndef MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
6 #define MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_ 6 #define MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
7 7
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time.h" 9 #include "base/time/time.h"
10 10
11 // Scoped class which logs its time on this earth as a UMA statistic. Must be 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 12 // a #define macro since UMA macros prevent variables as names. The nested
13 // macro is necessary to expand __COUNTER__ to an actual value. 13 // macro is necessary to expand __COUNTER__ to an actual value.
14 #define SCOPED_UMA_HISTOGRAM_TIMER(name) \ 14 #define SCOPED_UMA_HISTOGRAM_TIMER(name) \
15 SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, __COUNTER__) 15 SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, __COUNTER__)
16 16
17 #define SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, key) \ 17 #define SCOPED_UMA_HISTOGRAM_TIMER_EXPANDER(name, key) \
18 SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key) 18 SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key)
19 19
20 #define SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key) \ 20 #define SCOPED_UMA_HISTOGRAM_TIMER_UNIQUE(name, key) \
21 class ScopedHistogramTimer##key { \ 21 class ScopedHistogramTimer##key { \
22 public: \ 22 public: \
23 ScopedHistogramTimer##key() : constructed_(base::TimeTicks::Now()) {} \ 23 ScopedHistogramTimer##key() : constructed_(base::TimeTicks::Now()) {} \
24 ~ScopedHistogramTimer##key() { \ 24 ~ScopedHistogramTimer##key() { \
25 base::TimeDelta elapsed = base::TimeTicks::Now() - constructed_; \ 25 base::TimeDelta elapsed = base::TimeTicks::Now() - constructed_; \
26 UMA_HISTOGRAM_TIMES(name, elapsed); \ 26 UMA_HISTOGRAM_TIMES(name, elapsed); \
27 } \ 27 } \
28 private: \ 28 private: \
29 base::TimeTicks constructed_; \ 29 base::TimeTicks constructed_; \
30 } scoped_histogram_timer_##key 30 } scoped_histogram_timer_##key
31 31
32 #endif // MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_ 32 #endif // MEDIA_BASE_SCOPED_HISTOGRAM_TIMER_H_
OLDNEW
« no previous file with comments | « media/base/ranges.h ('k') | media/base/scoped_histogram_timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698