Add nanosecond timer.
I've been finding it hard to get enough resolution out of our existing timers when measuring really tiny pictures.
BUG=skia:2378
R=bsalomon@google.com, mtklein@google.com, bungeman@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/250243002
git-svn-id: http://skia.googlecode.com/svn/trunk@14362 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index a5dfe50..534ad96 100644
--- a/tools/bench_playback.cpp
+++ b/tools/bench_playback.cpp
@@ -40,7 +40,7 @@
src.width() * sizeof(SkPMColor)));
canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLAGS_tile)));
- const SkMSec start = SkTime::GetMSecs();
+ const SkNSec start = SkTime::GetNSecs();
for (int i = 0; i < FLAGS_loops; i++) {
if (FLAGS_skr) {
SkRecordDraw(record, canvas.get());
@@ -49,9 +49,9 @@
}
}
- const SkMSec elapsed = SkTime::GetMSecs() - start;
- const double msPerLoop = elapsed / (double)FLAGS_loops;
- printf("%6.2f\t%s\n", msPerLoop, name);
+ const SkNSec elapsed = SkTime::GetNSecs() - start;
+ const double nsPerLoop = elapsed / (double)FLAGS_loops;
+ printf("%u\t%s\n", SkToUInt(nsPerLoop), name);
}
int tool_main(int argc, char** argv);