crosperf: fix telemetry results parsing.
New telemetry results provide multiple values for a single key.
This CL uses the average value to make crosperf work.
BUG=chromium:639896
TEST=run crosperf with 2 iterations of speedometer.
Change-Id: I32e7a00a57dbbe995915af0c32918f1d680ae484
Reviewed-on: https://chrome-internal-review.googlesource.com/279057
Commit-Ready: Yunlian Jiang <yunlian@google.com>
Tested-by: Yunlian Jiang <yunlian@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
diff --git a/cros_utils/tabulator.py b/cros_utils/tabulator.py
index 1a262f1..2c26cca 100644
--- a/cros_utils/tabulator.py
+++ b/cros_utils/tabulator.py
@@ -259,8 +259,6 @@
baseline_values: List of baseline values. Can be none if this is the
baseline itself.
"""
- if len(values) == 1 and type(values[0]) == list:
- values = values[0]
all_floats = True
values = _StripNone(values)
if not values:
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index a569080..21f1ca6 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -113,7 +113,13 @@
if 'value' in result_dict:
keyvals_dict[key] = result_dict['value']
elif 'values' in result_dict:
- keyvals_dict[key] = result_dict['values']
+ values = result_dict['values'];
+ if ('type' in result_dict and
+ result_dict['type'] == 'list_of_scalar_values' and
+ values and values != 'null'):
+ keyvals_dict[key] = sum(values)/float(len(values))
+ else:
+ keyvals_dict[key] = values
units_dict[key] = result_dict['units']
else:
if os.path.exists(data_filename):
@@ -320,9 +326,15 @@
if 'value' in value_dict:
result = value_dict['value']
elif 'values' in value_dict:
- if not value_dict['values']:
+ values = value_dict['values']
+ if not values:
continue
- result = value_dict['values']
+ if ('type' in value_dict and
+ value_dict['type'] == 'list_of_scalar_values' and
+ values != 'null'):
+ result = sum(values)/float(len(values))
+ else:
+ result = values
units = value_dict['units']
new_value = [result, units]
keyvals[keyname] = new_value