diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2016-01-16 23:30:44 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2016-01-18 11:52:28 +0000 |
commit | ee8577db98cfae44411aa5c714b189468fb41c0c (patch) | |
tree | 0e835a0ba64bde0abd35263bde477c583bb40e59 /common | |
parent | 6fa02de04c73039093520559f523cb98ee574386 (diff) |
common: change to set all cpus to performance governor policy
we only set for cpu0 and cpu1 before, but we have more cpus
on juno and hikey now, so it's better to set all of the cpus
to use the performance governor policy for benchmark test
Change-Id: I2f356841ac22fc079cdb35c5b3e738422f385881
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'common')
-rwxr-xr-x | common/common.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/common/common.sh b/common/common.sh index d2b9ae3..ffb9466 100755 --- a/common/common.sh +++ b/common/common.sh @@ -10,10 +10,27 @@ pre_uninstall="" ret_value=0 timeout=10m +dir_sys_cpu="/sys/devices/system/cpu/" f_tmp_governor="/data/local/tmp/governor.txt" + +func_setgovernor(){ + local target_governor="$1" + local target_freq="$2" + if [ -z "${target_governor}" ]; then + return + fi + for cpu in $(adb shell "ls -d ${dir_sys_cpu}/cpu[0-9]*" |tr '\r' ' '); do + local dir_cpu_cpufreq="${cpu}/cpufreq" + adb shell "echo ${target_governor}>${dir_cpu_cpufreq}/scaling_governor" + if [ -n "${target_freq}" ]; then + adb shell "echo ${target_freq} >${dir_cpu_cpufreq}/scaling_setspeed" + fi + done +} + func_cleanup(){ - adb shell "cat ${f_tmp_governor} > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" - adb shell "cat ${f_tmp_governor} > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor" + local target_governor=$(adb shell cat ${f_tmp_governor}) + func_setgovernor "${target_governor}" adb shell rm ${f_tmp_governor} func_kill_uninstall "RotationOff.apk" "rotation.off" } @@ -40,8 +57,7 @@ function init(){ func_install_start_RotationAPK adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor > ${f_tmp_governor}" - adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" - adb shell "echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor" + func_setgovernor "performance" } func_prepare_benchmark(){ |