Index: tests/Test.cpp |
diff --git a/tests/Test.cpp b/tests/Test.cpp |
index f6f2bdab3d751053f82d14811cb0840185af73dc..dcb08e6badc6bf513740657f01e733c46794f559 100644 |
--- a/tests/Test.cpp |
+++ b/tests/Test.cpp |
@@ -36,3 +36,17 @@ SkString skiatest::GetTmpDir() { |
const char* tmpDir = FLAGS_tmpDir.isEmpty() ? nullptr : FLAGS_tmpDir[0]; |
return SkString(tmpDir); |
} |
+ |
+skiatest::Timer::Timer() : fStartNanos(SkTime::GetNSecs()) {} |
+ |
+double skiatest::Timer::elapsedNs() const { |
+ return SkTime::GetNSecs() - fStartNanos; |
+} |
+ |
+double skiatest::Timer::elapsedMs() const { return this->elapsedNs() * 1e-6; } |
+ |
+SkMSec skiatest::Timer::elapsedMsInt() const { |
+ const double elapsedMs = this->elapsedMs(); |
+ SkASSERT(SK_MSecMax >= elapsedMs); |
+ return static_cast<SkMSec>(elapsedMs); |
+} |