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

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

Issue 11428107: Telemetry: extends Platform abstraction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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_backend.py
diff --git a/tools/telemetry/telemetry/android_platform_backend.py b/tools/telemetry/telemetry/android_platform_backend.py
new file mode 100644
index 0000000000000000000000000000000000000000..212ed4483ea3e8039d0fa3e9c9f4b17d36e7025d
--- /dev/null
+++ b/tools/telemetry/telemetry/android_platform_backend.py
@@ -0,0 +1,57 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
tonyg 2013/02/21 18:07:08 You can update to 2013 now. Boo for long reviews.
bulach 2013/02/22 11:54:25 ++year! :)
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+# 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
tonyg 2013/02/21 18:07:08 2 spaces between code and comments
bulach 2013/02/22 11:54:25 Done.
+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 AndroidPlatformBackend(object):
+ def __init__(self, adb, window_package, window_activity):
+ super(AndroidPlatformBackend, 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 = thermal_throttle.ThermalThrottle(self._adb)
tonyg 2013/02/21 18:07:08 This uses adb as one arg and self._adb as the othe
bulach 2013/02/22 11:54:25 Done.
+
+ def IsRawDisplayFrameRateSupported(self):
+ return True
+
+ def StartRawDisplayFrameRateMeasurement(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 StopRawDisplayFrameRateMeasurement(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 IsThermallyThrottled(self):
aberent 2013/01/29 14:03:36 This asks whether the device is currently thermall
bulach 2013/02/22 11:54:25 good point! added a "HasBeenThrottled" and changed
+ return self._thermal_throttle.IsThrottled()

Powered by Google App Engine
This is Rietveld 408576698