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

Side by Side Diff: tools/skpbench/_hardware_nexus_6p.py

Issue 2481413003: skpbench: simplify adb and reduce number of invocations (Closed)
Patch Set: skpbench: simplify adb and reduce number of invocations Created 4 years, 1 month 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 | « tools/skpbench/_hardware_android.py ('k') | tools/skpbench/_hardware_pixel_c.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 Google Inc. 1 # Copyright 2016 Google Inc.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from _hardware import HardwareException, Expectation 6 from _hardware import HardwareException, Expectation
7 from _hardware_android import HardwareAndroid 7 from _hardware_android import HardwareAndroid
8 8
9 CPU_CLOCK_RATE = 1728000 9 CPU_CLOCK_RATE = 1728000
10 GPU_CLOCK_RATE = 510000000 10 GPU_CLOCK_RATE = 510000000
11 11
12 class HardwareNexus6P(HardwareAndroid): 12 class HardwareNexus6P(HardwareAndroid):
13 def __init__(self, adb): 13 def __init__(self, adb):
14 HardwareAndroid.__init__(self, adb) 14 HardwareAndroid.__init__(self, adb)
15 15
16 def __enter__(self): 16 def __enter__(self):
17 self._lock_clocks() 17 self._lock_clocks()
18 return HardwareAndroid.__enter__(self) 18 return HardwareAndroid.__enter__(self)
19 19
20 def __exit__(self, exception_type, exception_value, exception_traceback): 20 def __exit__(self, exception_type, exception_value, exception_traceback):
21 HardwareAndroid.__exit__(self, exception_type, 21 HardwareAndroid.__exit__(self, exception_type,
22 exception_value, exception_traceback) 22 exception_value, exception_traceback)
23 self._unlock_clocks() 23 self._unlock_clocks()
24 24
25 def _lock_clocks(self): 25 def _lock_clocks(self):
26 if not self._is_root: 26 if not self._adb.is_root():
27 return 27 return
28 28
29 self._adb.shell('''\ 29 self._adb.shell('''\
30 stop thermal-engine 30 stop thermal-engine
31 stop thermald 31 stop thermald
32 stop perfd 32 stop perfd
33 stop mpdecision''') 33 stop mpdecision''')
34 34
35 # enable and lock 3 of 4 big cores. 35 # enable and lock 3 of 4 big cores.
36 self._adb.shell('''\ 36 self._adb.shell('''\
(...skipping 29 matching lines...) Expand all
66 # https://developer.qualcomm.com/qfile/28823/lm80-p0436-11_adb_commands.pdf 66 # https://developer.qualcomm.com/qfile/28823/lm80-p0436-11_adb_commands.pdf
67 self._adb.shell('''\ 67 self._adb.shell('''\
68 echo performance > /sys/class/devfreq/qcom,cpubw.32/governor 68 echo performance > /sys/class/devfreq/qcom,cpubw.32/governor
69 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq 69 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq
70 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/min_freq 70 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/min_freq
71 echo performance > /sys/class/devfreq/qcom,gpubw.70/governor 71 echo performance > /sys/class/devfreq/qcom,gpubw.70/governor
72 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq 72 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq
73 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/min_freq''') 73 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/min_freq''')
74 74
75 def _unlock_clocks(self): 75 def _unlock_clocks(self):
76 if not self._is_root: 76 if not self._adb.is_root():
77 return 77 return
78 78
79 # restore ddr settings to default. 79 # restore ddr settings to default.
80 self._adb.shell('''\ 80 self._adb.shell('''\
81 echo 1525 > /sys/class/devfreq/qcom,cpubw.32/min_freq 81 echo 1525 > /sys/class/devfreq/qcom,cpubw.32/min_freq
82 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq 82 echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq
83 echo bw_hwmon > /sys/class/devfreq/qcom,cpubw.32/governor 83 echo bw_hwmon > /sys/class/devfreq/qcom,cpubw.32/governor
84 echo 1525 > /sys/class/devfreq/qcom,gpubw.70/min_freq 84 echo 1525 > /sys/class/devfreq/qcom,gpubw.70/min_freq
85 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq 85 echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq
86 echo bw_hwmon > /sys/class/devfreq/qcom,gpubw.70/governor''') 86 echo bw_hwmon > /sys/class/devfreq/qcom,gpubw.70/governor''')
(...skipping 27 matching lines...) Expand all
114 114
115 self._adb.shell('''\ 115 self._adb.shell('''\
116 start mpdecision 116 start mpdecision
117 start perfd 117 start perfd
118 start thermald 118 start thermald
119 start thermal-engine''') 119 start thermal-engine''')
120 120
121 def sanity_check(self): 121 def sanity_check(self):
122 HardwareAndroid.sanity_check(self) 122 HardwareAndroid.sanity_check(self)
123 123
124 if not self._is_root: 124 if not self._adb.is_root():
125 return 125 return
126 126
127 result = self._adb.check_lines('''\ 127 result = self._adb.check('''\
128 cat /sys/class/power_supply/battery/capacity \ 128 cat /sys/class/power_supply/battery/capacity \
129 /sys/devices/system/cpu/online \ 129 /sys/devices/system/cpu/online \
130 /sys/class/thermal/thermal_zone14/temp \ 130 /sys/class/thermal/thermal_zone14/temp \
131 /sys/class/thermal/thermal_zone15/temp \ 131 /sys/class/thermal/thermal_zone15/temp \
132 /sys/kernel/debug/clk/oxili_gfx3d_clk/measure \ 132 /sys/kernel/debug/clk/oxili_gfx3d_clk/measure \
133 /sys/kernel/debug/clk/bimc_clk/measure 133 /sys/kernel/debug/clk/bimc_clk/measure
134 for N in 4 5 6; do 134 for N in 4 5 6; do
135 cat /sys/devices/system/cpu/cpu$N/cpufreq/scaling_cur_freq 135 cat /sys/devices/system/cpu/cpu$N/cpufreq/scaling_cur_freq
136 done''') 136 done''')
137 137
138 expectations = \ 138 expectations = \
139 [Expectation(int, min_value=30, name='battery', sleeptime=30*60), 139 [Expectation(int, min_value=30, name='battery', sleeptime=30*60),
140 Expectation(str, exact_value='4-6', name='online cpus'), 140 Expectation(str, exact_value='4-6', name='online cpus'),
141 Expectation(int, max_value=88, name='tsens_tz_sensor13'), 141 Expectation(int, max_value=88, name='tsens_tz_sensor13'),
142 Expectation(int, max_value=88, name='tsens_tz_sensor14'), 142 Expectation(int, max_value=88, name='tsens_tz_sensor14'),
143 Expectation(long, min_value=(GPU_CLOCK_RATE - 5000), 143 Expectation(long, min_value=(GPU_CLOCK_RATE - 5000),
144 max_value=(GPU_CLOCK_RATE + 5000), name='gpu clock rate'), 144 max_value=(GPU_CLOCK_RATE + 5000), name='gpu clock rate'),
145 Expectation(long, min_value=647995000, max_value=648007500, 145 Expectation(long, min_value=647995000, max_value=648007500,
146 name='ddr clock rate', sleeptime=10)] + \ 146 name='ddr clock rate', sleeptime=10)] + \
147 [Expectation(int, exact_value=CPU_CLOCK_RATE, name='cpu_%i clock rate' %i) 147 [Expectation(int, exact_value=CPU_CLOCK_RATE, name='cpu_%i clock rate' %i)
148 for i in range(4, 7)] 148 for i in range(4, 7)]
149 149
150 Expectation.check_all(expectations, result) 150 Expectation.check_all(expectations, result.splitlines())
151 151
152 def sleep(self, sleeptime): 152 def sleep(self, sleeptime):
153 self._unlock_clocks() 153 self._unlock_clocks()
154 HardwareAndroid.sleep(self, sleeptime) 154 HardwareAndroid.sleep(self, sleeptime)
155 self._lock_clocks() 155 self._lock_clocks()
OLDNEW
« no previous file with comments | « tools/skpbench/_hardware_android.py ('k') | tools/skpbench/_hardware_pixel_c.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698