| Index: tools/timer/Timer.h
|
| diff --git a/bench/BenchTimer.h b/tools/timer/Timer.h
|
| similarity index 53%
|
| rename from bench/BenchTimer.h
|
| rename to tools/timer/Timer.h
|
| index 2abf10b80f9e1d4cca7234cbbd2782af8a37c980..15c93f5603cae9478574a7136069a163ca427768 100644
|
| --- a/bench/BenchTimer.h
|
| +++ b/tools/timer/Timer.h
|
| @@ -1,18 +1,25 @@
|
| -
|
| /*
|
| * Copyright 2011 Google Inc.
|
| *
|
| * Use of this source code is governed by a BSD-style license that can be
|
| * found in the LICENSE file.
|
| */
|
| -#ifndef SkBenchTimer_DEFINED
|
| -#define SkBenchTimer_DEFINED
|
| +#ifndef Timer_DEFINED
|
| +#define Timer_DEFINED
|
|
|
| -#include <SkTypes.h>
|
| +#include "SkTypes.h"
|
|
|
| +#if defined(SK_BUILD_FOR_WIN32)
|
| + #include "SysTimer_windows.h"
|
| +#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
|
| + #include "SysTimer_mach.h"
|
| +#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
|
| + #include "SysTimer_posix.h"
|
| +#endif
|
|
|
| -class BenchSysTimer;
|
| -class BenchGpuTimer;
|
| +#if SK_SUPPORT_GPU
|
| + #include "GpuTimer.h"
|
| +#endif
|
|
|
| class SkGLContextHelper;
|
|
|
| @@ -25,13 +32,15 @@ class SkGLContextHelper;
|
| * times and (for GPU configurations) can be used to roughly (very
|
| * roughly) gauge the GPU load/backlog.
|
| */
|
| -class BenchTimer {
|
| +class Timer {
|
| public:
|
| - BenchTimer(SkGLContextHelper* gl = NULL);
|
| - ~BenchTimer();
|
| - void start(double durationScale = 1);
|
| - void end();
|
| + explicit Timer(SkGLContextHelper* gl = NULL);
|
| +
|
| + void start();
|
| void truncatedEnd();
|
| + void end();
|
| +
|
| + // All times in milliseconds.
|
| double fCpu;
|
| double fWall;
|
| double fTruncatedCpu;
|
| @@ -39,29 +48,26 @@ public:
|
| double fGpu;
|
|
|
| private:
|
| - BenchSysTimer* fSysTimer;
|
| - BenchSysTimer* fTruncatedSysTimer;
|
| + SysTimer fSysTimer;
|
| + SysTimer fTruncatedSysTimer;
|
| #if SK_SUPPORT_GPU
|
| - BenchGpuTimer* fGpuTimer;
|
| + GpuTimer fGpuTimer;
|
| #endif
|
| - double fDurationScale; // for this start/end session
|
| };
|
|
|
| -// Same as BenchTimer above, supporting only fWall but with much lower overhead.
|
| -// (Typically, ~30ns instead of BenchTimer's ~1us.)
|
| +// Same as Timer above, supporting only fWall but with much lower overhead.
|
| +// (Typically, ~30ns instead of Timer's ~1us.)
|
| class WallTimer {
|
| public:
|
| WallTimer();
|
| - ~WallTimer();
|
|
|
| - void start(double durationScale = 1);
|
| + void start();
|
| void end();
|
|
|
| - double fWall;
|
| + double fWall; // Milliseconds.
|
|
|
| private:
|
| - BenchSysTimer* fSysTimer;
|
| - double fDurationScale;
|
| + SysTimer fSysTimer;
|
| };
|
|
|
| #endif
|
|
|