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

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

Issue 775333002: Migrate DeviceUtils.ReadFile to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix breakages in telemetry unittests Created 6 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698