OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 class ThermalThrottle(object): | 7 class ThermalThrottle(object): |
8 """Class to detect and track thermal throttling | 8 """Class to detect and track thermal throttling |
9 | 9 |
10 Usage: | 10 Usage: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if 'omap_thermal_unthrottle' in line: | 44 if 'omap_thermal_unthrottle' in line: |
45 if self._throttled: | 45 if self._throttled: |
46 logging.warning('>>> Device %s Thermally Unthrottled', serial_number) | 46 logging.warning('>>> Device %s Thermally Unthrottled', serial_number) |
47 self._throttled = False | 47 self._throttled = False |
48 has_been_throttled = True | 48 has_been_throttled = True |
49 if 'throttle_delayed_work_fn' in line: | 49 if 'throttle_delayed_work_fn' in line: |
50 temp = float([s for s in line.split() if s.isdigit()][0]) / 1000.0 | 50 temp = float([s for s in line.split() if s.isdigit()][0]) / 1000.0 |
51 logging.info(u' Device %s Thermally Thottled at %3.1f%sC', | 51 logging.info(u' Device %s Thermally Thottled at %3.1f%sC', |
52 serial_number, temp, degree_symbol) | 52 serial_number, temp, degree_symbol) |
53 | 53 |
54 # Print temperature of CPU SoC. | 54 if logging.getLogger().isEnabledFor(logging.DEBUG): |
55 omap_temp_file = '/sys/devices/platform/omap/omap_temp_sensor.0/temperature' | 55 # Print temperature of CPU SoC. |
56 if self._adb.FileExistsOnDevice(omap_temp_file): | 56 omap_temp_file = ('/sys/devices/platform/omap/omap_temp_sensor.0/' |
57 tempdata = self._adb.GetFileContents(omap_temp_file) | 57 'temperature') |
58 temp = float(tempdata[0]) / 1000.0 | 58 if self._adb.FileExistsOnDevice(omap_temp_file): |
59 logging.info(u'Current OMAP Temperature of %s = %3.1f%sC', | 59 tempdata = self._adb.GetFileContents(omap_temp_file) |
60 serial_number, temp, degree_symbol) | 60 temp = float(tempdata[0]) / 1000.0 |
| 61 logging.debug(u'Current OMAP Temperature of %s = %3.1f%sC', |
| 62 serial_number, temp, degree_symbol) |
61 | 63 |
62 # Print temperature of battery, to give a system temperature | 64 # Print temperature of battery, to give a system temperature |
63 dumpsys_log = self._adb.RunShellCommand('dumpsys battery') | 65 dumpsys_log = self._adb.RunShellCommand('dumpsys battery') |
64 for line in dumpsys_log: | 66 for line in dumpsys_log: |
65 if 'temperature' in line: | 67 if 'temperature' in line: |
66 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 | 68 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 |
67 logging.info(u'Current battery temperature of %s = %3.1f%sC', | 69 logging.debug(u'Current battery temperature of %s = %3.1f%sC', |
68 serial_number, btemp, degree_symbol) | 70 serial_number, btemp, degree_symbol) |
69 | 71 |
70 return has_been_throttled | 72 return has_been_throttled |
OLD | NEW |