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

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

Issue 11499010: Print OMAP temperature data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 HasBeenThrottled or IsThrottled 24 HasBeenThrottled or IsThrottled
25 """ 25 """
26 return self._ReadLog() 26 return self._ReadLog()
27 27
28 def IsThrottled(self): 28 def IsThrottled(self):
29 """True if currently throttled""" 29 """True if currently throttled"""
30 self._ReadLog() 30 self._ReadLog()
31 return self._throttled 31 return self._throttled
32 32
33 def _ReadLog(self): 33 def _ReadLog(self):
34 degree_sym = unichr(176)
34 has_been_throttled = False 35 has_been_throttled = False
36 serial_number = self._adb.Adb().GetSerialNumber()
35 log = self._adb.RunShellCommand('dmesg -c') 37 log = self._adb.RunShellCommand('dmesg -c')
36 for line in log: 38 for line in log:
37 if 'omap_thermal_throttle' in line: 39 if 'omap_thermal_throttle' in line:
38 if not self._throttled: 40 if not self._throttled:
39 logging.warning('>>> Thermally Throttled') 41 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.
42 ' Thermally Throttled')
40 self._throttled = True 43 self._throttled = True
41 has_been_throttled = True 44 has_been_throttled = True
42 if 'omap_thermal_unthrottle' in line: 45 if 'omap_thermal_unthrottle' in line:
43 if self._throttled: 46 if self._throttled:
44 logging.warning('>>> Thermally Unthrottled') 47 logging.warning('>>> Device ' + serial_number +
48 ' Thermally Unthrottled')
45 self._throttled = False 49 self._throttled = False
46 has_been_throttled = True 50 has_been_throttled = True
51 if 'throttle_delayed_work_fn' in line:
52 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
53 logging.info(' Device ' + serial_number + ' Thermally Thottled at ' +
54 temp[:-3] + '.' + temp[2] + degree_sym + 'C')
55 if self._adb.FileExistsOnDevice(
56 '/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.
57 tempdata = self._adb.GetFileContents(
58 '/sys/devices/platform/omap/omap_temp_sensor.0/temperature')
59 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 [:-
60 logging.info('Current OMAP Temperature of ' + serial_number + ' = ' +
61 temp[:-3] + '.' + temp[2] + degree_sym + 'C')
47 return has_been_throttled 62 return has_been_throttled
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698