diff options
Diffstat (limited to 'tests/Test.cpp')
-rw-r--r-- | tests/Test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Test.cpp b/tests/Test.cpp index f6f2bdab3d..dcb08e6bad 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); +} |