epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
bungeman@google.com | be9ad4e | 2011-06-07 19:16:02 +0000 | [diff] [blame] | 8 | #ifndef SkBenchTimer_DEFINED |
| 9 | #define SkBenchTimer_DEFINED |
| 10 | |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 11 | #include <SkTypes.h> |
| 12 | |
| 13 | |
bungeman@google.com | be9ad4e | 2011-06-07 19:16:02 +0000 | [diff] [blame] | 14 | class BenchSysTimer; |
| 15 | class BenchGpuTimer; |
| 16 | |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 17 | class SkGLContext; |
| 18 | |
bungeman@google.com | be9ad4e | 2011-06-07 19:16:02 +0000 | [diff] [blame] | 19 | /** |
| 20 | * SysTimers and GpuTimers are implemented orthogonally. |
| 21 | * This class combines a SysTimer and a GpuTimer into one single, |
| 22 | * platform specific, Timer with a simple interface. |
| 23 | */ |
| 24 | class BenchTimer { |
| 25 | public: |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 26 | BenchTimer(SkGLContext* gl = NULL); |
bungeman@google.com | be9ad4e | 2011-06-07 19:16:02 +0000 | [diff] [blame] | 27 | ~BenchTimer(); |
| 28 | void start(); |
| 29 | void end(); |
| 30 | double fCpu; |
| 31 | double fWall; |
| 32 | double fGpu; |
| 33 | |
| 34 | private: |
| 35 | BenchSysTimer *fSysTimer; |
| 36 | BenchGpuTimer *fGpuTimer; |
| 37 | }; |
| 38 | |
| 39 | #endif |