aboutsummaryrefslogtreecommitdiff
path: root/crosperf/results_cache.py
diff options
context:
space:
mode:
authorcmtice <cmtice@google.com>2013-11-20 16:36:04 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-11-22 00:45:40 +0000
commit5f3ccbddaaf5f4a64431c9e68faf83a348ecdfdd (patch)
treeef9460669b0d6f727cab8e060d5bb110869b557a /crosperf/results_cache.py
parent57995561e1b6e98efcc8659b27a775a713a8e02b (diff)
downloadtoolchain-utils-5f3ccbddaaf5f4a64431c9e68faf83a348ecdfdd.tar.gz
Update report generation to check for a 'perf_measurements' file.
The latest version of telemetry_Crosperf generates a perf_measurements file, containing the test results, rather than a keyval file. This CL checks for perf_measurements, and reads it, if it is there. This change is backwards compatible with the older versions of telemetry_Crosperf that used the keyval file. BUG=None TEST=Tested this with the results only in a keyval file and only in a perf_measurements file. Got acceptable test reports either way. Change-Id: If10a62b2f7fbe89d35c1ebe789a81764c9d134e4 Reviewed-on: https://chrome-internal-review.googlesource.com/148295 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf/results_cache.py')
-rw-r--r--crosperf/results_cache.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index da796598..39e9902a 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -13,6 +13,7 @@ import os
import pickle
import re
import tempfile
+import json
from utils import command_executer
from utils import misc
@@ -62,6 +63,23 @@ class Result(object):
self._CopyFilesTo(dest_dir, self.perf_data_files)
self._CopyFilesTo(dest_dir, self.perf_report_files)
+ def _GetNewKeyvals(self, keyvals_dict):
+ results_files = self._GetDataMeasurementsFiles()
+ for f in results_files:
+ data_filename = os.path.join(self._chromeos_root, "/tmp",
+ self._temp_dir, f)
+ if os.path.exists(data_filename):
+ with open(data_filename, "r") as data_file:
+ lines = data_file.readlines()
+ for line in lines:
+ tmp_dict = json.loads(line)
+ key = tmp_dict['description']
+ val = tmp_dict['value']
+ keyvals_dict[key] = val
+
+ return keyvals_dict
+
+
def _GetKeyvals(self):
results_in_chroot = os.path.join(self._chromeos_root,
"chroot", "tmp")
@@ -86,7 +104,9 @@ class Result(object):
value = tokens[-1]
keyvals_dict[key] = value
- return keyvals_dict
+ # Check to see if there is a perf_measurements file and get the
+ # data from it if so.
+ return self._GetNewKeyvals(keyvals_dict)
def _GetResultsDir(self):
mo = re.search(r"Results placed in (\S+)", self.out)
@@ -112,6 +132,9 @@ class Result(object):
def _GetPerfReportFiles(self):
return self._FindFilesInResultsDir("-name perf.data.report").splitlines()
+ def _GetDataMeasurementsFiles(self):
+ return self._FindFilesInResultsDir("-name perf_measurements").splitlines()
+
def _GeneratePerfReportFiles(self):
perf_report_files = []
for perf_data_file in self.perf_data_files:
@@ -493,4 +516,3 @@ class MockResult(Result):
self.out = out
self.err = err
self.retval = retval
-