OLD | NEW |
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 | 6 |
7 from devil.android import device_utils | |
8 | |
9 | 7 |
10 class OmapThrottlingDetector(object): | 8 class OmapThrottlingDetector(object): |
11 """Class to detect and track thermal throttling on an OMAP 4.""" | 9 """Class to detect and track thermal throttling on an OMAP 4.""" |
12 OMAP_TEMP_FILE = ('/sys/devices/platform/omap/omap_temp_sensor.0/' | 10 OMAP_TEMP_FILE = ('/sys/devices/platform/omap/omap_temp_sensor.0/' |
13 'temperature') | 11 'temperature') |
14 | 12 |
15 @staticmethod | 13 @staticmethod |
16 def IsSupported(device): | 14 def IsSupported(device): |
17 return device.FileExists(OmapThrottlingDetector.OMAP_TEMP_FILE) | 15 return device.FileExists(OmapThrottlingDetector.OMAP_TEMP_FILE) |
18 | 16 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 # Print temperature of battery, to give a system temperature | 123 # Print temperature of battery, to give a system temperature |
126 dumpsys_log = self._device.RunShellCommand('dumpsys battery') | 124 dumpsys_log = self._device.RunShellCommand('dumpsys battery') |
127 for line in dumpsys_log: | 125 for line in dumpsys_log: |
128 if 'temperature' in line: | 126 if 'temperature' in line: |
129 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 | 127 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 |
130 logging.debug(u'Current battery temperature of %s = %3.1f%sC', | 128 logging.debug(u'Current battery temperature of %s = %3.1f%sC', |
131 serial_number, btemp, degree_symbol) | 129 serial_number, btemp, degree_symbol) |
132 | 130 |
133 return has_been_throttled | 131 return has_been_throttled |
134 | 132 |
OLD | NEW |