simplify nanobench --quiet / -q output
This tries to cut things down to the very minimum you might want to know:
$ out/Release/nanobench --match nytimes --config 8888 gpu -q
Timer overhead: 29.6ns
! -> high variance, ? -> moderate variance
micros bench
2479.05 ! desk_nytimes.skp_1_mpd 8888
1313.92 desk_nytimes.skp_1_mpd gpu
3617.65 desk_nytimes.skp_1 8888
1158.34 desk_nytimes.skp_1 gpu
1368.99 ! keymobi_nytimes_com_.skp_1_mpd 8888
393.40 keymobi_nytimes_com_.skp_1_mpd gpu
1179.68 ! keymobi_nytimes_com_.skp_1 8888
342.74 keymobi_nytimes_com_.skp_1 gpu
All times are printed in microseconds, and high variance runs are marked.
BUG=skia:
Review URL: https://codereview.chromium.org/1493313003
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 602d613..a4453f9 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -1131,7 +1131,8 @@
if (kAutoTuneLoops != FLAGS_loops) {
SkDebugf("Fixed number of loops; times would only be misleading so we won't print them.\n");
} else if (FLAGS_quiet) {
- SkDebugf("median\tbench\tconfig\n");
+ SkDebugf("! -> high variance, ? -> moderate variance\n");
+ SkDebugf(" micros \tbench\n");
} else if (FLAGS_ms) {
SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tconfig\tbench\n");
} else {
@@ -1241,10 +1242,13 @@
, bench->getUniqueName()
, config);
} else if (FLAGS_quiet) {
- if (configs.count() == 1) {
- config = ""; // Only print the config if we run the same bench on more than one.
- }
- SkDebugf("%s\t%s\t%s\n", HUMANIZE(stats.median), bench->getUniqueName(), config);
+ const char* mark = " ";
+ const double stddev_percent = 100 * sqrt(stats.var) / stats.mean;
+ if (stddev_percent > 5) mark = "?";
+ if (stddev_percent > 10) mark = "!";
+
+ SkDebugf("%10.2f %s\t%s\t%s\n",
+ stats.median*1e3, mark, bench->getUniqueName(), config);
} else {
const double stddev_percent = 100 * sqrt(stats.var) / stats.mean;
SkDebugf("%4d/%-4dMB\t%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n"