diff options
author | Yunlian Jiang <yunlian@chromium.org> | 2016-08-22 16:56:24 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-24 11:43:17 -0700 |
commit | 1ced193baabbf6d6aa1aa3913bcff714e5ae376d (patch) | |
tree | 3cfde0cb559e3b2581ae6f2cb476d6c33a203917 | |
parent | eb9fce674ff90a6de04827bfe1ef6e07a99c8f61 (diff) | |
download | toolchain-utils-1ced193baabbf6d6aa1aa3913bcff714e5ae376d.tar.gz |
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>
-rw-r--r-- | cros_utils/tabulator.py | 2 | ||||
-rw-r--r-- | crosperf/results_cache.py | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/cros_utils/tabulator.py b/cros_utils/tabulator.py index 1a262f17..2c26ccad 100644 --- a/cros_utils/tabulator.py +++ b/cros_utils/tabulator.py @@ -259,8 +259,6 @@ class Result(object): 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 a5690804..21f1ca6d 100644 --- a/crosperf/results_cache.py +++ b/crosperf/results_cache.py @@ -113,7 +113,13 @@ class Result(object): 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 @@ class Result(object): 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 |