OLD | NEW |
---|---|
(Empty) | |
1 # 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! :)
| |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import sys | |
7 | |
8 # Get build/android scripts into our path. | |
9 sys.path.append( | |
10 os.path.abspath( | |
11 os.path.join(os.path.dirname(__file__), | |
12 '../../../build/android'))) | |
13 | |
14 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.
| |
15 from pylib import thermal_throttle # pylint: disable=F0401 | |
16 | |
17 try: | |
18 from pylib import surface_stats_collector # pylint: disable=F0401 | |
19 except Exception: | |
20 surface_stats_collector = None | |
21 | |
22 | |
23 class AndroidPlatformBackend(object): | |
24 def __init__(self, adb, window_package, window_activity): | |
25 super(AndroidPlatformBackend, self).__init__() | |
26 self._adb = adb | |
27 self._window_package = window_package | |
28 self._window_activity = window_activity | |
29 self._surface_stats_collector = None | |
30 self._perf_tests_setup = perf_tests_helper.PerfTestSetup(adb) | |
31 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.
| |
32 | |
33 def IsRawDisplayFrameRateSupported(self): | |
34 return True | |
35 | |
36 def StartRawDisplayFrameRateMeasurement(self, trace_tag): | |
37 assert not self._surface_stats_collector | |
38 self._surface_stats_collector = \ | |
39 surface_stats_collector.SurfaceStatsCollector( | |
40 self._adb, self._window_package, self._window_activity, trace_tag) | |
41 self._surface_stats_collector.__enter__() | |
42 | |
43 def StopRawDisplayFrameRateMeasurement(self): | |
44 self._surface_stats_collector.__exit__() | |
45 self._surface_stats_collector = None | |
46 | |
47 def SetFullPerformanceModeEnabled(self, enabled): | |
48 if enabled: | |
49 self._perf_tests_setup.SetUp() | |
50 else: | |
51 self._perf_tests_setup.TearDown() | |
52 | |
53 def CanMonitorThermalThrottling(self): | |
54 return True | |
55 | |
56 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
| |
57 return self._thermal_throttle.IsThrottled() | |
OLD | NEW |