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

Unified Diff: build/util/lib/common/perf_tests_results_helper.py

Issue 71543002: Telemetry: Don't use scientific notation for floats when printing results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/util/lib/common/perf_tests_results_helper.py
diff --git a/build/util/lib/common/perf_tests_results_helper.py b/build/util/lib/common/perf_tests_results_helper.py
index 9012f18cb45e5cc592cb88b8156dcc174c158344..6cb058b2df37a5e20034312cf9dca816d6fc0045 100644
--- a/build/util/lib/common/perf_tests_results_helper.py
+++ b/build/util/lib/common/perf_tests_results_helper.py
@@ -63,18 +63,26 @@ def GeomMeanAndStdDevFromHistogram(histogram_json):
return geom_mean, math.sqrt(sum_of_squares / count)
+def _ValueToString(v):
+ # Special case for floats so we don't print using scientific notation.
+ if isinstance(v, float):
+ return '%f' % v
+ else:
+ return str(v)
+
+
def _MeanAndStdDevFromList(values):
avg = None
sd = None
if len(values) > 1:
try:
- value = '[%s]' % ','.join([str(v) for v in values])
+ value = '[%s]' % ','.join([_ValueToString(v) for v in values])
avg = sum([float(v) for v in values]) / len(values)
sqdiffs = [(float(v) - avg) ** 2 for v in values]
variance = sum(sqdiffs) / (len(values) - 1)
sd = math.sqrt(variance)
except ValueError:
- value = ", ".join(values)
+ value = ', '.join(values)
else:
value = values[0]
return value, avg, sd
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698