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

Side by Side Diff: tools/timer/Timer.h

Issue 346753003: Revert of Move BenchTimer to tools as Timer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « tools/timer/SysTimer_windows.cpp ('k') | tools/timer/Timer.cpp » ('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 /*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 #ifndef Timer_DEFINED
8 #define Timer_DEFINED
9
10 #include "SkTypes.h"
11
12 #if defined(SK_BUILD_FOR_WIN32)
13 #include "SysTimer_windows.h"
14 #elif defined(SK_BUILD_FOR_MAC)
15 #include "SysTimer_mach.h"
16 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
17 #include "SysTimer_posix.h"
18 #endif
19
20 #if SK_SUPPORT_GPU
21 #include "GpuTimer.h"
22 #endif
23
24 class SkGLContextHelper;
25
26 /**
27 * SysTimers and GpuTimers are implemented orthogonally.
28 * This class combines 2 SysTimers and a GpuTimer into one single,
29 * platform specific Timer with a simple interface. The truncated
30 * timer doesn't include the time required for the GPU to finish
31 * its rendering. It should always be <= the un-truncated system
32 * times and (for GPU configurations) can be used to roughly (very
33 * roughly) gauge the GPU load/backlog.
34 */
35 class Timer {
36 public:
37 explicit Timer(SkGLContextHelper* gl = NULL);
38
39 void start();
40 void truncatedEnd();
41 void end();
42
43 // All times in milliseconds.
44 double fCpu;
45 double fWall;
46 double fTruncatedCpu;
47 double fTruncatedWall;
48 double fGpu;
49
50 private:
51 SysTimer fSysTimer;
52 SysTimer fTruncatedSysTimer;
53 #if SK_SUPPORT_GPU
54 GpuTimer fGpuTimer;
55 #endif
56 };
57
58 // Same as Timer above, supporting only fWall but with much lower overhead.
59 // (Typically, ~30ns instead of Timer's ~1us.)
60 class WallTimer {
61 public:
62 WallTimer();
63
64 void start();
65 void end();
66
67 double fWall; // Milliseconds.
68
69 private:
70 SysTimer fSysTimer;
71 };
72
73 #endif
OLDNEW
« no previous file with comments | « tools/timer/SysTimer_windows.cpp ('k') | tools/timer/Timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698