~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/amd-pstate/tbench.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/amd-pstate/tbench.sh (Architecture alpha) and /tools/testing/selftests/amd-pstate/tbench.sh (Architecture i386)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3                                                     3 
  4 # Testing and monitor the cpu desire performan      4 # Testing and monitor the cpu desire performance, frequency, load,
  5 # power consumption and throughput etc.when th      5 # power consumption and throughput etc.when this script trigger tbench
  6 # test cases.                                       6 # test cases.
  7 # 1) Run tbench benchmark on specific governor      7 # 1) Run tbench benchmark on specific governors, ondemand or schedutil.
  8 # 2) Run tbench benchmark comparative test on       8 # 2) Run tbench benchmark comparative test on acpi-cpufreq kernel driver.
  9 # 3) Get desire performance, frequency, load b      9 # 3) Get desire performance, frequency, load by perf.
 10 # 4) Get power consumption and throughput by a     10 # 4) Get power consumption and throughput by amd_pstate_trace.py.
 11 # 5) Analyse test results and save it in file      11 # 5) Analyse test results and save it in file selftest.tbench.csv.
 12 # 6) Plot png images about performance, energy     12 # 6) Plot png images about performance, energy and performance per watt for each test.
 13                                                    13 
 14 # protect against multiple inclusion               14 # protect against multiple inclusion
 15 if [ $FILE_TBENCH ]; then                          15 if [ $FILE_TBENCH ]; then
 16         return 0                                   16         return 0
 17 else                                               17 else
 18         FILE_TBENCH=DONE                           18         FILE_TBENCH=DONE
 19 fi                                                 19 fi
 20                                                    20 
 21 tbench_governors=("ondemand" "schedutil")          21 tbench_governors=("ondemand" "schedutil")
 22                                                    22 
 23 # $1: governor, $2: round, $3: des-perf, $4: f     23 # $1: governor, $2: round, $3: des-perf, $4: freq, $5: load, $6: performance, $7: energy, $8: performance per watt
 24 store_csv_tbench()                                 24 store_csv_tbench()
 25 {                                                  25 {
 26         echo "$1, $2, $3, $4, $5, $6, $7, $8"      26         echo "$1, $2, $3, $4, $5, $6, $7, $8" | tee -a $OUTFILE_TBENCH.csv > /dev/null 2>&1
 27 }                                                  27 }
 28                                                    28 
 29 # clear some special lines                         29 # clear some special lines
 30 clear_csv_tbench()                                 30 clear_csv_tbench()
 31 {                                                  31 {
 32         if [ -f $OUTFILE_TBENCH.csv ]; then        32         if [ -f $OUTFILE_TBENCH.csv ]; then
 33                 sed -i '/Comprison(%)/d' $OUTF     33                 sed -i '/Comprison(%)/d' $OUTFILE_TBENCH.csv
 34                 sed -i "/$(scaling_name)/d" $O     34                 sed -i "/$(scaling_name)/d" $OUTFILE_TBENCH.csv
 35         fi                                         35         fi
 36 }                                                  36 }
 37                                                    37 
 38 # find string $1 in file csv and get the numbe     38 # find string $1 in file csv and get the number of lines
 39 get_lines_csv_tbench()                             39 get_lines_csv_tbench()
 40 {                                                  40 {
 41         if [ -f $OUTFILE_TBENCH.csv ]; then        41         if [ -f $OUTFILE_TBENCH.csv ]; then
 42                 return `grep -c "$1" $OUTFILE_     42                 return `grep -c "$1" $OUTFILE_TBENCH.csv`
 43         else                                       43         else
 44                 return 0                           44                 return 0
 45         fi                                         45         fi
 46 }                                                  46 }
 47                                                    47 
 48 pre_clear_tbench()                                 48 pre_clear_tbench()
 49 {                                                  49 {
 50         post_clear_tbench                          50         post_clear_tbench
 51         rm -rf tbench_*.png                        51         rm -rf tbench_*.png
 52         clear_csv_tbench                           52         clear_csv_tbench
 53 }                                                  53 }
 54                                                    54 
 55 post_clear_tbench()                                55 post_clear_tbench()
 56 {                                                  56 {
 57         rm -rf results/tracer-tbench*              57         rm -rf results/tracer-tbench*
 58         rm -rf $OUTFILE_TBENCH*.log                58         rm -rf $OUTFILE_TBENCH*.log
 59         rm -rf $OUTFILE_TBENCH*.result             59         rm -rf $OUTFILE_TBENCH*.result
 60                                                    60 
 61 }                                                  61 }
 62                                                    62 
 63 # $1: governor, $2: loop                           63 # $1: governor, $2: loop
 64 run_tbench()                                       64 run_tbench()
 65 {                                                  65 {
 66         echo "Launching amd pstate tracer for      66         echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INTERVAL"
 67         $TRACER -n tracer-tbench-$1-$2 -i $TRA     67         $TRACER -n tracer-tbench-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
 68                                                    68 
 69         printf "Test tbench for $1 #$2 time_li     69         printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCESS_NUM\n"
 70         tbench_srv > /dev/null 2>&1 &              70         tbench_srv > /dev/null 2>&1 &
 71         $PERF stat -a --per-socket -I 1000 -e      71         $PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
 72                                                    72 
 73         pid=`pidof tbench_srv`                     73         pid=`pidof tbench_srv`
 74         kill $pid                                  74         kill $pid
 75                                                    75 
 76         for job in `jobs -p`                       76         for job in `jobs -p`
 77         do                                         77         do
 78                 echo "Waiting for job id $job"     78                 echo "Waiting for job id $job"
 79                 wait $job                          79                 wait $job
 80         done                                       80         done
 81 }                                                  81 }
 82                                                    82 
 83 # $1: governor, $2: loop                           83 # $1: governor, $2: loop
 84 parse_tbench()                                     84 parse_tbench()
 85 {                                                  85 {
 86         awk '{print $5}' results/tracer-tbench     86         awk '{print $5}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_TBENCH-des-perf-$1-$2.log
 87         avg_des_perf=$(awk 'BEGIN {i=0; sum=0}     87         avg_des_perf=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_TBENCH-des-perf-$1-$2.log)
 88         printf "Tbench-$1-#$2 avg des perf: $a     88         printf "Tbench-$1-#$2 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_TBENCH.result
 89                                                    89 
 90         awk '{print $7}' results/tracer-tbench     90         awk '{print $7}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_TBENCH-freq-$1-$2.log
 91         avg_freq=$(awk 'BEGIN {i=0; sum=0};{i+     91         avg_freq=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_TBENCH-freq-$1-$2.log)
 92         printf "Tbench-$1-#$2 avg freq: $avg_f     92         printf "Tbench-$1-#$2 avg freq: $avg_freq\n" | tee -a $OUTFILE_TBENCH.result
 93                                                    93 
 94         awk '{print $11}' results/tracer-tbenc     94         awk '{print $11}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_TBENCH-load-$1-$2.log
 95         avg_load=$(awk 'BEGIN {i=0; sum=0};{i+     95         avg_load=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_TBENCH-load-$1-$2.log)
 96         printf "Tbench-$1-#$2 avg load: $avg_l     96         printf "Tbench-$1-#$2 avg load: $avg_load\n" | tee -a $OUTFILE_TBENCH.result
 97                                                    97 
 98         grep Throughput $OUTFILE_TBENCH-perf-$     98         grep Throughput $OUTFILE_TBENCH-perf-$1-$2.log | awk '{print $2}' > $OUTFILE_TBENCH-throughput-$1-$2.log
 99         tp_sum=$(awk 'BEGIN {sum=0};{sum += $1     99         tp_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_TBENCH-throughput-$1-$2.log)
100         printf "Tbench-$1-#$2 throughput(MB/s)    100         printf "Tbench-$1-#$2 throughput(MB/s): $tp_sum\n" | tee -a $OUTFILE_TBENCH.result
101                                                   101 
102         grep Joules $OUTFILE_TBENCH-perf-$1-$2    102         grep Joules $OUTFILE_TBENCH-perf-$1-$2.log | awk '{print $4}' > $OUTFILE_TBENCH-energy-$1-$2.log
103         en_sum=$(awk 'BEGIN {sum=0};{sum += $1    103         en_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_TBENCH-energy-$1-$2.log)
104         printf "Tbench-$1-#$2 power consumptio    104         printf "Tbench-$1-#$2 power consumption(J): $en_sum\n" | tee -a $OUTFILE_TBENCH.result
105                                                   105 
106         # Permance is throughput per second, d    106         # Permance is throughput per second, denoted T/t, where T is throught rendered in t seconds.
107         # It is well known that P=E/t, where P    107         # It is well known that P=E/t, where P is power measured in watts(W), E is energy measured in joules(J),
108         # and t is time measured in seconds(s)    108         # and t is time measured in seconds(s). This means that performance per watt becomes
109         #       T/t   T/t    T                    109         #       T/t   T/t    T
110         #       --- = --- = ---                   110         #       --- = --- = ---
111         #        P    E/t    E                    111         #        P    E/t    E
112         # with unit given by MB per joule.        112         # with unit given by MB per joule.
113         ppw=`echo "scale=4;($TIME_LIMIT-1)*$tp    113         ppw=`echo "scale=4;($TIME_LIMIT-1)*$tp_sum/$en_sum" | bc | awk '{printf "%.4f", $0}'`
114         printf "Tbench-$1-#$2 performance per     114         printf "Tbench-$1-#$2 performance per watt(MB/J): $ppw\n" | tee -a $OUTFILE_TBENCH.result
115         printf "\n" | tee -a $OUTFILE_TBENCH.r    115         printf "\n" | tee -a $OUTFILE_TBENCH.result
116                                                   116 
117         driver_name=`echo $(scaling_name)`        117         driver_name=`echo $(scaling_name)`
118         store_csv_tbench "$driver_name-$1" $2     118         store_csv_tbench "$driver_name-$1" $2 $avg_des_perf $avg_freq $avg_load $tp_sum $en_sum $ppw
119 }                                                 119 }
120                                                   120 
121 # $1: governor                                    121 # $1: governor
122 loop_tbench()                                     122 loop_tbench()
123 {                                                 123 {
124         printf "\nTbench total test times is $    124         printf "\nTbench total test times is $LOOP_TIMES for $1\n\n"
125         for i in `seq 1 $LOOP_TIMES`              125         for i in `seq 1 $LOOP_TIMES`
126         do                                        126         do
127                 run_tbench $1 $i                  127                 run_tbench $1 $i
128                 parse_tbench $1 $i                128                 parse_tbench $1 $i
129         done                                      129         done
130 }                                                 130 }
131                                                   131 
132 # $1: governor                                    132 # $1: governor
133 gather_tbench()                                   133 gather_tbench()
134 {                                                 134 {
135         printf "Tbench test result for $1 (loo    135         printf "Tbench test result for $1 (loops:$LOOP_TIMES)" | tee -a $OUTFILE_TBENCH.result
136         printf "\n----------------------------    136         printf "\n--------------------------------------------------\n" | tee -a $OUTFILE_TBENCH.result
137                                                   137 
138         grep "Tbench-$1-#" $OUTFILE_TBENCH.res    138         grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg des perf:" | awk '{print $NF}' > $OUTFILE_TBENCH-des-perf-$1.log
139         avg_des_perf=$(awk 'BEGIN {sum=0};{sum    139         avg_des_perf=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_TBENCH-des-perf-$1.log)
140         printf "Tbench-$1 avg des perf: $avg_d    140         printf "Tbench-$1 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_TBENCH.result
141                                                   141 
142         grep "Tbench-$1-#" $OUTFILE_TBENCH.res    142         grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg freq:" | awk '{print $NF}' > $OUTFILE_TBENCH-freq-$1.log
143         avg_freq=$(awk 'BEGIN {sum=0};{sum +=     143         avg_freq=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_TBENCH-freq-$1.log)
144         printf "Tbench-$1 avg freq: $avg_freq\    144         printf "Tbench-$1 avg freq: $avg_freq\n" | tee -a $OUTFILE_TBENCH.result
145                                                   145 
146         grep "Tbench-$1-#" $OUTFILE_TBENCH.res    146         grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg load:" | awk '{print $NF}' > $OUTFILE_TBENCH-load-$1.log
147         avg_load=$(awk 'BEGIN {sum=0};{sum +=     147         avg_load=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_TBENCH-load-$1.log)
148         printf "Tbench-$1 avg load: $avg_load\    148         printf "Tbench-$1 avg load: $avg_load\n" | tee -a $OUTFILE_TBENCH.result
149                                                   149 
150         grep "Tbench-$1-#" $OUTFILE_TBENCH.res    150         grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "throughput(MB/s):" | awk '{print $NF}' > $OUTFILE_TBENCH-throughput-$1.log
151         tp_sum=$(awk 'BEGIN {sum=0};{sum += $1    151         tp_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_TBENCH-throughput-$1.log)
152         printf "Tbench-$1 total throughput(MB/    152         printf "Tbench-$1 total throughput(MB/s): $tp_sum\n" | tee -a $OUTFILE_TBENCH.result
153                                                   153 
154         avg_tp=$(awk 'BEGIN {sum=0};{sum += $1    154         avg_tp=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_TBENCH-throughput-$1.log)
155         printf "Tbench-$1 avg throughput(MB/s)    155         printf "Tbench-$1 avg throughput(MB/s): $avg_tp\n" | tee -a $OUTFILE_TBENCH.result
156                                                   156 
157         grep "Tbench-$1-#" $OUTFILE_TBENCH.res    157         grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "power consumption(J):" | awk '{print $NF}' > $OUTFILE_TBENCH-energy-$1.log
158         en_sum=$(awk 'BEGIN {sum=0};{sum += $1    158         en_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_TBENCH-energy-$1.log)
159         printf "Tbench-$1 total power consumpt    159         printf "Tbench-$1 total power consumption(J): $en_sum\n" | tee -a $OUTFILE_TBENCH.result
160                                                   160 
161         avg_en=$(awk 'BEGIN {sum=0};{sum += $1    161         avg_en=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_TBENCH-energy-$1.log)
162         printf "Tbench-$1 avg power consumptio    162         printf "Tbench-$1 avg power consumption(J): $avg_en\n" | tee -a $OUTFILE_TBENCH.result
163                                                   163 
164         # Permance is throughput per second, d    164         # Permance is throughput per second, denoted T/t, where T is throught rendered in t seconds.
165         # It is well known that P=E/t, where P    165         # It is well known that P=E/t, where P is power measured in watts(W), E is energy measured in joules(J),
166         # and t is time measured in seconds(s)    166         # and t is time measured in seconds(s). This means that performance per watt becomes
167         #       T/t   T/t    T                    167         #       T/t   T/t    T
168         #       --- = --- = ---                   168         #       --- = --- = ---
169         #        P    E/t    E                    169         #        P    E/t    E
170         # with unit given by MB per joule.        170         # with unit given by MB per joule.
171         ppw=`echo "scale=4;($TIME_LIMIT-1)*$av    171         ppw=`echo "scale=4;($TIME_LIMIT-1)*$avg_tp/$avg_en" | bc | awk '{printf "%.4f", $0}'`
172         printf "Tbench-$1 performance per watt    172         printf "Tbench-$1 performance per watt(MB/J): $ppw\n" | tee -a $OUTFILE_TBENCH.result
173         printf "\n" | tee -a $OUTFILE_TBENCH.r    173         printf "\n" | tee -a $OUTFILE_TBENCH.result
174                                                   174 
175         driver_name=`echo $(scaling_name)`        175         driver_name=`echo $(scaling_name)`
176         store_csv_tbench "$driver_name-$1" "Av    176         store_csv_tbench "$driver_name-$1" "Average" $avg_des_perf $avg_freq $avg_load $avg_tp $avg_en $ppw
177 }                                                 177 }
178                                                   178 
179 # $1: base scaling_driver $2: base governor $3    179 # $1: base scaling_driver $2: base governor $3: comparative scaling_driver $4: comparative governor
180 __calc_comp_tbench()                              180 __calc_comp_tbench()
181 {                                                 181 {
182         base=`grep "$1-$2" $OUTFILE_TBENCH.csv    182         base=`grep "$1-$2" $OUTFILE_TBENCH.csv | grep "Average"`
183         comp=`grep "$3-$4" $OUTFILE_TBENCH.csv    183         comp=`grep "$3-$4" $OUTFILE_TBENCH.csv | grep "Average"`
184                                                   184 
185         if [ -n "$base" -a -n "$comp" ]; then     185         if [ -n "$base" -a -n "$comp" ]; then
186                 printf "\n====================    186                 printf "\n==================================================\n" | tee -a $OUTFILE_TBENCH.result
187                 printf "Tbench comparison $1-$    187                 printf "Tbench comparison $1-$2 VS $3-$4" | tee -a $OUTFILE_TBENCH.result
188                 printf "\n====================    188                 printf "\n==================================================\n" | tee -a $OUTFILE_TBENCH.result
189                                                   189 
190                 # get the base values             190                 # get the base values
191                 des_perf_base=`echo "$base" |     191                 des_perf_base=`echo "$base" | awk '{print $3}' | sed s/,//`
192                 freq_base=`echo "$base" | awk     192                 freq_base=`echo "$base" | awk '{print $4}' | sed s/,//`
193                 load_base=`echo "$base" | awk     193                 load_base=`echo "$base" | awk '{print $5}' | sed s/,//`
194                 perf_base=`echo "$base" | awk     194                 perf_base=`echo "$base" | awk '{print $6}' | sed s/,//`
195                 energy_base=`echo "$base" | aw    195                 energy_base=`echo "$base" | awk '{print $7}' | sed s/,//`
196                 ppw_base=`echo "$base" | awk '    196                 ppw_base=`echo "$base" | awk '{print $8}' | sed s/,//`
197                                                   197 
198                 # get the comparative values      198                 # get the comparative values
199                 des_perf_comp=`echo "$comp" |     199                 des_perf_comp=`echo "$comp" | awk '{print $3}' | sed s/,//`
200                 freq_comp=`echo "$comp" | awk     200                 freq_comp=`echo "$comp" | awk '{print $4}' | sed s/,//`
201                 load_comp=`echo "$comp" | awk     201                 load_comp=`echo "$comp" | awk '{print $5}' | sed s/,//`
202                 perf_comp=`echo "$comp" | awk     202                 perf_comp=`echo "$comp" | awk '{print $6}' | sed s/,//`
203                 energy_comp=`echo "$comp" | aw    203                 energy_comp=`echo "$comp" | awk '{print $7}' | sed s/,//`
204                 ppw_comp=`echo "$comp" | awk '    204                 ppw_comp=`echo "$comp" | awk '{print $8}' | sed s/,//`
205                                                   205 
206                 # compare the base and comp va    206                 # compare the base and comp values
207                 des_perf_drop=`echo "scale=4;(    207                 des_perf_drop=`echo "scale=4;($des_perf_comp-$des_perf_base)*100/$des_perf_base" | bc | awk '{printf "%.4f", $0}'`
208                 printf "Tbench-$1 des perf bas    208                 printf "Tbench-$1 des perf base: $des_perf_base comprison: $des_perf_comp percent: $des_perf_drop\n" | tee -a $OUTFILE_TBENCH.result
209                                                   209 
210                 freq_drop=`echo "scale=4;($fre    210                 freq_drop=`echo "scale=4;($freq_comp-$freq_base)*100/$freq_base" | bc | awk '{printf "%.4f", $0}'`
211                 printf "Tbench-$1 freq base: $    211                 printf "Tbench-$1 freq base: $freq_base comprison: $freq_comp percent: $freq_drop\n" | tee -a $OUTFILE_TBENCH.result
212                                                   212 
213                 load_drop=`echo "scale=4;($loa    213                 load_drop=`echo "scale=4;($load_comp-$load_base)*100/$load_base" | bc | awk '{printf "%.4f", $0}'`
214                 printf "Tbench-$1 load base: $    214                 printf "Tbench-$1 load base: $load_base comprison: $load_comp percent: $load_drop\n" | tee -a $OUTFILE_TBENCH.result
215                                                   215 
216                 perf_drop=`echo "scale=4;($per    216                 perf_drop=`echo "scale=4;($perf_comp-$perf_base)*100/$perf_base" | bc | awk '{printf "%.4f", $0}'`
217                 printf "Tbench-$1 perf base: $    217                 printf "Tbench-$1 perf base: $perf_base comprison: $perf_comp percent: $perf_drop\n" | tee -a $OUTFILE_TBENCH.result
218                                                   218 
219                 energy_drop=`echo "scale=4;($e    219                 energy_drop=`echo "scale=4;($energy_comp-$energy_base)*100/$energy_base" | bc | awk '{printf "%.4f", $0}'`
220                 printf "Tbench-$1 energy base:    220                 printf "Tbench-$1 energy base: $energy_base comprison: $energy_comp percent: $energy_drop\n" | tee -a $OUTFILE_TBENCH.result
221                                                   221 
222                 ppw_drop=`echo "scale=4;($ppw_    222                 ppw_drop=`echo "scale=4;($ppw_comp-$ppw_base)*100/$ppw_base" | bc | awk '{printf "%.4f", $0}'`
223                 printf "Tbench-$1 performance     223                 printf "Tbench-$1 performance per watt base: $ppw_base comprison: $ppw_comp percent: $ppw_drop\n" | tee -a $OUTFILE_TBENCH.result
224                 printf "\n" | tee -a $OUTFILE_    224                 printf "\n" | tee -a $OUTFILE_TBENCH.result
225                                                   225 
226                 store_csv_tbench "$1-$2 VS $3-    226                 store_csv_tbench "$1-$2 VS $3-$4" "Comprison(%)" "$des_perf_drop" "$freq_drop" "$load_drop" "$perf_drop" "$energy_drop" "$ppw_drop"
227         fi                                        227         fi
228 }                                                 228 }
229                                                   229 
230 # calculate the comparison(%)                     230 # calculate the comparison(%)
231 calc_comp_tbench()                                231 calc_comp_tbench()
232 {                                                 232 {
233         # acpi-cpufreq-ondemand VS acpi-cpufre    233         # acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil
234         __calc_comp_tbench ${all_scaling_names    234         __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[0]} ${all_scaling_names[0]} ${tbench_governors[1]}
235                                                   235 
236         # amd-pstate-ondemand VS amd-pstate-sc    236         # amd-pstate-ondemand VS amd-pstate-schedutil
237         __calc_comp_tbench ${all_scaling_names    237         __calc_comp_tbench ${all_scaling_names[1]} ${tbench_governors[0]} ${all_scaling_names[1]} ${tbench_governors[1]}
238                                                   238 
239         # acpi-cpufreq-ondemand VS amd-pstate-    239         # acpi-cpufreq-ondemand VS amd-pstate-ondemand
240         __calc_comp_tbench ${all_scaling_names    240         __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[0]} ${all_scaling_names[1]} ${tbench_governors[0]}
241                                                   241 
242         # acpi-cpufreq-schedutil VS amd-pstate    242         # acpi-cpufreq-schedutil VS amd-pstate-schedutil
243         __calc_comp_tbench ${all_scaling_names    243         __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[1]} ${all_scaling_names[1]} ${tbench_governors[1]}
244 }                                                 244 }
245                                                   245 
246 # $1: file_name, $2: title, $3: ylable, $4: co    246 # $1: file_name, $2: title, $3: ylable, $4: column
247 plot_png_tbench()                                 247 plot_png_tbench()
248 {                                                 248 {
249         # all_scaling_names[1] all_scaling_nam    249         # all_scaling_names[1] all_scaling_names[0] flag
250         #    amd-pstate           acpi-cpufreq    250         #    amd-pstate           acpi-cpufreq
251         #         N                   N           251         #         N                   N             0
252         #         N                   Y           252         #         N                   Y             1
253         #         Y                   N           253         #         Y                   N             2
254         #         Y                   Y           254         #         Y                   Y             3
255         ret=`grep -c "${all_scaling_names[1]}"    255         ret=`grep -c "${all_scaling_names[1]}" $OUTFILE_TBENCH.csv`
256         if [ $ret -eq 0 ]; then                   256         if [ $ret -eq 0 ]; then
257                 ret=`grep -c "${all_scaling_na    257                 ret=`grep -c "${all_scaling_names[0]}" $OUTFILE_TBENCH.csv`
258                 if [ $ret -eq 0 ]; then           258                 if [ $ret -eq 0 ]; then
259                         flag=0                    259                         flag=0
260                 else                              260                 else
261                         flag=1                    261                         flag=1
262                 fi                                262                 fi
263         else                                      263         else
264                 ret=`grep -c "${all_scaling_na    264                 ret=`grep -c "${all_scaling_names[0]}" $OUTFILE_TBENCH.csv`
265                 if [ $ret -eq 0 ]; then           265                 if [ $ret -eq 0 ]; then
266                         flag=2                    266                         flag=2
267                 else                              267                 else
268                         flag=3                    268                         flag=3
269                 fi                                269                 fi
270         fi                                        270         fi
271                                                   271 
272         gnuplot << EOF                            272         gnuplot << EOF
273                 set term png                      273                 set term png
274                 set output "$1"                   274                 set output "$1"
275                                                   275 
276                 set title "$2"                    276                 set title "$2"
277                 set xlabel "Test Cycles (round    277                 set xlabel "Test Cycles (round)"
278                 set ylabel "$3"                   278                 set ylabel "$3"
279                                                   279 
280                 set grid                          280                 set grid
281                 set style data histogram          281                 set style data histogram
282                 set style fill solid 0.5 borde    282                 set style fill solid 0.5 border
283                 set boxwidth 0.8                  283                 set boxwidth 0.8
284                                                   284 
285                 if ($flag == 1) {                 285                 if ($flag == 1) {
286                         plot \                    286                         plot \
287                         "<(sed -n -e 's/,//g'     287                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[0]}", \
288                         "<(sed -n -e 's/,//g'     288                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[1]}"
289                 } else {                          289                 } else {
290                         if ($flag == 2) {         290                         if ($flag == 2) {
291                                 plot \            291                                 plot \
292                                 "<(sed -n -e '    292                                 "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[0]}", \
293                                 "<(sed -n -e '    293                                 "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[1]}"
294                         } else {                  294                         } else {
295                                 if ($flag == 3    295                                 if ($flag == 3 ) {
296                                         plot \    296                                         plot \
297                                         "<(sed    297                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[0]}", \
298                                         "<(sed    298                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[1]}", \
299                                         "<(sed    299                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[0]}", \
300                                         "<(sed    300                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[1]}"
301                                 }                 301                                 }
302                         }                         302                         }
303                 }                                 303                 }
304                 quit                              304                 quit
305 EOF                                               305 EOF
306 }                                                 306 }
307                                                   307 
308 amd_pstate_tbench()                               308 amd_pstate_tbench()
309 {                                                 309 {
310         printf "\n----------------------------    310         printf "\n---------------------------------------------\n"
311         printf "*** Running tbench                311         printf "*** Running tbench                        ***"
312         printf "\n----------------------------    312         printf "\n---------------------------------------------\n"
313                                                   313 
314         pre_clear_tbench                          314         pre_clear_tbench
315                                                   315 
316         get_lines_csv_tbench "Governor"           316         get_lines_csv_tbench "Governor"
317         if [ $? -eq 0 ]; then                     317         if [ $? -eq 0 ]; then
318                 # add titles and unit for csv     318                 # add titles and unit for csv file
319                 store_csv_tbench "Governor" "R    319                 store_csv_tbench "Governor" "Round" "Des-perf" "Freq" "Load" "Performance" "Energy" "Performance Per Watt"
320                 store_csv_tbench "Unit" "" ""     320                 store_csv_tbench "Unit" "" "" "GHz" "" "MB/s" "J" "MB/J"
321         fi                                        321         fi
322                                                   322 
323         backup_governor                           323         backup_governor
324         for governor in ${tbench_governors[*]}    324         for governor in ${tbench_governors[*]} ; do
325                 printf "\nSpecified governor i    325                 printf "\nSpecified governor is $governor\n\n"
326                 switch_governor $governor         326                 switch_governor $governor
327                 loop_tbench $governor             327                 loop_tbench $governor
328                 gather_tbench $governor           328                 gather_tbench $governor
329         done                                      329         done
330         restore_governor                          330         restore_governor
331                                                   331 
332         plot_png_tbench "tbench_perfromance.pn    332         plot_png_tbench "tbench_perfromance.png" "Tbench Benchmark Performance" "Performance" 6
333         plot_png_tbench "tbench_energy.png" "T    333         plot_png_tbench "tbench_energy.png" "Tbench Benchmark Energy" "Energy (J)" 7
334         plot_png_tbench "tbench_ppw.png" "Tben    334         plot_png_tbench "tbench_ppw.png" "Tbench Benchmark Performance Per Watt" "Performance Per Watt (MB/J)" 8
335                                                   335 
336         calc_comp_tbench                          336         calc_comp_tbench
337                                                   337 
338         post_clear_tbench                         338         post_clear_tbench
339 }                                                 339 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php