Chromium Code Reviews| Index: build/android/pylib/thermal_throttle.py |
| diff --git a/build/android/pylib/thermal_throttle.py b/build/android/pylib/thermal_throttle.py |
| index 385a48e7ef5f6a4c63e570e729e0247b5b83451b..29512d7d0c101b284a73a7e7dcaf5f561adb3ff2 100644 |
| --- a/build/android/pylib/thermal_throttle.py |
| +++ b/build/android/pylib/thermal_throttle.py |
| @@ -31,17 +31,32 @@ class ThermalThrottle(object): |
| return self._throttled |
| def _ReadLog(self): |
| + degree_sym = unichr(176) |
| has_been_throttled = False |
| + serial_number = self._adb.Adb().GetSerialNumber() |
| log = self._adb.RunShellCommand('dmesg -c') |
| for line in log: |
| if 'omap_thermal_throttle' in line: |
| if not self._throttled: |
| - logging.warning('>>> Thermally Throttled') |
| + logging.warning('>>> Device ' + serial_number + |
|
bulach
2012/12/10 17:45:05
nit: logging is like printf, takes a format and a
aberent
2012/12/11 13:11:20
Done.
|
| + ' Thermally Throttled') |
| self._throttled = True |
| has_been_throttled = True |
| if 'omap_thermal_unthrottle' in line: |
| if self._throttled: |
| - logging.warning('>>> Thermally Unthrottled') |
| + logging.warning('>>> Device ' + serial_number + |
| + ' Thermally Unthrottled') |
| self._throttled = False |
| has_been_throttled = True |
| + if 'throttle_delayed_work_fn' in line: |
| + temp = [s for s in line.split() if s.isdigit()][0] |
|
bulach
2012/12/10 17:45:05
if this is guaranteed to be on hundredths of degre
aberent
2012/12/11 13:11:20
Actually it is in thousandths of a degree, and the
|
| + logging.info(' Device ' + serial_number + ' Thermally Thottled at ' + |
| + temp[:-3] + '.' + temp[2] + degree_sym + 'C') |
| + if self._adb.FileExistsOnDevice( |
| + '/sys/devices/platform/omap/omap_temp_sensor.0/temperature'): |
|
bulach
2012/12/10 17:45:05
nit: probably best to make this a constant in 54,
aberent
2012/12/11 13:11:20
Done.
|
| + tempdata = self._adb.GetFileContents( |
| + '/sys/devices/platform/omap/omap_temp_sensor.0/temperature') |
| + temp = tempdata[0] |
|
bulach
2012/12/10 17:45:05
as above, maybe temp = int(tempdata[0][:-5]) / 100
aberent
2012/12/11 13:11:20
Done, with changes as above. I don't think the [:-
|
| + logging.info('Current OMAP Temperature of ' + serial_number + ' = ' + |
| + temp[:-3] + '.' + temp[2] + degree_sym + 'C') |
| return has_been_throttled |