OLD | NEW |
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 = 1836000 | 9 CPU_CLOCK_RATE = 1836000 |
10 GPU_EMC_PROFILE = '0c: core 921 MHz emc 1600 MHz a A d D *' | 10 GPU_EMC_PROFILE = '0c: core 921 MHz emc 1600 MHz a A d D *' |
11 GPU_EMC_PROFILE_ID = '0c' | 11 GPU_EMC_PROFILE_ID = '0c' |
12 | 12 |
13 class HardwarePixelC(HardwareAndroid): | 13 class HardwarePixelC(HardwareAndroid): |
14 def __init__(self, adb): | 14 def __init__(self, adb): |
15 HardwareAndroid.__init__(self, adb) | 15 HardwareAndroid.__init__(self, adb) |
16 | 16 |
17 def __enter__(self): | 17 def __enter__(self): |
18 self._lock_clocks() | 18 self._lock_clocks() |
19 return HardwareAndroid.__enter__(self) | 19 return HardwareAndroid.__enter__(self) |
20 | 20 |
21 def __exit__(self, exception_type, exception_value, exception_traceback): | 21 def __exit__(self, exception_type, exception_value, exception_traceback): |
22 HardwareAndroid.__exit__(self, exception_type, | 22 HardwareAndroid.__exit__(self, exception_type, |
23 exception_value, exception_traceback) | 23 exception_value, exception_traceback) |
24 self._unlock_clocks() | 24 self._unlock_clocks() |
25 | 25 |
| 26 def filter_line(self, line): |
| 27 JUNK = ['NvRmPrivGetChipPlatform: Could not read platform information', |
| 28 'Expected on kernels without fuse support, using silicon'] |
| 29 return False if line in JUNK else HardwareAndroid.filter_line(self, line) |
| 30 |
26 def _lock_clocks(self): | 31 def _lock_clocks(self): |
27 if not self._is_root: | 32 if not self._is_root: |
28 return | 33 return |
29 | 34 |
30 # lock cpu clocks. | 35 # lock cpu clocks. |
31 self._adb.shell('''\ | 36 self._adb.shell('''\ |
32 for N in $(seq 0 3); do | 37 for N in $(seq 0 3); do |
33 echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor | 38 echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor |
34 echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed | 39 echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed |
35 done''' % CPU_CLOCK_RATE) | 40 done''' % CPU_CLOCK_RATE) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 name='cpu_%i clock rate' % i, sleeptime=30) | 90 name='cpu_%i clock rate' % i, sleeptime=30) |
86 for i in range(4)] + \ | 91 for i in range(4)] + \ |
87 [Expectation(str, exact_value=GPU_EMC_PROFILE, name='gpu/emc profile')] | 92 [Expectation(str, exact_value=GPU_EMC_PROFILE, name='gpu/emc profile')] |
88 | 93 |
89 Expectation.check_all(expectations, result) | 94 Expectation.check_all(expectations, result) |
90 | 95 |
91 def sleep(self, sleeptime): | 96 def sleep(self, sleeptime): |
92 self._unlock_clocks() | 97 self._unlock_clocks() |
93 HardwareAndroid.sleep(self, sleeptime) | 98 HardwareAndroid.sleep(self, sleeptime) |
94 self._lock_clocks() | 99 self._lock_clocks() |
OLD | NEW |