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

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

Issue 1261763004: Remove handling code for android_command in pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove 2 more TODO comments Created 5 years, 4 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 | « build/android/pylib/perf/surface_stats_collector.py ('k') | build/android/pylib/screenshot.py » ('j') | 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 import logging 5 import logging
6 from pylib import android_commands
7 from pylib.device import device_utils 6 from pylib.device import device_utils
8 7
9 8
10 class OmapThrottlingDetector(object): 9 class OmapThrottlingDetector(object):
11 """Class to detect and track thermal throttling on an OMAP 4.""" 10 """Class to detect and track thermal throttling on an OMAP 4."""
12 OMAP_TEMP_FILE = ('/sys/devices/platform/omap/omap_temp_sensor.0/' 11 OMAP_TEMP_FILE = ('/sys/devices/platform/omap/omap_temp_sensor.0/'
13 'temperature') 12 'temperature')
14 13
15 @staticmethod 14 @staticmethod
16 def IsSupported(device): 15 def IsSupported(device):
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 class ThermalThrottle(object): 65 class ThermalThrottle(object):
67 """Class to detect and track thermal throttling. 66 """Class to detect and track thermal throttling.
68 67
69 Usage: 68 Usage:
70 Wait for IsThrottled() to be False before running test 69 Wait for IsThrottled() to be False before running test
71 After running test call HasBeenThrottled() to find out if the 70 After running test call HasBeenThrottled() to find out if the
72 test run was affected by thermal throttling. 71 test run was affected by thermal throttling.
73 """ 72 """
74 73
75 def __init__(self, device): 74 def __init__(self, device):
76 # TODO(jbudorick) Remove once telemetry gets switched over.
77 assert not isinstance(device, android_commands.AndroidCommands)
78 self._device = device 75 self._device = device
79 self._throttled = False 76 self._throttled = False
80 self._detector = None 77 self._detector = None
81 if OmapThrottlingDetector.IsSupported(device): 78 if OmapThrottlingDetector.IsSupported(device):
82 self._detector = OmapThrottlingDetector(device) 79 self._detector = OmapThrottlingDetector(device)
83 elif ExynosThrottlingDetector.IsSupported(device): 80 elif ExynosThrottlingDetector.IsSupported(device):
84 self._detector = ExynosThrottlingDetector(device) 81 self._detector = ExynosThrottlingDetector(device)
85 82
86 def HasBeenThrottled(self): 83 def HasBeenThrottled(self):
87 """True if there has been any throttling since the last call to 84 """True if there has been any throttling since the last call to
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 # Print temperature of battery, to give a system temperature 124 # Print temperature of battery, to give a system temperature
128 dumpsys_log = self._device.RunShellCommand('dumpsys battery') 125 dumpsys_log = self._device.RunShellCommand('dumpsys battery')
129 for line in dumpsys_log: 126 for line in dumpsys_log:
130 if 'temperature' in line: 127 if 'temperature' in line:
131 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 128 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0
132 logging.debug(u'Current battery temperature of %s = %3.1f%sC', 129 logging.debug(u'Current battery temperature of %s = %3.1f%sC',
133 serial_number, btemp, degree_symbol) 130 serial_number, btemp, degree_symbol)
134 131
135 return has_been_throttled 132 return has_been_throttled
136 133
OLDNEW
« no previous file with comments | « build/android/pylib/perf/surface_stats_collector.py ('k') | build/android/pylib/screenshot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698