OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkBenchTimer_DEFINED | 8 #ifndef SkBenchTimer_DEFINED |
9 #define SkBenchTimer_DEFINED | 9 #define SkBenchTimer_DEFINED |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 void start(double durationScale = 1); | 32 void start(double durationScale = 1); |
33 void end(); | 33 void end(); |
34 void truncatedEnd(); | 34 void truncatedEnd(); |
35 double fCpu; | 35 double fCpu; |
36 double fWall; | 36 double fWall; |
37 double fTruncatedCpu; | 37 double fTruncatedCpu; |
38 double fTruncatedWall; | 38 double fTruncatedWall; |
39 double fGpu; | 39 double fGpu; |
40 | 40 |
41 private: | 41 private: |
42 BenchSysTimer *fSysTimer; | 42 BenchSysTimer* fSysTimer; |
43 BenchSysTimer *fTruncatedSysTimer; | 43 BenchSysTimer* fTruncatedSysTimer; |
44 #if SK_SUPPORT_GPU | 44 #if SK_SUPPORT_GPU |
45 BenchGpuTimer *fGpuTimer; | 45 BenchGpuTimer* fGpuTimer; |
46 #endif | 46 #endif |
47 double fDurationScale; // for this start/end session | 47 double fDurationScale; // for this start/end session |
48 }; | 48 }; |
49 | 49 |
| 50 // Same as BenchTimer above, supporting only fWall but with much lower overhead. |
| 51 // (Typically, ~30ns instead of BenchTimer's ~1us.) |
| 52 class WallTimer { |
| 53 public: |
| 54 WallTimer(); |
| 55 ~WallTimer(); |
| 56 |
| 57 void start(double durationScale = 1); |
| 58 void end(); |
| 59 |
| 60 double fWall; |
| 61 |
| 62 private: |
| 63 BenchSysTimer* fSysTimer; |
| 64 double fDurationScale; |
| 65 }; |
| 66 |
50 #endif | 67 #endif |
OLD | NEW |