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

Unified Diff: tools/skpbench/_hardware_pixel_c.py

Issue 2369533002: Add Pixel C knobs to skpbench (Closed)
Patch Set: Created 4 years, 3 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 | « tools/skpbench/_hardware.py ('k') | tools/skpbench/parseskpbench.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpbench/_hardware_pixel_c.py
diff --git a/tools/skpbench/_hardware_pixel_c.py b/tools/skpbench/_hardware_pixel_c.py
new file mode 100644
index 0000000000000000000000000000000000000000..3ea74c1c03ea651c7c5ab9b2e026141fba38ac49
--- /dev/null
+++ b/tools/skpbench/_hardware_pixel_c.py
@@ -0,0 +1,94 @@
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from _hardware import HardwareException, Expectation
+from _hardware_android import HardwareAndroid
+
+CPU_CLOCK_RATE = 1836000
+GPU_EMC_PROFILE = '0c: core 921 MHz emc 1600 MHz a A d D *'
+GPU_EMC_PROFILE_ID = '0c'
+
+class HardwarePixelC(HardwareAndroid):
+ def __init__(self, adb):
+ HardwareAndroid.__init__(self, adb)
+
+ def __enter__(self):
+ self._lock_clocks()
+ return HardwareAndroid.__enter__(self)
+
+ def __exit__(self, exception_type, exception_value, exception_traceback):
+ HardwareAndroid.__exit__(self, exception_type,
+ exception_value, exception_traceback)
+ self._unlock_clocks()
+
+ def _lock_clocks(self):
+ if not self._is_root:
+ return
+
+ # lock cpu clocks.
+ self._adb.shell('''\
+ for N in $(seq 0 3); do
+ echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
+ echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
+ done''' % CPU_CLOCK_RATE)
+
+ # lock gpu/emc clocks.
+ self._adb.shell('''\
+ chown root:root /sys/devices/57000000.gpu/pstate
+ echo %s > /sys/devices/57000000.gpu/pstate''' % GPU_EMC_PROFILE_ID)
+
+ def _unlock_clocks(self):
+ if not self._is_root:
+ return
+
+ # unlock gpu/emc clocks.
+ self._adb.shell('''\
+ echo auto > /sys/devices/57000000.gpu/pstate
+ chown system:system /sys/devices/57000000.gpu/pstate''')
+
+ # unlock cpu clocks.
+ self._adb.shell('''\
+ for N in $(seq 0 3); do
+ echo 0 > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
+ echo interactive > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
+ done''')
+
+ def sanity_check(self):
+ HardwareAndroid.sanity_check(self)
+
+ if not self._is_root:
+ return
+
+ # only issue one shell command in an attempt to minimize interference.
+ result = self._adb.check_lines('''\
+ cat /sys/class/power_supply/bq27742-0/capacity \
+ /sys/class/thermal/thermal_zone7/temp \
+ /sys/class/thermal/thermal_zone0/temp \
+ /sys/class/thermal/thermal_zone1/temp \
+ /sys/class/thermal/thermal_zone7/cdev1/cur_state \
+ /sys/class/thermal/thermal_zone7/cdev0/cur_state
+ for N in $(seq 0 3); do
+ cat /sys/devices/system/cpu/cpu$N/cpufreq/scaling_cur_freq
+ done
+ cat /sys/devices/57000000.gpu/pstate | grep \*$''')
+
+ expectations = \
+ [Expectation(int, min_value=30, name='battery', sleeptime=30*60),
+ Expectation(int, max_value=40000, name='skin temperature'),
+ Expectation(int, max_value=86000, name='cpu temperature'),
+ Expectation(int, max_value=87000, name='gpu temperature'),
+ Expectation(int, exact_value=0, name='cpu throttle'),
+ Expectation(int, exact_value=0, name='gpu throttle')] + \
+ [Expectation(int, exact_value=CPU_CLOCK_RATE,
+ name='cpu_%i clock rate' % i, sleeptime=30)
+ for i in range(4)] + \
+ [Expectation(str, exact_value=GPU_EMC_PROFILE, name='gpu/emc profile')]
+
+ Expectation.check_all(expectations, result)
+
+ def sleep(self, sleeptime):
+ self._unlock_clocks()
+ HardwareAndroid.sleep(self, sleeptime)
+ self._lock_clocks()
« no previous file with comments | « tools/skpbench/_hardware.py ('k') | tools/skpbench/parseskpbench.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698