aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Test.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Test.h')
-rw-r--r--tests/Test.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/Test.h b/tests/Test.h
index d643c8382a..411ce11c20 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -85,6 +85,27 @@ enum GPUTestContexts {
template<typename T>
void RunWithGPUTestContexts(T testFunction, GPUTestContexts contexts, Reporter* reporter,
GrContextFactory* factory);
+
+/** Timer provides wall-clock duration since its creation. */
+class Timer {
+public:
+ /** Starts the timer. */
+ Timer();
+
+ /** Nanoseconds since creation. */
+ double elapsedNs() const;
+
+ /** Milliseconds since creation. */
+ double elapsedMs() const;
+
+ /** Milliseconds since creation as an integer.
+ Behavior is undefined for durations longer than SK_MSecMax.
+ */
+ SkMSec elapsedMsInt() const;
+private:
+ double fStartNanos;
+};
+
} // namespace skiatest
#define REPORTER_ASSERT(r, cond) \