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

Unified Diff: tools/telemetry/telemetry/android_platform.py

Issue 11428107: Telemetry: extends Platform abstraction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Platform API Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/android_platform.py
diff --git a/tools/telemetry/telemetry/android_platform.py b/tools/telemetry/telemetry/android_platform.py
index 6e544d72b1c3d0a4bc124cbf5ecbc0cbac40b8fe..833769af59f2f422293ec0146b0b97ad7e08de79 100644
--- a/tools/telemetry/telemetry/android_platform.py
+++ b/tools/telemetry/telemetry/android_platform.py
@@ -2,27 +2,70 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
import os
import sys
+from telemetry import platform
+
# Get build/android scripts into our path.
sys.path.append(
os.path.abspath(
os.path.join(os.path.dirname(__file__),
'../../../build/android')))
+
+from pylib import perf_tests_helper # pylint: disable=F0401
+from pylib import thermal_throttle # pylint: disable=F0401
+
try:
from pylib import surface_stats_collector # pylint: disable=F0401
except Exception:
surface_stats_collector = None
-class AndroidPlatform(object):
+class AndroidPlatform(platform.Platform):
def __init__(self, adb, window_package, window_activity):
super(AndroidPlatform, self).__init__()
self._adb = adb
self._window_package = window_package
self._window_activity = window_activity
+ self._surface_stats_collector = None
+ self._perf_tests_setup = perf_tests_helper.PerfTestSetup(adb)
+ self._thermal_throttle = None
+
+ def IsRawDisplayFrameRateSupported(self):
+ return True
+
+ def StartRawDisplayFrameRate(self, trace_tag):
+ assert not self._surface_stats_collector
+ self._surface_stats_collector = \
+ surface_stats_collector.SurfaceStatsCollector(
+ self._adb, self._window_package, self._window_activity, trace_tag)
+ self._surface_stats_collector.__enter__()
+
+ def GetRawDisplayFrameRate(self):
+ self._surface_stats_collector.__exit__()
+ self._surface_stats_collector = None
+
+ def SetFullPerformanceModeEnabled(self, enabled):
+ if enabled:
+ self._perf_tests_setup.SetUp()
+ else:
+ self._perf_tests_setup.TearDown()
+
+ def CanMonitorThermalThrottling(self):
+ return True
+
+ def StartMonitoringThermalThrottling(self):
+ assert not self._thermal_throttle
+ self._thermal_throttle = thermal_throttle.ThermalThrottle(self._adb)
+ if self._thermal_throttle.IsThrottled():
+ logging.warn('Device is being thermally throttled.')
- def GetSurfaceCollector(self, trace_tag):
- return surface_stats_collector.SurfaceStatsCollector(
- self._adb, self._window_package, self._window_activity, trace_tag)
+ def StopMonitoringThermalThrottling(self):
+ has_been_throttled = self._thermal_throttle.HasBeenThrottled()
+ self._thermal_throttle = None
+ if has_been_throttled:
+ logging.warn('Device was thermally throttled during tests.')
+ return True
+ return False

Powered by Google App Engine
This is Rietveld 408576698