• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
8 #ifndef SkBenchTimer_DEFINED
9 #define SkBenchTimer_DEFINED
10 
11 #include <SkTypes.h>
12 
13 
14 class BenchSysTimer;
15 class BenchGpuTimer;
16 
17 class SkGLContext;
18 
19 /**
20  * SysTimers and GpuTimers are implemented orthogonally.
21  * This class combines 2 SysTimers and a GpuTimer into one single,
22  * platform specific Timer with a simple interface. The truncated
23  * timer doesn't include the time required for the GPU to finish
24  * its rendering. It should always be <= the un-truncated system
25  * times and (for GPU configurations) can be used to roughly (very
26  * roughly) gauge the GPU load/backlog.
27  */
28 class BenchTimer {
29 public:
30     BenchTimer(SkGLContext* gl = NULL);
31     ~BenchTimer();
32     void start();
33     void end();
34     void truncatedEnd();
35     double fCpu;
36     double fWall;
37     double fTruncatedCpu;
38     double fTruncatedWall;
39     double fGpu;
40 
41 private:
42     BenchSysTimer *fSysTimer;
43     BenchSysTimer *fTruncatedSysTimer;
44 #if SK_SUPPORT_GPU
45     BenchGpuTimer *fGpuTimer;
46 #endif
47 };
48 
49 #endif
50