6from _hardware
import HardwareException, Expectation
7from _hardware_android
import HardwareAndroid
9CPU_CLOCK_RATE = 1326000
12GPU_EMC_PROFILE =
'04: core 307 MHz emc 1065 MHz a A d D *'
13GPU_EMC_PROFILE_ID =
'04'
17 HardwareAndroid.__init__(self, adb)
20 HardwareAndroid.__enter__(self)
21 if not self.
_adb.is_root():
32 echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
33 echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
34 echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
35 echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
36 ''' % tuple(CPU_CLOCK_RATE for _ in range(3)),
41 echo 0 > /sys/devices/system/cpu/cpu3/online''',
45 chown root:root /sys/devices/57000000.gpu/pstate
46 echo %s > /sys/devices/57000000.gpu/pstate''' % GPU_EMC_PROFILE_ID]))
51 JUNK = [
'NvRmPrivGetChipPlatform: Could not read platform information',
52 'Expected on kernels without fuse support, using silicon']
53 return False if line
in JUNK
else HardwareAndroid.filter_line(self, line)
56 HardwareAndroid.sanity_check(self)
58 if not self.
_adb.is_root():
63 cat /sys/class/power_supply/bq27742-0/capacity \
64 /sys/devices/system/cpu/online \
65 /sys/
class/thermal/thermal_zone7/temp \
66 /sys/
class/thermal/thermal_zone0/temp \
67 /sys/
class/thermal/thermal_zone1/temp \
68 /sys/
class/thermal/thermal_zone7/cdev1/cur_state \
69 /sys/
class/thermal/thermal_zone7/cdev0/cur_state
71 cat /sys/devices/system/cpu/cpu$N/cpufreq/scaling_cur_freq
73 cat /sys/devices/57000000.gpu/pstate | grep \*$
''')
76 [Expectation(int, min_value=30, name='battery', sleeptime=30*60),
77 Expectation(str, exact_value=
'0-2', name=
'online cpus'),
78 Expectation(int, max_value=40000, name=
'skin temperature'),
79 Expectation(int, max_value=86000, name=
'cpu temperature'),
80 Expectation(int, max_value=87000, name=
'gpu temperature'),
81 Expectation(int, exact_value=0, name=
'cpu throttle'),
82 Expectation(int, exact_value=0, name=
'gpu throttle')] + \
84 name=
'cpu_%i clock rate' % i, sleeptime=30)
85 for i
in (0, 1, 2)] + \
86 [
Expectation(str, exact_value=GPU_EMC_PROFILE, name=
'gpu/emc profile')]
88 Expectation.check_all(expectations, result.splitlines())
#define check(reporter, ref, unref, make, kill)
static SkString join(const CommandLineFlags::StringArray &)