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

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: OMAP temperature data - code review responses 2 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 14 matching lines...) Expand all
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 has_been_throttled = False 34 has_been_throttled = False
35 serial_number = self._adb.Adb().GetSerialNumber()
35 log = self._adb.RunShellCommand('dmesg -c') 36 log = self._adb.RunShellCommand('dmesg -c')
37 degree_symbol = unichr(0x00B0)
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 %s Thermally Throttled', serial_number)
40 self._throttled = True 42 self._throttled = True
41 has_been_throttled = True 43 has_been_throttled = True
42 if 'omap_thermal_unthrottle' in line: 44 if 'omap_thermal_unthrottle' in line:
43 if self._throttled: 45 if self._throttled:
44 logging.warning('>>> Thermally Unthrottled') 46 logging.warning('>>> Device %s Thermally Unthrottled', serial_number)
45 self._throttled = False 47 self._throttled = False
46 has_been_throttled = True 48 has_been_throttled = True
49 if 'throttle_delayed_work_fn' in line:
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',
52 serial_number, temp, degree_symbol)
53
54 # Print temperature of CPU SoC.
55 omap_temp_file = '/sys/devices/platform/omap/omap_temp_sensor.0/temperature'
56 if self._adb.FileExistsOnDevice(omap_temp_file):
57 tempdata = self._adb.GetFileContents(omap_temp_file)
58 temp = float(tempdata[0]) / 1000.0
59 logging.info(u'Current OMAP Temperature of %s = %3.1f%sC',
60 serial_number, temp, degree_symbol)
61
62 # Print temperature of battery, to give a system temperature
63 dumpsys_log = self._adb.RunShellCommand('dumpsys battery')
64 for line in dumpsys_log:
65 if 'temperature' in line:
66 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',
68 serial_number, btemp, degree_symbol)
69
47 return has_been_throttled 70 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