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 |