Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: tools/bench_playback.cpp

Issue 253843004: Add --timescale to bench_record and bench_playback. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/bench_record.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bench_playback.cpp
diff --git a/tools/bench_playback.cpp b/tools/bench_playback.cpp
index 95dd4820136a778845b10fefe027eb044aa117b0..89b384842d88d09a665e9e8211573eb4432ee1d1 100644
--- a/tools/bench_playback.cpp
+++ b/tools/bench_playback.cpp
@@ -24,6 +24,13 @@ DEFINE_int32(loops, 10, "Number of times to play back each SKP.");
DEFINE_bool(skr, false, "Play via SkRecord instead of SkPicture.");
DEFINE_int32(tile, 1000000000, "Simulated tile size.");
DEFINE_string(match, "", "The usual filters on file names of SKPs to bench.");
+DEFINE_string(timescale, "ms", "Print times in ms, us, or ns");
+
+static double scale_time(double ms) {
+ if (FLAGS_timescale.contains("us")) ms *= 1000;
+ if (FLAGS_timescale.contains("ns")) ms *= 1000000;
+ return ms;
+}
static void bench(SkPMColor* scratch, SkPicture& src, const char* name) {
// We don't use the public SkRecording interface here because we need kWriteOnly_Mode.
@@ -52,7 +59,7 @@ static void bench(SkPMColor* scratch, SkPicture& src, const char* name) {
timer.end();
const double msPerLoop = timer.fCpu / (double)FLAGS_loops;
- printf("%u\t%s\n", unsigned(1000 * msPerLoop), name);
+ printf("%f\t%s\n", scale_time(msPerLoop), name);
}
int tool_main(int argc, char** argv);
« no previous file with comments | « no previous file | tools/bench_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698