aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-08-10 15:01:06 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-10 16:57:42 -0700
commitb9f97db723647b5e4507eac2e0ae53869da57d4a (patch)
tree4af1fba896a4af232c136faecdeb3bc46dfc0a1f /crosperf
parente56ceb4e7387a7f7ccb6d8d3b03e3e9692453cbd (diff)
downloadtoolchain-utils-b9f97db723647b5e4507eac2e0ae53869da57d4a.tar.gz
[crosperf] Update parsing of telemetry json file.
They've updated the format of the output in the json file. This updates crosperf to work with either the old or the new format. BUG=None TEST=./run_tests and ran crosperf successfully. Change-Id: I0b22f4c740943c55c0c521ab715e0b70fbbdfc69 Reviewed-on: https://chrome-internal-review.googlesource.com/274195 Commit-Ready: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/results_cache.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index a06a9b62..e9096563 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -310,10 +310,18 @@ class Result(object):
keyvals = {}
with open(filename, 'r') as f:
raw_dict = json.load(f)
+ if 'charts' in raw_dict:
+ raw_dict = raw_dict['charts']
for k, field_dict in raw_dict.iteritems():
- for item, value_dict in field_dict.iteritems():
+ for item in field_dict:
keyname = k + "__" + item
- result = value_dict['value']
+ value_dict = field_dict[item]
+ if 'value' in value_dict:
+ result = value_dict['value']
+ elif 'values' in value_dict:
+ result = value_dict['values'][0]
+ if len(value_dict['values']) > 1:
+ raise RuntimeError('Too many values returned for %s.' % item)
units = value_dict['units']
new_value = [result, units]
keyvals[keyname] = new_value