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.
|
|
|
|
* This class combines a SysTimer and a GpuTimer into one single,
|
|
|
|
* platform specific, Timer with a simple interface.
|
|
|
|
*/
|
|
|
|
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();
|
|
|
|
double fCpu;
|
|
|
|
double fWall;
|
|
|
|
double fGpu;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-06-07 19:16:02 +00:00
|
|
|
private:
|
|
|
|
BenchSysTimer *fSysTimer;
|
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
|