2011-07-28 14:26:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2011-06-07 19:16:02 +00:00
|
|
|
#ifndef SkBenchTimer_DEFINED
|
|
|
|
#define SkBenchTimer_DEFINED
|
|
|
|
|
2011-10-19 20:43:20 +00:00
|
|
|
#include <SkTypes.h>
|
|
|
|
|
|
|
|
|
2011-06-07 19:16:02 +00:00
|
|
|
class BenchSysTimer;
|
|
|
|
class BenchGpuTimer;
|
|
|
|
|
2011-10-19 20:43:20 +00:00
|
|
|
class SkGLContext;
|
|
|
|
|
2011-06-07 19:16:02 +00:00
|
|
|
/**
|
|
|
|
* SysTimers and GpuTimers are implemented orthogonally.
|
2012-08-28 12:18:40 +00:00
|
|
|
* This class combines 2 SysTimers and a GpuTimer into one single,
|
|
|
|
* platform specific Timer with a simple interface. The truncated
|
|
|
|
* timer doesn't include the time required for the GPU to finish
|
|
|
|
* its rendering. It should always be <= the un-truncated system
|
|
|
|
* times and (for GPU configurations) can be used to roughly (very
|
|
|
|
* roughly) gauge the GPU load/backlog.
|
2011-06-07 19:16:02 +00:00
|
|
|
*/
|
|
|
|
class BenchTimer {
|
|
|
|
public:
|
2011-10-19 20:43:20 +00:00
|
|
|
BenchTimer(SkGLContext* gl = NULL);
|
2011-06-07 19:16:02 +00:00
|
|
|
~BenchTimer();
|
|
|
|
void start();
|
|
|
|
void end();
|
2012-08-28 12:18:40 +00:00
|
|
|
void truncatedEnd();
|
2011-06-07 19:16:02 +00:00
|
|
|
double fCpu;
|
|
|
|
double fWall;
|
2012-08-28 12:18:40 +00:00
|
|
|
double fTruncatedCpu;
|
|
|
|
double fTruncatedWall;
|
2011-06-07 19:16:02 +00:00
|
|
|
double fGpu;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-06-07 19:16:02 +00:00
|
|
|
private:
|
|
|
|
BenchSysTimer *fSysTimer;
|
2012-08-28 12:18:40 +00:00
|
|
|
BenchSysTimer *fTruncatedSysTimer;
|
2012-08-02 14:03:32 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2011-06-07 19:16:02 +00:00
|
|
|
BenchGpuTimer *fGpuTimer;
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif
|
2011-06-07 19:16:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|