update cpufreq governor efficiency bench to : - use timer instead of sleep to have a better load emulation - track overrun : run duration exceeds period
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org --- doc/examples/cpufreq_governor_efficiency/dvfs.json | 18 ++++++++++-------- doc/examples/cpufreq_governor_efficiency/dvfs.sh | 20 +++++++++++++++----- doc/examples/cpufreq_governor_efficiency/test.sh | 22 +++++++++++----------- 3 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/doc/examples/cpufreq_governor_efficiency/dvfs.json b/doc/examples/cpufreq_governor_efficiency/dvfs.json index c8447df..c1eefe4 100755 --- a/doc/examples/cpufreq_governor_efficiency/dvfs.json +++ b/doc/examples/cpufreq_governor_efficiency/dvfs.json @@ -2,26 +2,28 @@ "tasks" : { "thread" : { "instance" : 1, - "cpus" : [0], -"loop" : 21, + "policy" : "SCHED_FIFO", + "cpus" : [1], + "loop" : 10, "phases" : { - "running" : { - "loop" : 1, - "run" : 100, - }, "sleeping" : { "loop" : 1, - "sleep" : 100, + "timer" : { "ref" : "tick", "period" : 1200000, } + }, + "running" : { + "loop" : 1, + "run" : 900000, } } } }, "global" : { "default_policy" : "SCHED_OTHER", - "calibration" : 90, + "calibration" : 128, "lock_pages" : true, "ftrace" : false, "logdir" : "./", + "log_size" : 2, } }
diff --git a/doc/examples/cpufreq_governor_efficiency/dvfs.sh b/doc/examples/cpufreq_governor_efficiency/dvfs.sh index 00ce81d..7caee7d 100755 --- a/doc/examples/cpufreq_governor_efficiency/dvfs.sh +++ b/doc/examples/cpufreq_governor_efficiency/dvfs.sh @@ -6,33 +6,43 @@ set -e 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 -sleep 3
if [ $3 ] ; then sed 's/"run" : .*,/"run" : '$3',/' -i dvfs.json fi
if [ $4 ] ; then - sed 's/"sleep" : .*,/"sleep" : '$4',/' -i dvfs.json + sed 's/"period" : .*,/"period" : '$4',/' -i dvfs.json fi
if [ $5 ] ; then sed 's/^"loop" : .*,/"loop" : '$5',/' -i dvfs.json fi
+sync + +sleep 1 + rt-app dvfs.json 2> /dev/null
if [ $1 ] ; then + mv -f rt-app-thread-0.log rt-app_$1_run$3us_sleep$4us.log
sum=0 loop=0 - for i in $(cat rt-app_$1_run$3us_sleep$4us.log | sed 'n;d' | sed '1d' |cut -f 3); do + overrun=0 + for i in $(cat rt-app_$1_run$3us_sleep$4us.log | sed '1d;n;d' | sed '1d' |cut -f 3); do loop=$(expr $loop + 1) sum=$(expr $sum + $i) + if [ $4 -le $i ] ; then + #echo $i"vs"$4 + overrun=$(expr $overrun + 1) + fi done + sum=$(expr $sum / $loop) - echo $sum - rm -f rt-app_$1_run$3us_sleep$4us.log + echo $sum" "$overrun + #rm -f rt-app_$1_run$3us_sleep$4us.log fi
diff --git a/doc/examples/cpufreq_governor_efficiency/test.sh b/doc/examples/cpufreq_governor_efficiency/test.sh index 0160952..4d8cb9c 100755 --- a/doc/examples/cpufreq_governor_efficiency/test.sh +++ b/doc/examples/cpufreq_governor_efficiency/test.sh @@ -40,16 +40,16 @@ test_efficiency() {
# Get target gov data first dvfs.sh $1 $2 $3 $4 $5 > $FILENAME - target=$(cat $FILENAME |sed -n '1p') - - # Get powersave data - dvfs.sh powersave $2 $3 $4 $5 > $FILENAME - powersave=$(cat $FILENAME |sed -n '1p') - + target=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 1) + over_target=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 2) # Get performance data dvfs.sh performance $2 $3 $4 $5 > $FILENAME - performance=$(cat $FILENAME |sed -n '1p') - + performance=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 1) + over_perf=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 2) + # Get powersave data + dvfs.sh powersave $2 $3 $4 $5 > $FILENAME + powersave=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 1) + over_save=$(cat $FILENAME |sed -n '$p' | cut -d " " -f 2) if [ $performance -ge $powersave ] ; then echo "powersave: $powersave" echo "performance: $performance" @@ -57,8 +57,8 @@ test_efficiency() { exit fi
- echo ""powersave" efficiency: 0%" - echo ""performance" efficiency: 100%" + echo ""powersave" efficiency: 0% overrun: "$over_save + echo ""performance" efficiency: 100% overrun: "$over_perf
denominator=$(expr $powersave - $performance)
@@ -73,7 +73,7 @@ test_efficiency() { fi fi
- echo ""$gov_target" efficiency: $target%" + echo ""$gov_target" efficiency: $target% overrun: "$over_target
rm -f $FILENAME }