Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: build/android/pylib/perf/test_runner.py

Issue 1150563004: [Android] Log temperature at the start of each perf test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Runs perf tests. 5 """Runs perf tests.
6 6
7 Our buildbot infrastructure requires each slave to run steps serially. 7 Our buildbot infrastructure requires each slave to run steps serially.
8 This is sub-optimal for android, where these steps can run independently on 8 This is sub-optimal for android, where these steps can run independently on
9 multiple connected devices. 9 multiple connected devices.
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 import sys 56 import sys
57 import tempfile 57 import tempfile
58 import threading 58 import threading
59 import time 59 import time
60 60
61 from pylib import cmd_helper 61 from pylib import cmd_helper
62 from pylib import constants 62 from pylib import constants
63 from pylib import forwarder 63 from pylib import forwarder
64 from pylib.base import base_test_result 64 from pylib.base import base_test_result
65 from pylib.base import base_test_runner 65 from pylib.base import base_test_runner
66 from pylib.device import battery_utils
66 from pylib.device import device_errors 67 from pylib.device import device_errors
67 68
68 69
69 def GetPersistedResult(test_name): 70 def GetPersistedResult(test_name):
70 file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name) 71 file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name)
71 if not os.path.exists(file_name): 72 if not os.path.exists(file_name):
72 logging.error('File not found %s', file_name) 73 logging.error('File not found %s', file_name)
73 return None 74 return None
74 75
75 with file(file_name, 'r') as f: 76 with file(file_name, 'r') as f:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 tests: a dict mapping test_name to command. 185 tests: a dict mapping test_name to command.
185 flaky_tests: a list of flaky test_name. 186 flaky_tests: a list of flaky test_name.
186 """ 187 """
187 super(TestRunner, self).__init__(device, None) 188 super(TestRunner, self).__init__(device, None)
188 self._options = test_options 189 self._options = test_options
189 self._shard_index = shard_index 190 self._shard_index = shard_index
190 self._max_shard = max_shard 191 self._max_shard = max_shard
191 self._tests = tests 192 self._tests = tests
192 self._flaky_tests = flaky_tests 193 self._flaky_tests = flaky_tests
193 self._output_dir = None 194 self._output_dir = None
195 self._device_battery = battery_utils.BatteryUtils(self.device)
194 196
195 @staticmethod 197 @staticmethod
196 def _IsBetter(result): 198 def _IsBetter(result):
197 if result['actual_exit_code'] == 0: 199 if result['actual_exit_code'] == 0:
198 return True 200 return True
199 pickled = os.path.join(constants.PERF_OUTPUT_DIR, 201 pickled = os.path.join(constants.PERF_OUTPUT_DIR,
200 result['name']) 202 result['name'])
201 if not os.path.exists(pickled): 203 if not os.path.exists(pickled):
202 return True 204 return True
203 with file(pickled, 'r') as f: 205 with file(pickled, 'r') as f:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 logging.error('Exception when tearing down device %s', e) 256 logging.error('Exception when tearing down device %s', e)
255 257
256 cmd = ('%s --device %s' % 258 cmd = ('%s --device %s' %
257 (self._tests['steps'][test_name]['cmd'], 259 (self._tests['steps'][test_name]['cmd'],
258 self.device_serial)) 260 self.device_serial))
259 261
260 if self._options.collect_chartjson_data: 262 if self._options.collect_chartjson_data:
261 self._output_dir = tempfile.mkdtemp() 263 self._output_dir = tempfile.mkdtemp()
262 cmd = cmd + ' --output-dir=%s' % self._output_dir 264 cmd = cmd + ' --output-dir=%s' % self._output_dir
263 265
266 logging.info(
267 'temperature: %s (0.1 C)',
268 str(self._device_battery.GetBatteryInfo().get('temperature')))
264 logging.info('%s : %s', test_name, cmd) 269 logging.info('%s : %s', test_name, cmd)
265 start_time = datetime.datetime.now() 270 start_time = datetime.datetime.now()
266 271
267 timeout = self._tests['steps'][test_name].get('timeout', 5400) 272 timeout = self._tests['steps'][test_name].get('timeout', 5400)
268 if self._options.no_timeout: 273 if self._options.no_timeout:
269 timeout = None 274 timeout = None
270 logging.info('Timeout for %s test: %s', test_name, timeout) 275 logging.info('Timeout for %s test: %s', test_name, timeout)
271 full_cmd = cmd 276 full_cmd = cmd
272 if self._options.dry_run: 277 if self._options.dry_run:
273 full_cmd = 'echo %s' % cmd 278 full_cmd = 'echo %s' % cmd
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Returns: 348 Returns:
344 A tuple of (TestRunResults, retry). 349 A tuple of (TestRunResults, retry).
345 """ 350 """
346 _, result_type = self._LaunchPerfTest(test_name) 351 _, result_type = self._LaunchPerfTest(test_name)
347 results = base_test_result.TestRunResults() 352 results = base_test_result.TestRunResults()
348 results.AddResult(base_test_result.BaseTestResult(test_name, result_type)) 353 results.AddResult(base_test_result.BaseTestResult(test_name, result_type))
349 retry = None 354 retry = None
350 if not results.DidRunPass(): 355 if not results.DidRunPass():
351 retry = test_name 356 retry = test_name
352 return results, retry 357 return results, retry
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698