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

Unified Diff: tools/Stats.h

Issue 392583005: nanobench: add --runOnce. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add a note Created 6 years, 5 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 | « bench/nanobench.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/Stats.h
diff --git a/tools/Stats.h b/tools/Stats.h
index 67bd45d863737944fc83728daf25a31be801cf6d..3f19af27cc5dfe11087c460a184bfd4460595f4a 100644
--- a/tools/Stats.h
+++ b/tools/Stats.h
@@ -34,9 +34,15 @@ struct Stats {
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);
« no previous file with comments | « bench/nanobench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698