feat(perf): disable wake lock and cpu freq scaling on android

This commit is contained in:
Tobias Bosch 2015-01-20 16:29:50 -08:00
parent 8a8a4b2ae7
commit 8b2a5d7d17
4 changed files with 54 additions and 1 deletions

42
scripts/ci/android_cpu.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
set -e
CPUPATH=/sys/devices/system/cpu
WAKE_LOCK_NAME=ngperf
set_governor() {
echo "Setting CPU frequency governor to \"$1\""
adb shell 'for f in '$CPUPATH'/cpu*/cpufreq/scaling_governor ; do echo '$1' > $f; done'
}
wake_lock() {
echo "Setting wake lock $WAKE_LOCK_NAME"
adb shell "echo $WAKE_LOCK_NAME > /sys/power/wake_lock"
}
wake_unlock() {
echo "Removing wake lock $WAKE_LOCK_NAME"
adb shell "echo $WAKE_LOCK_NAME > /sys/power/wake_unlock"
}
case "$1" in
(performance)
set_governor "performance"
;;
(powersave)
set_governor "powersave"
;;
(ondemand)
set_governor "ondemand"
;;
(wakelock)
wake_lock
;;
(wakeunlock)
wake_unlock
;;
(*)
echo "Usage: $0 performance|powersave|ondemand|wakelock|wakeunlock"
exit 1
;;
esac

View File

@ -1,10 +1,15 @@
#!/bin/bash
set -e
SCRIPT_DIR=$(dirname $0)
cd $SCRIPT_DIR
if [[ $PERF_BROWSERS =~ .*Android.* || $E2E_BROWSERS =~ .*Android.* ]]
then
adb usb
adb root usb
adb wait-for-device devices
adb reverse tcp:8001 tcp:8001
adb reverse tcp:8002 tcp:8002
./android_cpu.sh performance
./android_cpu.sh wakelock
fi

View File

@ -18,5 +18,8 @@ serverPid=$!
trap killServer EXIT
# wait for server to come up!
sleep 10
./node_modules/.bin/protractor protractor-e2e-js.conf.js --browsers=$E2E_BROWSERS
./node_modules/.bin/protractor protractor-e2e-dart2js.conf.js --browsers=$E2E_BROWSERS

View File

@ -18,5 +18,8 @@ serverPid=$!
trap killServer EXIT
# wait for server to come up!
sleep 10
./node_modules/.bin/protractor protractor-perf-js.conf.js --browsers=$PERF_BROWSERS
./node_modules/.bin/protractor protractor-perf-dart2js.conf.js --browsers=$PERF_BROWSERS