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

Unified Diff: build/android/pylib/perf_tests_helper.py

Issue 11352004: Add a class for management of thermal throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/perf_tests_helper.py
diff --git a/build/android/pylib/perf_tests_helper.py b/build/android/pylib/perf_tests_helper.py
index c0a3ee413d80d5ed924538d1ddab86b377ea4016..3986b089ff09352fb8b1f9feefdbe94b634bbf25 100644
--- a/build/android/pylib/perf_tests_helper.py
+++ b/build/android/pylib/perf_tests_helper.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import re
+import logging
import android_commands
import math
@@ -118,3 +119,48 @@ class PerfTestSetup(object):
for cpu in range(self._num_cpus):
self._adb.RunShellCommand(
('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu))
+
+
+class ThermalThrottle(object):
bulach 2012/10/31 10:44:47 it'd make sense to have this class in its own file
Anthony Berent 2012/10/31 15:14:02 Done.
+ """Class to detect and track thermal throttling
+
+ Usage:
+ Wait for IsThrottled() to be False before running test
+ After running test call HasBeenThrottled() to find out if the
+ test run was affected by thermal throttling.
+
+ Currently assumes an OMap device, but I don't know of any others with
bulach 2012/10/31 10:44:47 nit: people told me in the past to avoid using fir
Anthony Berent 2012/10/31 15:14:02 Done.
+ thermal throttling.
+ """
+ _throttled = False
bulach 2012/10/31 10:44:47 nit: this should be a regular member in __init__ (
Anthony Berent 2012/10/31 15:14:02 Done.
+
+ def __init__(self, adb):
+ self._adb = adb
+
+ def HasBeenThrottled(self):
+ """ True if there has been any throttling since the last call to
+ HasBeenThrottled or IsThrottled
+ """
+ return self._readLog()
+
+ def IsThrottled(self):
+ """True if currently throttled"""
+ self._readLog()
+ return self._throttled
+
+ def _readLog(self):
bulach 2012/10/31 10:44:47 nit: _ReadLog
Anthony Berent 2012/10/31 15:14:02 Done.
+ has_been_throttled = False
+ log = self._adb.RunShellCommand("dmesg -c")
bulach 2012/10/31 10:44:47 nit: single quotes on all strings here.
Anthony Berent 2012/10/31 15:14:02 Done.
+ for line in log:
+ if "omap_thermal_throttle" in line:
+ if not self._throttled:
+ logging.warning(">>> Thermally Throttled")
+ self._throttled = True
+ has_been_throttled = True
+ if "omap_thermal_unthrottle" in line:
+ if self._throttled:
+ logging.warning(">>> Thermally Unthrottled")
+ self._throttled = False
+ has_been_throttled = True
+ return has_been_throttled
+
« 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