skpbench: suppot Nexus 6P
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2415033002 Review-Url: https://codereview.chromium.org/2415033002
This commit is contained in:
parent
e9ea349ff1
commit
310d72c5e2
@ -5,6 +5,7 @@
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
class Adb:
|
||||
def __init__(self, device_serial=None):
|
||||
@ -13,7 +14,7 @@ class Adb:
|
||||
self.__invocation.extend(['-s', device_serial])
|
||||
|
||||
def shell(self, cmd):
|
||||
subprocess.call(self.__invocation + ['shell', cmd])
|
||||
subprocess.call(self.__invocation + ['shell', cmd], stdout=sys.stderr)
|
||||
|
||||
def check(self, cmd):
|
||||
result = subprocess.check_output(self.__invocation + ['shell', cmd])
|
||||
@ -29,13 +30,13 @@ class Adb:
|
||||
return result.group(1) if result else 'unknown_product'
|
||||
|
||||
def is_root(self):
|
||||
return self.check('echo $USER') == 'root'
|
||||
return self.check('whoami') == 'root'
|
||||
|
||||
def attempt_root(self):
|
||||
if self.is_root():
|
||||
return True
|
||||
subprocess.call(self.__invocation + ['root'])
|
||||
subprocess.call(self.__invocation + ['root'], stdout=sys.stderr)
|
||||
return self.is_root()
|
||||
|
||||
def remount(self):
|
||||
subprocess.call(self.__invocation + ['remount'])
|
||||
subprocess.call(self.__invocation + ['remount'], stdout=sys.stderr)
|
||||
|
@ -75,16 +75,16 @@ class HardwareAndroid(Hardware):
|
||||
setprop ctl.start surfaceflinger &&
|
||||
setprop ctl.start zygote &&
|
||||
setprop ctl.start media''')
|
||||
else:
|
||||
# restore GPS (doesn't seem to work if we killed the gui).
|
||||
self._adb.shell('''\
|
||||
for PROVIDER in %s; do
|
||||
settings put secure location_providers_allowed +$PROVIDER
|
||||
done''' % self._initial_location_providers)
|
||||
|
||||
# restore GPS (doesn't seem to work if we killed the gui).
|
||||
self._adb.shell('''\
|
||||
for PROVIDER in %s; do
|
||||
settings put secure location_providers_allowed +$PROVIDER
|
||||
done''' % self._initial_location_providers)
|
||||
|
||||
# restore airplane mode (doesn't seem to work if we killed the gui).
|
||||
self._adb.shell('settings put global airplane_mode_on %s' %
|
||||
self._initial_airplane_mode)
|
||||
# restore airplane mode (doesn't seem to work if we killed the gui).
|
||||
self._adb.shell('settings put global airplane_mode_on %s' %
|
||||
self._initial_airplane_mode)
|
||||
|
||||
def sanity_check(self):
|
||||
Hardware.sanity_check(self)
|
||||
@ -93,24 +93,28 @@ class HardwareAndroid(Hardware):
|
||||
# search for and print thermal trip points that may have been exceeded.
|
||||
self._adb.shell('''\
|
||||
THERMALDIR=/sys/class/thermal
|
||||
if [ -e $THERMALDIR ]; then
|
||||
for ZONE in $(cd $THERMALDIR; echo thermal_zone*); do
|
||||
cd $THERMALDIR/$ZONE
|
||||
if [ -e mode ] && grep -Fxq enabled mode; then
|
||||
TEMP=$(cat temp)
|
||||
TRIPPOINT=
|
||||
let i=0
|
||||
while [ -e trip_point_${i}_temp ] &&
|
||||
[ $TEMP -gt $(cat trip_point_${i}_temp) ]; do
|
||||
TRIPPOINT=trip_point_${i}_temp
|
||||
let i=i+1
|
||||
done
|
||||
if [ $TRIPPOINT ]; then
|
||||
echo "$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOINT)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi''')
|
||||
if [ ! -d $THERMALDIR ]; then
|
||||
exit
|
||||
fi
|
||||
for ZONE in $(cd $THERMALDIR; echo thermal_zone*); do
|
||||
cd $THERMALDIR/$ZONE
|
||||
if [ ! -e mode ] || grep -Fxqv enabled mode || [ ! -e trip_point_0_temp ]; then
|
||||
continue
|
||||
fi
|
||||
TEMP=$(cat temp)
|
||||
TRIPPOINT=trip_point_0_temp
|
||||
if [ $TEMP -le $(cat $TRIPPOINT) ]; then
|
||||
echo "$ZONE ($(cat type)): temp=$TEMP <= $TRIPPOINT=$(cat $TRIPPOINT)" 1>&2
|
||||
else
|
||||
let i=1
|
||||
while [ -e trip_point_${i}_temp ] &&
|
||||
[ $TEMP -gt $(cat trip_point_${i}_temp) ]; do
|
||||
TRIPPOINT=trip_point_${i}_temp
|
||||
let i=i+1
|
||||
done
|
||||
echo "$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOINT)" 1>&2
|
||||
fi
|
||||
done''')
|
||||
|
||||
Hardware.print_debug_diagnostics(self)
|
||||
|
||||
|
155
tools/skpbench/_hardware_nexus_6p.py
Normal file
155
tools/skpbench/_hardware_nexus_6p.py
Normal file
@ -0,0 +1,155 @@
|
||||
# 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 = 1728000
|
||||
GPU_CLOCK_RATE = 510000000
|
||||
|
||||
class HardwareNexus6P(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
|
||||
|
||||
self._adb.shell('''\
|
||||
stop thermal-engine
|
||||
stop thermald
|
||||
stop perfd
|
||||
stop mpdecision''')
|
||||
|
||||
# enable and lock 3 of 4 big cores.
|
||||
self._adb.shell('''\
|
||||
for N in 4 5 6; do
|
||||
echo 1 > /sys/devices/system/cpu/cpu$N/online
|
||||
echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
|
||||
echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_max_freq
|
||||
echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_min_freq
|
||||
echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
|
||||
done''' % tuple(CPU_CLOCK_RATE for _ in range(3)))
|
||||
|
||||
# turn off all other cores
|
||||
self._adb.shell('''\
|
||||
for N in 0 1 2 3 7; do
|
||||
echo 0 > /sys/devices/system/cpu/cpu$N/online
|
||||
done''')
|
||||
|
||||
# gpu/ddr perf commands from
|
||||
# https://developer.qualcomm.com/qfile/28823/lm80-p0436-11_adb_commands.pdf
|
||||
self._adb.shell('''\
|
||||
echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split
|
||||
echo 1 > /sys/class/kgsl/kgsl-3d0/force_bus_on
|
||||
echo 1 > /sys/class/kgsl/kgsl-3d0/force_rail_on
|
||||
echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on
|
||||
echo 1000000 > /sys/class/kgsl/kgsl-3d0/idle_timer
|
||||
echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor
|
||||
echo %i > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
|
||||
echo %i > /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
|
||||
echo %i > /sys/class/kgsl/kgsl-3d0/gpuclk''' %
|
||||
tuple(GPU_CLOCK_RATE for _ in range(3)))
|
||||
|
||||
# ddr perf commands from
|
||||
# https://developer.qualcomm.com/qfile/28823/lm80-p0436-11_adb_commands.pdf
|
||||
self._adb.shell('''\
|
||||
echo performance > /sys/class/devfreq/qcom,cpubw.32/governor
|
||||
echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq
|
||||
echo 9887 > /sys/class/devfreq/qcom,cpubw.32/min_freq
|
||||
echo performance > /sys/class/devfreq/qcom,gpubw.70/governor
|
||||
echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq
|
||||
echo 9887 > /sys/class/devfreq/qcom,gpubw.70/min_freq''')
|
||||
|
||||
def _unlock_clocks(self):
|
||||
if not self._is_root:
|
||||
return
|
||||
|
||||
# restore ddr settings to default.
|
||||
self._adb.shell('''\
|
||||
echo 1525 > /sys/class/devfreq/qcom,cpubw.32/min_freq
|
||||
echo 9887 > /sys/class/devfreq/qcom,cpubw.32/max_freq
|
||||
echo bw_hwmon > /sys/class/devfreq/qcom,cpubw.32/governor
|
||||
echo 1525 > /sys/class/devfreq/qcom,gpubw.70/min_freq
|
||||
echo 9887 > /sys/class/devfreq/qcom,gpubw.70/max_freq
|
||||
echo bw_hwmon > /sys/class/devfreq/qcom,gpubw.70/governor''')
|
||||
|
||||
# restore gpu settings to default.
|
||||
self._adb.shell('''\
|
||||
echo 180000000 > /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
|
||||
echo 600000000 > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
|
||||
echo 180000000 > /sys/class/kgsl/kgsl-3d0/gpuclk
|
||||
echo msm-adreno-tz > /sys/class/kgsl/kgsl-3d0/devfreq/governor
|
||||
echo 0 > /sys/class/kgsl/kgsl-3d0/idle_timer
|
||||
echo 0 > /sys/class/kgsl/kgsl-3d0/force_clk_on
|
||||
echo 0 > /sys/class/kgsl/kgsl-3d0/force_rail_on
|
||||
echo 0 > /sys/class/kgsl/kgsl-3d0/force_bus_on
|
||||
echo 1 > /sys/class/kgsl/kgsl-3d0/bus_split''')
|
||||
|
||||
# turn the disabled cores back on.
|
||||
self._adb.shell('''\
|
||||
for N in 7 3 2 1 0; do
|
||||
echo 1 > /sys/devices/system/cpu/cpu$N/online
|
||||
done''')
|
||||
|
||||
# unlock the 3 enabled big cores.
|
||||
self._adb.shell('''\
|
||||
for N in 6 5 4; do
|
||||
echo 633600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
|
||||
echo 1958400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
|
||||
echo 0 > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
|
||||
echo interactive > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
|
||||
done''')
|
||||
|
||||
self._adb.shell('''\
|
||||
start mpdecision
|
||||
start perfd
|
||||
start thermald
|
||||
start thermal-engine''')
|
||||
|
||||
def sanity_check(self):
|
||||
HardwareAndroid.sanity_check(self)
|
||||
|
||||
if not self._is_root:
|
||||
return
|
||||
|
||||
result = self._adb.check_lines('''\
|
||||
cat /sys/class/power_supply/battery/capacity \
|
||||
/sys/devices/system/cpu/online \
|
||||
/sys/class/thermal/thermal_zone14/temp \
|
||||
/sys/class/thermal/thermal_zone15/temp \
|
||||
/sys/kernel/debug/clk/oxili_gfx3d_clk/measure \
|
||||
/sys/kernel/debug/clk/bimc_clk/measure
|
||||
for N in 4 5 6; do
|
||||
cat /sys/devices/system/cpu/cpu$N/cpufreq/scaling_cur_freq
|
||||
done''')
|
||||
|
||||
expectations = \
|
||||
[Expectation(int, min_value=30, name='battery', sleeptime=30*60),
|
||||
Expectation(str, exact_value='4-6', name='online cpus'),
|
||||
Expectation(int, max_value=88, name='tsens_tz_sensor13'),
|
||||
Expectation(int, max_value=88, name='tsens_tz_sensor14'),
|
||||
Expectation(long, min_value=(GPU_CLOCK_RATE - 5000),
|
||||
max_value=(GPU_CLOCK_RATE + 5000), name='gpu clock rate'),
|
||||
Expectation(long, min_value=647995000, max_value=648007500,
|
||||
name='ddr clock rate', sleeptime=10)] + \
|
||||
[Expectation(int, exact_value=CPU_CLOCK_RATE, name='cpu_%i clock rate' %i)
|
||||
for i in range(4, 7)]
|
||||
|
||||
Expectation.check_all(expectations, result)
|
||||
|
||||
def sleep(self, sleeptime):
|
||||
self._unlock_clocks()
|
||||
HardwareAndroid.sleep(self, sleeptime)
|
||||
self._lock_clocks()
|
@ -124,7 +124,7 @@ class SKPBench:
|
||||
def run_warmup(cls, warmup_time):
|
||||
if not warmup_time:
|
||||
return
|
||||
print('running %i second warmup...' % warmup_time)
|
||||
print('running %i second warmup...' % warmup_time, file=sys.stderr)
|
||||
commandline = cls.ARGV + ['--duration', str(warmup_time * 1000),
|
||||
'--config', 'gpu',
|
||||
'--skp', 'warmup']
|
||||
@ -180,7 +180,7 @@ class SKPBench:
|
||||
hardware.sanity_check()
|
||||
self._process_result(result)
|
||||
else:
|
||||
print(message.value)
|
||||
print(message.value, file=sys.stderr)
|
||||
sys.stdout.flush()
|
||||
continue
|
||||
if message.message == Message.POLL_HARDWARE:
|
||||
@ -252,14 +252,16 @@ def run_benchmarks(configs, skps, hardware):
|
||||
skpbench.best_result))
|
||||
|
||||
except HardwareException as exception:
|
||||
skpbench.terminate()
|
||||
if FLAGS.verbosity >= 5:
|
||||
hardware.print_debug_diagnostics()
|
||||
skpbench.terminate()
|
||||
if FLAGS.verbosity >= 1:
|
||||
print("%s; taking a %i second nap..." %
|
||||
(exception.message, exception.sleeptime), file=sys.stderr)
|
||||
benches.appendleft(benchargs) # retry the same bench next time.
|
||||
hardware.sleep(exception.sleeptime)
|
||||
if FLAGS.verbosity >= 5:
|
||||
hardware.print_debug_diagnostics()
|
||||
SKPBench.run_warmup(hardware.warmup_time)
|
||||
|
||||
|
||||
@ -275,6 +277,9 @@ def main():
|
||||
if model == 'Pixel C':
|
||||
from _hardware_pixel_c import HardwarePixelC
|
||||
hardware = HardwarePixelC(adb)
|
||||
elif model == 'Nexus 6P':
|
||||
from _hardware_nexus_6p import HardwareNexus6P
|
||||
hardware = HardwareNexus6P(adb)
|
||||
else:
|
||||
from _hardware_android import HardwareAndroid
|
||||
print("WARNING: %s: don't know how to monitor this hardware; results "
|
||||
|
Loading…
Reference in New Issue
Block a user