aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-03-03 10:43:56 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-03-05 00:08:47 +0000
commit25d32b4add9a0d0ac4ec682062e45baea97bff04 (patch)
tree80fe6497685a0e53417f2a58834de1cd08cc22de /crosperf
parenteff2fc1c86365c53ae228df4653524ceb6168d92 (diff)
downloadtoolchain-utils-25d32b4add9a0d0ac4ec682062e45baea97bff04.tar.gz
[crosperf] Fix missing chrome_version problem (v2).
When generating the json reports, occasionally the chrome_version comes up blank (this can happen when reading some results from the cache, for example). A blank chrome_version messes up our dremel database scripts. This CL updates the read-cache scenario to find the chrome_version in the cache keys (human-readable) file. BUG=chromium:591494 TEST=Tested with experiment that was generating blank Chrome versions and this fixed the problem. Change-Id: I29985581aa00bc30fb65720fb9d197f1475445e4 Reviewed-on: https://chrome-internal-review.googlesource.com/249960 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/benchmark_run.py9
-rw-r--r--crosperf/results_cache.py20
2 files changed, 26 insertions, 3 deletions
diff --git a/crosperf/benchmark_run.py b/crosperf/benchmark_run.py
index 209b3f71..35977a63 100644
--- a/crosperf/benchmark_run.py
+++ b/crosperf/benchmark_run.py
@@ -112,9 +112,12 @@ class BenchmarkRun(threading.Thread):
self.machine)
self.cache.StoreResult(self.result)
- if self.machine and not self.label.chrome_version:
- self.label.chrome_version = self.machine_manager.GetChromeVersion(
- self.machine)
+ if not self.label.chrome_version:
+ if self.machine:
+ self.label.chrome_version = self.machine_manager.GetChromeVersion(
+ self.machine)
+ elif self.result.chrome_version:
+ self.label.chrome_version = self.result.chrome_version
if self.terminated:
return
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index e2ff9d4c..a0955e6f 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -49,6 +49,7 @@ class Result(object):
self.machine = machine
self.perf_data_files = []
self.perf_report_files = []
+ self.chrome_version = ''
def CopyFilesTo(self, dest_dir, files_to_copy):
file_index = 0
@@ -269,6 +270,21 @@ class Result(object):
# Now parse all perf report files and include them in keyvals.
self.GatherPerfResults()
+ def GetChromeVersionFromCache(self, cache_dir):
+ # Read chrome_version from keys file, if present.
+ chrome_version = ''
+ keys_file = os.path.join(cache_dir, CACHE_KEYS_FILE)
+ if os.path.exists(keys_file):
+ with open(keys_file, 'r') as f:
+ lines = f.readlines()
+ for l in lines:
+ if l.find('Google Chrome ') == 0:
+ chrome_version = l
+ if chrome_version[-1] == '\n':
+ chrome_version = chrome_version[:-1]
+ break
+ return chrome_version
+
def PopulateFromCacheDir(self, cache_dir, show_all, test, suite):
self.test_name = test
self.suite = suite
@@ -290,6 +306,7 @@ class Result(object):
self.results_dir = self.temp_dir
self.perf_data_files = self.GetPerfDataFiles()
self.perf_report_files = self.GetPerfReportFiles()
+ self.chrome_version = self.GetChromeVersionFromCache(cache_dir)
self.ProcessResults(show_all)
def CleanUp(self, rm_chroot_tmp):
@@ -444,6 +461,9 @@ class TelemetryResult(Result):
self.out = pickle.load(f)
self.err = pickle.load(f)
self.retval = pickle.load(f)
+
+ self.chrome_version = \
+ super(TelemetryResult, self).GetChromeVersionFromCache(cache_dir)
self.ProcessResults()