nanobench: add --runOnce.
BUG=skia:
R=egdaniel@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/392583005
diff --git a/tools/Stats.h b/tools/Stats.h
index 67bd45d..3f19af2 100644
--- a/tools/Stats.h
+++ b/tools/Stats.h
@@ -34,9 +34,15 @@
SkTQSort(sorted.get(), sorted.get() + n - 1);
median = sorted[n/2];
+ // Normalize samples to [min, max] in as many quanta as we have distinct bars to print.
for (int i = 0; i < n; i++) {
+ if (min == max) {
+ // All samples are the same value. Don't divide by zero.
+ plot.append(kBars[0]);
+ continue;
+ }
+
double s = samples[i];
- // Normalize samples to [min, max] in as many quanta as we have distinct bars to print.
s -= min;
s /= (max - min);
s *= (SK_ARRAY_COUNT(kBars) - 1);