Index: build/android/pylib/perf/test_runner.py |
diff --git a/build/android/pylib/perf/test_runner.py b/build/android/pylib/perf/test_runner.py |
index 9d1f4371705ea9f1fdb8341a0328bf085463a44a..3bee6021db81335c8b6d32a080d8c595cc3d7c65 100644 |
--- a/build/android/pylib/perf/test_runner.py |
+++ b/build/android/pylib/perf/test_runner.py |
@@ -66,11 +66,29 @@ from pylib.base import base_test_runner |
from pylib.device import device_errors |
+def GetPersistedResult(test_name): |
+ file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) |
+ if not os.path.exists(file_name): |
+ logging.error('File not found %s', file_name) |
+ return None |
+ |
+ with file(file_name, 'r') as f: |
+ return pickle.loads(f.read()) |
+ |
+ |
def OutputJsonList(json_input, json_output): |
with file(json_input, 'r') as i: |
all_steps = json.load(i) |
- step_values = [{'test': k, 'device_affinity': v['device_affinity']} |
- for k, v in all_steps['steps'].iteritems()] |
+ |
+ step_values = [] |
+ for k, v in all_steps['steps'].iteritems(): |
+ data = {'test': k, 'device_affinity': v['device_affinity']} |
+ |
+ persisted_result = GetPersistedResult(k) |
+ if persisted_result: |
+ data['total_time'] = persisted_result['total_time'] |
+ step_values.append(data) |
+ |
with file(json_output, 'w') as o: |
o.write(json.dumps(step_values)) |
return 0 |
@@ -86,13 +104,9 @@ def PrintTestOutput(test_name, json_file_name=None): |
Returns: |
exit code generated by the test step. |
""" |
- file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) |
- if not os.path.exists(file_name): |
- logging.error('File not found %s', file_name) |
+ persisted_result = GetPersistedResult(test_name) |
+ if not persisted_result: |
return 1 |
- |
- with file(file_name, 'r') as f: |
- persisted_result = pickle.loads(f.read()) |
logging.info('*' * 80) |
logging.info('Output from:') |
logging.info(persisted_result['cmd']) |