Index: tools/telemetry/telemetry/page/page_runner.py |
diff --git a/tools/telemetry/telemetry/page/page_runner.py b/tools/telemetry/telemetry/page/page_runner.py |
index 5141fdb90682f435efa212b401dc711fd72e87f0..466bb26a58794933d0c36b2be969c05162851601 100644 |
--- a/tools/telemetry/telemetry/page/page_runner.py |
+++ b/tools/telemetry/telemetry/page/page_runner.py |
@@ -142,6 +142,8 @@ class PageRunner(object): |
if options.trace_dir: |
self._SetupTracingTab(state) |
+ self._WaitForThermalThrottlingIfNeeded(state.browser.platform) |
+ |
try: |
self._RunPage(options, page, state.tab, test, results) |
except exceptions.TabCrashException: |
@@ -155,6 +157,8 @@ class PageRunner(object): |
logging.warning('Tab crashed: %s%s', page.url, stdout) |
state.Close() |
+ self._CheckThermalThrottling(state.browser.platform) |
+ |
if options.trace_dir: |
self._EndTracing(state, options, page) |
@@ -314,6 +318,28 @@ class PageRunner(object): |
except Exception: |
pass |
+ def _WaitForThermalThrottlingIfNeeded(self, platform): |
+ if not platform.CanMonitorThermalThrottling(): |
+ return |
+ thermal_throttling_retry = 0 |
+ while (platform.IsThermallyThrottled() and |
+ thermal_throttling_retry < 3): |
+ logging.warning('Thermally throttled, waiting (%d)...', |
+ thermal_throttling_retry) |
+ thermal_throttling_retry += 1 |
+ time.sleep(thermal_throttling_retry * 2) |
+ |
+ if platform.IsThermallyThrottled(): |
+ logging.error('Device is thermally throttled before running ' |
+ 'performance tests, results will vary.') |
+ |
+ def _CheckThermalThrottling(self, platform): |
+ if not platform.CanMonitorThermalThrottling(): |
+ return |
+ if platform.HasBeenThermallyThrottled(): |
+ logging.error('Device has been thermally throttled during ' |
+ 'performance tests, results will vary.') |
+ |
@staticmethod |
def AddCommandLineOptions(parser): |
page_filter_module.PageFilter.AddCommandLineOptions(parser) |