OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef Timer_DEFINED | 7 #ifndef Timer_DEFINED |
8 #define Timer_DEFINED | 8 #define Timer_DEFINED |
9 | 9 |
10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
11 | 11 |
12 #if defined(SK_BUILD_FOR_WIN32) | 12 #if defined(SK_BUILD_FOR_WIN32) |
13 #include "SysTimer_windows.h" | 13 #include "SysTimer_windows.h" |
14 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 14 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
15 #include "SysTimer_mach.h" | 15 #include "SysTimer_mach.h" |
16 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) | 16 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) |
17 #include "SysTimer_posix.h" | 17 #include "SysTimer_posix.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if SK_SUPPORT_GPU | 20 #if SK_SUPPORT_GPU |
21 #include "GpuTimer.h" | 21 #include "GpuTimer.h" |
22 #endif | 22 #endif |
23 | 23 |
24 class SkGLContextHelper; | 24 class SkGLContext; |
25 | 25 |
26 /** | 26 /** |
27 * SysTimers and GpuTimers are implemented orthogonally. | 27 * SysTimers and GpuTimers are implemented orthogonally. |
28 * This class combines 2 SysTimers and a GpuTimer into one single, | 28 * This class combines 2 SysTimers and a GpuTimer into one single, |
29 * platform specific Timer with a simple interface. The truncated | 29 * platform specific Timer with a simple interface. The truncated |
30 * timer doesn't include the time required for the GPU to finish | 30 * timer doesn't include the time required for the GPU to finish |
31 * its rendering. It should always be <= the un-truncated system | 31 * its rendering. It should always be <= the un-truncated system |
32 * times and (for GPU configurations) can be used to roughly (very | 32 * times and (for GPU configurations) can be used to roughly (very |
33 * roughly) gauge the GPU load/backlog. | 33 * roughly) gauge the GPU load/backlog. |
34 */ | 34 */ |
35 class Timer { | 35 class Timer { |
36 public: | 36 public: |
37 explicit Timer(SkGLContextHelper* gl = NULL); | 37 explicit Timer(SkGLContext* gl = NULL); |
38 | 38 |
39 void start(); | 39 void start(); |
40 void truncatedEnd(); | 40 void truncatedEnd(); |
41 void end(); | 41 void end(); |
42 | 42 |
43 // All times in milliseconds. | 43 // All times in milliseconds. |
44 double fCpu; | 44 double fCpu; |
45 double fWall; | 45 double fWall; |
46 double fTruncatedCpu; | 46 double fTruncatedCpu; |
47 double fTruncatedWall; | 47 double fTruncatedWall; |
(...skipping 16 matching lines...) Expand all Loading... |
64 void start(); | 64 void start(); |
65 void end(); | 65 void end(); |
66 | 66 |
67 double fWall; // Milliseconds. | 67 double fWall; // Milliseconds. |
68 | 68 |
69 private: | 69 private: |
70 SysTimer fSysTimer; | 70 SysTimer fSysTimer; |
71 }; | 71 }; |
72 | 72 |
73 #endif | 73 #endif |
OLD | NEW |