Save the current governor prior to switching to the test governor, and then restore it when the test is complete.
Aside from the general benefit of restoring the system state after the script completes this also allows the calculations in the latter portion of the script to be run with the default system governor. Running these calculations with the powersave governor (or a governor configured for very slow responsiveness etc) can be quite slow.
Signed-off-by: Steve Muckle smuckle@linaro.org --- doc/examples/cpufreq_governor_efficiency/dvfs.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/examples/cpufreq_governor_efficiency/dvfs.sh b/doc/examples/cpufreq_governor_efficiency/dvfs.sh index 7caee7d437f7..a9173a41f602 100755 --- a/doc/examples/cpufreq_governor_efficiency/dvfs.sh +++ b/doc/examples/cpufreq_governor_efficiency/dvfs.sh @@ -3,8 +3,9 @@ # $1 $2 $3 $4 $5: governor cpu run sleep loops set -e
+savedgov=$(cat /sys/devices/system/cpu/cpu$2/cpufreq/scaling_governor) echo $1 > /sys/devices/system/cpu/cpu$2/cpufreq/scaling_governor -#echo $1 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor + sed 's/"cpus" : [.*],/"cpus" : ['$2'],/' -i dvfs.json
if [ $3 ] ; then @@ -25,6 +26,8 @@ sleep 1
rt-app dvfs.json 2> /dev/null
+echo $savedgov > /sys/devices/system/cpu/cpu$2/cpufreq/scaling_governor + if [ $1 ] ; then
mv -f rt-app-thread-0.log rt-app_$1_run$3us_sleep$4us.log