6from __future__
import print_function
7from _hardware
import Hardware
13 Hardware.__init__(self)
22 Hardware.__enter__(self)
29 settings put global airplane_mode_on 1
''',
33 settings put secure location_providers_allowed -gps
34 settings put secure location_providers_allowed -wifi
35 settings put secure location_providers_allowed -network''']))
37 if self.
_adb.is_root():
45 service call bluetooth_manager 8
51 setprop ctl.stop media
52 setprop ctl.stop zygote
53 setprop ctl.stop surfaceflinger
54 setprop ctl.stop drm''',
58 echo 0 > /proc/sys/kernel/randomize_va_space''',
66 print(
"WARNING: no adb root access; results may be unreliable.",
71 def __exit__(self, exception_type, exception_value, traceback):
72 Hardware.__exit__(self, exception_type, exception_value, traceback)
76 Hardware.sanity_check(self)
81 THERMALDIR=/sys/class/thermal
82 if [ ! -d $THERMALDIR ]; then
85 for ZONE
in $(cd $THERMALDIR; echo thermal_zone*); do
87 if [ ! -e mode ] || grep -Fxqv enabled mode || [ ! -e trip_point_0_temp ]; then
91 TRIPPOINT=trip_point_0_temp
92 if [ $TEMP -le $(cat $TRIPPOINT) ]; then
93 echo
"$ZONE ($(cat type)): temp=$TEMP <= $TRIPPOINT=$(cat $TRIPPOINT)" 1>&2
96 while [ -e trip_point_${i}_temp ] &&
97 [ $TEMP -gt $(cat trip_point_${i}_temp) ]; do
98 TRIPPOINT=trip_point_${i}_temp
101 echo
"$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOINT)" 1>&2
105 Hardware.print_debug_diagnostics(self)
114 core_count =
int(self.
_adb.
check(
'cat /proc/cpuinfo | grep processor | wc -l'))
116 for i
in range(core_count):
117 khz =
int(self.
_adb.
check(
'cat /sys/devices/system/cpu/cpu%i/cpufreq/cpuinfo_max_freq' % i))
118 max_speeds.append((khz, i))
119 cores_in_desc_order_of_max_speed = [a[1]
for a
in sorted(max_speeds, reverse=
True)]
120 top_cores = cores_in_desc_order_of_max_speed[:3]
121 disable_cores = cores_in_desc_order_of_max_speed[3:]
123 self.
_adb.
shell(
'\n'.
join([(
'echo 0 > /sys/devices/system/cpu/cpu%i/online' % i)
for i
in disable_cores]))
128 freqs = self.
_adb.
check(
'cat /sys/devices/system/cpu/cpu%i/cpufreq/scaling_available_frequencies' % i).split()
130 self.
_adb.
shell(
'''echo 1 > /sys/devices/system/cpu/cpu{id}/online
131 echo userspace > /sys/devices/system/cpu/cpu{id}/cpufreq/scaling_governor
132 echo {speed} > /sys/devices/system/cpu/cpu{id}/cpufreq/scaling_max_freq
133 echo {speed} > /sys/devices/system/cpu/cpu{id}/cpufreq/scaling_min_freq
134 echo {speed} > /sys/devices/system/cpu/cpu{id}/cpufreq/scaling_setspeed'''.format(id=i, speed=speed))
138 exists = self.
_adb.
check(
'test -d /sys/class/kgsl && echo y')
139 if (exists.strip() !=
'y'):
140 print(
'Not attempting Adreno GPU clock locking steps')
145 echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split
146 echo 1 > /sys/
class/kgsl/kgsl-3d0/force_clk_on
147 echo 10000 > /sys/
class/kgsl/kgsl-3d0/idle_timer
''')
149 freqs = self._adb.check('cat /sys/class/kgsl/kgsl-3d0/devfreq/available_frequencies').split()
154 echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor
155 echo {speed} > /sys/
class/kgsl/kgsl-3d0/devfreq/max_freq
156 echo {speed} > /sys/
class/kgsl/kgsl-3d0/devfreq/min_freq
'''.format(speed=speed))
160 echo 1 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
161 echo 1 > /sys/
class/kgsl/kgsl-3d0/min_pwrlevel
''')
#define check(reporter, ref, unref, make, kill)
def print(*args, **kwargs)
static SkString join(const CommandLineFlags::StringArray &)