diff options
author | Caroline Tice <cmtice@google.com> | 2016-08-19 12:08:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-19 17:35:41 -0700 |
commit | eb9fce674ff90a6de04827bfe1ef6e07a99c8f61 (patch) | |
tree | 02979d74bbeaf48e1e63371d997ef3d6912bac09 | |
parent | 2adc55674e2444d371d5e351e500acaced490eea (diff) | |
download | toolchain-utils-eb9fce674ff90a6de04827bfe1ef6e07a99c8f61.tar.gz |
[crosperf] Fix reading from cache.
The read-from-cache code needed to be updated to deal with the new
telemetry results format, as did the code for generating json
reports (for archiving in the database).
BUG=chromium:639106
TEST=Tested with crosperf reading from cache & generating json results.
Change-Id: I2c97e5b393583048cc74559d065f498c0f0675a1
Reviewed-on: https://chrome-internal-review.googlesource.com/278298
Commit-Ready: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
-rw-r--r-- | crosperf/results_cache.py | 12 | ||||
-rw-r--r-- | crosperf/results_report.py | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py index 9467cc86..a5690804 100644 --- a/crosperf/results_cache.py +++ b/crosperf/results_cache.py @@ -1,4 +1,3 @@ - # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -104,6 +103,8 @@ class Result(object): with open(data_filename, 'r') as data_file: raw_dict = json.load(data_file) + if 'charts' in raw_dict: + raw_dict = raw_dict['charts'] for k1 in raw_dict: field_dict = raw_dict[k1] for k2 in field_dict: @@ -327,15 +328,16 @@ class Result(object): keyvals[keyname] = new_value return keyvals - def ProcessResults(self): + def ProcessResults(self, use_cache=False): # Note that this function doesn't know anything about whether there is a # cache hit or miss. It should process results agnostic of the cache hit # state. if self.results_file and self.results_file[0].find('results_chart.json'): self.keyvals = self.ProcessJsonResults() else: - print('\n ** WARNING **: Had to use deprecated output-method to ' - 'collect results.\n') + if not use_cache: + print('\n ** WARNING **: Had to use deprecated output-method to ' + 'collect results.\n') self.keyvals = self.GetKeyvals() self.keyvals['retval'] = self.retval # Generate report from all perf.data files. @@ -379,7 +381,7 @@ class Result(object): self.perf_data_files = self.GetPerfDataFiles() self.perf_report_files = self.GetPerfReportFiles() self.chrome_version = self.GetChromeVersionFromCache(cache_dir) - self.ProcessResults() + self.ProcessResults(use_cache=True) def CleanUp(self, rm_chroot_tmp): if rm_chroot_tmp and self.results_dir: diff --git a/crosperf/results_report.py b/crosperf/results_report.py index 79a57497..adb85874 100644 --- a/crosperf/results_report.py +++ b/crosperf/results_report.py @@ -612,6 +612,10 @@ class JSONResultsReport(ResultsReport): v = iter_results[f] if type(v) == list: v = v[0] + # New telemetry results format: sometimes we get a list + # of lists now. + if type(v) == list: + v = v[0] item = (f, float(v)) value.append(item) json_results['overall_result'] = value @@ -624,6 +628,8 @@ class JSONResultsReport(ResultsReport): v = v[0] if v != 'PASS': if k.find('machine') == -1: + if v is None: + continue if type(v) != list: detail_results[k] = float(v) else: |