| 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 from pylib import android_commands | 6 from pylib import android_commands |
| 7 from pylib.device import device_utils | 7 from pylib.device import device_utils |
| 8 | 8 |
| 9 | 9 |
| 10 class OmapThrottlingDetector(object): | 10 class OmapThrottlingDetector(object): |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 def BecameUnthrottled(log_line): | 27 def BecameUnthrottled(log_line): |
| 28 return 'omap_thermal_unthrottle' in log_line | 28 return 'omap_thermal_unthrottle' in log_line |
| 29 | 29 |
| 30 @staticmethod | 30 @staticmethod |
| 31 def GetThrottlingTemperature(log_line): | 31 def GetThrottlingTemperature(log_line): |
| 32 if 'throttle_delayed_work_fn' in log_line: | 32 if 'throttle_delayed_work_fn' in log_line: |
| 33 return float([s for s in log_line.split() if s.isdigit()][0]) / 1000.0 | 33 return float([s for s in log_line.split() if s.isdigit()][0]) / 1000.0 |
| 34 | 34 |
| 35 def GetCurrentTemperature(self): | 35 def GetCurrentTemperature(self): |
| 36 tempdata = self._device.ReadFile(OmapThrottlingDetector.OMAP_TEMP_FILE) | 36 tempdata = self._device.ReadFile(OmapThrottlingDetector.OMAP_TEMP_FILE) |
| 37 return float(tempdata[0]) / 1000.0 | 37 return float(tempdata) / 1000.0 |
| 38 | 38 |
| 39 | 39 |
| 40 class ExynosThrottlingDetector(object): | 40 class ExynosThrottlingDetector(object): |
| 41 """Class to detect and track thermal throttling on an Exynos 5.""" | 41 """Class to detect and track thermal throttling on an Exynos 5.""" |
| 42 @staticmethod | 42 @staticmethod |
| 43 def IsSupported(device): | 43 def IsSupported(device): |
| 44 return device.FileExists('/sys/bus/exynos5-core') | 44 return device.FileExists('/sys/bus/exynos5-core') |
| 45 | 45 |
| 46 def __init__(self, device): | 46 def __init__(self, device): |
| 47 pass | 47 pass |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 # Print temperature of battery, to give a system temperature | 128 # Print temperature of battery, to give a system temperature |
| 129 dumpsys_log = self._device.RunShellCommand('dumpsys battery') | 129 dumpsys_log = self._device.RunShellCommand('dumpsys battery') |
| 130 for line in dumpsys_log: | 130 for line in dumpsys_log: |
| 131 if 'temperature' in line: | 131 if 'temperature' in line: |
| 132 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 | 132 btemp = float([s for s in line.split() if s.isdigit()][0]) / 10.0 |
| 133 logging.debug(u'Current battery temperature of %s = %3.1f%sC', | 133 logging.debug(u'Current battery temperature of %s = %3.1f%sC', |
| 134 serial_number, btemp, degree_symbol) | 134 serial_number, btemp, degree_symbol) |
| 135 | 135 |
| 136 return has_been_throttled | 136 return has_been_throttled |
| 137 | 137 |
| OLD | NEW |