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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/amd-pstate/gitsource.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/gitsource.sh (Version linux-6.12-rc7) and /tools/testing/selftests/amd-pstate/gitsource.sh (Version linux-6.5.13)


  1 #!/bin/bash                                    !!   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 t      5 # power consumption and throughput etc. when this script trigger
  6 # gitsource test.                                   6 # gitsource test.
  7 # 1) Download and tar gitsource codes.              7 # 1) Download and tar gitsource codes.
  8 # 2) Run gitsource benchmark on specific gover      8 # 2) Run gitsource benchmark on specific governors, ondemand or schedutil.
  9 # 3) Run tbench benchmark comparative test on       9 # 3) Run tbench benchmark comparative test on acpi-cpufreq kernel driver.
 10 # 4) Get desire performance, frequency, load b     10 # 4) Get desire performance, frequency, load by perf.
 11 # 5) Get power consumption and throughput by a     11 # 5) Get power consumption and throughput by amd_pstate_trace.py.
 12 # 6) Get run time by /usr/bin/time.                12 # 6) Get run time by /usr/bin/time.
 13 # 7) Analyse test results and save it in file      13 # 7) Analyse test results and save it in file selftest.gitsource.csv.
 14 #8) Plot png images about time, energy and per     14 #8) Plot png images about time, energy and performance per watt for each test.
 15                                                    15 
 16 # protect against multiple inclusion               16 # protect against multiple inclusion
 17 if [ $FILE_GITSOURCE ]; then                       17 if [ $FILE_GITSOURCE ]; then
 18         return 0                                   18         return 0
 19 else                                               19 else
 20         FILE_GITSOURCE=DONE                        20         FILE_GITSOURCE=DONE
 21 fi                                                 21 fi
 22                                                    22 
 23 git_name="git-2.15.1"                              23 git_name="git-2.15.1"
 24 git_tar="$git_name.tar.gz"                         24 git_tar="$git_name.tar.gz"
 25 gitsource_url="https://github.com/git/git/arch     25 gitsource_url="https://github.com/git/git/archive/refs/tags/v2.15.1.tar.gz"
 26 gitsource_governors=("ondemand" "schedutil")       26 gitsource_governors=("ondemand" "schedutil")
 27                                                    27 
 28 # $1: governor, $2: round, $3: des-perf, $4: f     28 # $1: governor, $2: round, $3: des-perf, $4: freq, $5: load, $6: time $7: energy, $8: PPW
 29 store_csv_gitsource()                              29 store_csv_gitsource()
 30 {                                                  30 {
 31         echo "$1, $2, $3, $4, $5, $6, $7, $8"      31         echo "$1, $2, $3, $4, $5, $6, $7, $8" | tee -a $OUTFILE_GIT.csv > /dev/null 2>&1
 32 }                                                  32 }
 33                                                    33 
 34 # clear some special lines                         34 # clear some special lines
 35 clear_csv_gitsource()                              35 clear_csv_gitsource()
 36 {                                                  36 {
 37         if [ -f $OUTFILE_GIT.csv ]; then           37         if [ -f $OUTFILE_GIT.csv ]; then
 38                 sed -i '/Comprison(%)/d' $OUTF     38                 sed -i '/Comprison(%)/d' $OUTFILE_GIT.csv
 39                 sed -i "/$(scaling_name)/d" $O     39                 sed -i "/$(scaling_name)/d" $OUTFILE_GIT.csv
 40         fi                                         40         fi
 41 }                                                  41 }
 42                                                    42 
 43 # find string $1 in file csv and get the numbe     43 # find string $1 in file csv and get the number of lines
 44 get_lines_csv_gitsource()                          44 get_lines_csv_gitsource()
 45 {                                                  45 {
 46         if [ -f $OUTFILE_GIT.csv ]; then           46         if [ -f $OUTFILE_GIT.csv ]; then
 47                 return `grep -c "$1" $OUTFILE_     47                 return `grep -c "$1" $OUTFILE_GIT.csv`
 48         else                                       48         else
 49                 return 0                           49                 return 0
 50         fi                                         50         fi
 51 }                                                  51 }
 52                                                    52 
 53 pre_clear_gitsource()                              53 pre_clear_gitsource()
 54 {                                                  54 {
 55         post_clear_gitsource                       55         post_clear_gitsource
 56         rm -rf gitsource_*.png                     56         rm -rf gitsource_*.png
 57         clear_csv_gitsource                        57         clear_csv_gitsource
 58 }                                                  58 }
 59                                                    59 
 60 post_clear_gitsource()                             60 post_clear_gitsource()
 61 {                                                  61 {
 62         rm -rf results/tracer-gitsource*           62         rm -rf results/tracer-gitsource*
 63         rm -rf $OUTFILE_GIT*.log                   63         rm -rf $OUTFILE_GIT*.log
 64         rm -rf $OUTFILE_GIT*.result                64         rm -rf $OUTFILE_GIT*.result
 65 }                                                  65 }
 66                                                    66 
 67 install_gitsource()                                67 install_gitsource()
 68 {                                                  68 {
 69         if [ ! -d $SCRIPTDIR/$git_name ]; then !!  69         if [ ! -d $git_name ]; then
 70                 pushd $(pwd) > /dev/null 2>&1  << 
 71                 cd $SCRIPTDIR                  << 
 72                 printf "Download gitsource, pl     70                 printf "Download gitsource, please wait a moment ...\n\n"
 73                 wget -O $git_tar $gitsource_ur     71                 wget -O $git_tar $gitsource_url > /dev/null 2>&1
 74                                                    72 
 75                 printf "Tar gitsource ...\n\n"     73                 printf "Tar gitsource ...\n\n"
 76                 tar -xzf $git_tar                  74                 tar -xzf $git_tar
 77                 popd > /dev/null 2>&1          << 
 78         fi                                         75         fi
 79 }                                                  76 }
 80                                                    77 
 81 # $1: governor, $2: loop                           78 # $1: governor, $2: loop
 82 run_gitsource()                                    79 run_gitsource()
 83 {                                                  80 {
 84         echo "Launching amd pstate tracer for      81         echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INTERVAL"
 85         $TRACER -n tracer-gitsource-$1-$2 -i $ !!  82         ./amd_pstate_trace.py -n tracer-gitsource-$1-$2 -i $TRACER_INTERVAL > /dev/null 2>&1 &
 86                                                    83 
 87         printf "Make and test gitsource for $1     84         printf "Make and test gitsource for $1 #$2 make_cpus: $MAKE_CPUS\n"
 88         BACKUP_DIR=$(pwd)                      !!  85         cd $git_name
 89         pushd $BACKUP_DIR > /dev/null 2>&1     !!  86         perf stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o ../$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > ../$OUTFILE_GIT-perf-$1-$2.log 2>&1
 90         cd $SCRIPTDIR/$git_name                !!  87         cd ..
 91         $PERF stat -a --per-socket -I 1000 -e  << 
 92         popd > /dev/null 2>&1                  << 
 93                                                    88 
 94         for job in `jobs -p`                       89         for job in `jobs -p`
 95         do                                         90         do
 96                 echo "Waiting for job id $job"     91                 echo "Waiting for job id $job"
 97                 wait $job                          92                 wait $job
 98         done                                       93         done
 99 }                                                  94 }
100                                                    95 
101 # $1: governor, $2: loop                           96 # $1: governor, $2: loop
102 parse_gitsource()                                  97 parse_gitsource()
103 {                                                  98 {
104         awk '{print $5}' results/tracer-gitsou     99         awk '{print $5}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_GIT-des-perf-$1-$2.log
105         avg_des_perf=$(awk 'BEGIN {i=0; sum=0}    100         avg_des_perf=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_GIT-des-perf-$1-$2.log)
106         printf "Gitsource-$1-#$2 avg des perf:    101         printf "Gitsource-$1-#$2 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_GIT.result
107                                                   102 
108         awk '{print $7}' results/tracer-gitsou    103         awk '{print $7}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_GIT-freq-$1-$2.log
109         avg_freq=$(awk 'BEGIN {i=0; sum=0};{i+    104         avg_freq=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_GIT-freq-$1-$2.log)
110         printf "Gitsource-$1-#$2 avg freq: $av    105         printf "Gitsource-$1-#$2 avg freq: $avg_freq\n" | tee -a $OUTFILE_GIT.result
111                                                   106 
112         awk '{print $11}' results/tracer-gitso    107         awk '{print $11}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | sed s/,// > $OUTFILE_GIT-load-$1-$2.log
113         avg_load=$(awk 'BEGIN {i=0; sum=0};{i+    108         avg_load=$(awk 'BEGIN {i=0; sum=0};{i++; sum += $1};END {print sum/i}' $OUTFILE_GIT-load-$1-$2.log)
114         printf "Gitsource-$1-#$2 avg load: $av    109         printf "Gitsource-$1-#$2 avg load: $avg_load\n" | tee -a $OUTFILE_GIT.result
115                                                   110 
116         grep user $OUTFILE_GIT.time-gitsource-    111         grep user $OUTFILE_GIT.time-gitsource-$1-$2.log | awk '{print $1}' | sed -e 's/user//' > $OUTFILE_GIT-time-$1-$2.log
117         time_sum=$(awk 'BEGIN {sum=0};{sum +=     112         time_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_GIT-time-$1-$2.log)
118         printf "Gitsource-$1-#$2 user time(s):    113         printf "Gitsource-$1-#$2 user time(s): $time_sum\n" | tee -a $OUTFILE_GIT.result
119                                                   114 
120         grep Joules $OUTFILE_GIT-perf-$1-$2.lo    115         grep Joules $OUTFILE_GIT-perf-$1-$2.log | awk '{print $4}' > $OUTFILE_GIT-energy-$1-$2.log
121         en_sum=$(awk 'BEGIN {sum=0};{sum += $1    116         en_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_GIT-energy-$1-$2.log)
122         printf "Gitsource-$1-#$2 power consump    117         printf "Gitsource-$1-#$2 power consumption(J): $en_sum\n" | tee -a $OUTFILE_GIT.result
123                                                   118 
124         # Permance is the number of run gitsou    119         # Permance is the number of run gitsource per second, denoted 1/t, where 1 is the number of run gitsource in t
125         # seconds. It is well known that P=E/t    120         # seconds. It is well known that P=E/t, where P is power measured in watts(W), E is energy measured in joules(J),
126         # and t is time measured in seconds(s)    121         # and t is time measured in seconds(s). This means that performance per watt becomes
127         #        1/t     1/t     1                122         #        1/t     1/t     1
128         #       ----- = ----- = ---               123         #       ----- = ----- = ---
129         #         P      E/t     E                124         #         P      E/t     E
130         # with unit given by 1 per joule.         125         # with unit given by 1 per joule.
131         ppw=`echo "scale=9;1/$en_sum" | bc | a    126         ppw=`echo "scale=9;1/$en_sum" | bc | awk '{printf "%.9f", $0}'`
132         printf "Gitsource-$1-#$2 performance p    127         printf "Gitsource-$1-#$2 performance per watt(1/J): $ppw\n" | tee -a $OUTFILE_GIT.result
133         printf "\n" | tee -a $OUTFILE_GIT.resu    128         printf "\n" | tee -a $OUTFILE_GIT.result
134                                                   129 
135         driver_name=`echo $(scaling_name)`        130         driver_name=`echo $(scaling_name)`
136         store_csv_gitsource "$driver_name-$1"     131         store_csv_gitsource "$driver_name-$1" $2 $avg_des_perf $avg_freq $avg_load $time_sum $en_sum $ppw
137 }                                                 132 }
138                                                   133 
139 # $1: governor                                    134 # $1: governor
140 loop_gitsource()                                  135 loop_gitsource()
141 {                                                 136 {
142         printf "\nGitsource total test times i    137         printf "\nGitsource total test times is $LOOP_TIMES for $1\n\n"
143         for i in `seq 1 $LOOP_TIMES`              138         for i in `seq 1 $LOOP_TIMES`
144         do                                        139         do
145                 run_gitsource $1 $i               140                 run_gitsource $1 $i
146                 parse_gitsource $1 $i             141                 parse_gitsource $1 $i
147         done                                      142         done
148 }                                                 143 }
149                                                   144 
150 # $1: governor                                    145 # $1: governor
151 gather_gitsource()                                146 gather_gitsource()
152 {                                                 147 {
153         printf "Gitsource test result for $1 (    148         printf "Gitsource test result for $1 (loops:$LOOP_TIMES)" | tee -a $OUTFILE_GIT.result
154         printf "\n----------------------------    149         printf "\n--------------------------------------------------\n" | tee -a $OUTFILE_GIT.result
155                                                   150 
156         grep "Gitsource-$1-#" $OUTFILE_GIT.res    151         grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg des perf:" | awk '{print $NF}' > $OUTFILE_GIT-des-perf-$1.log
157         avg_des_perf=$(awk 'BEGIN {sum=0};{sum    152         avg_des_perf=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_GIT-des-perf-$1.log)
158         printf "Gitsource-$1 avg des perf: $av    153         printf "Gitsource-$1 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_GIT.result
159                                                   154 
160         grep "Gitsource-$1-#" $OUTFILE_GIT.res    155         grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg freq:" | awk '{print $NF}' > $OUTFILE_GIT-freq-$1.log
161         avg_freq=$(awk 'BEGIN {sum=0};{sum +=     156         avg_freq=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_GIT-freq-$1.log)
162         printf "Gitsource-$1 avg freq: $avg_fr    157         printf "Gitsource-$1 avg freq: $avg_freq\n" | tee -a $OUTFILE_GIT.result
163                                                   158 
164         grep "Gitsource-$1-#" $OUTFILE_GIT.res    159         grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg load:" | awk '{print $NF}' > $OUTFILE_GIT-load-$1.log
165         avg_load=$(awk 'BEGIN {sum=0};{sum +=     160         avg_load=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_GIT-load-$1.log)
166         printf "Gitsource-$1 avg load: $avg_lo    161         printf "Gitsource-$1 avg load: $avg_load\n" | tee -a $OUTFILE_GIT.result
167                                                   162 
168         grep "Gitsource-$1-#" $OUTFILE_GIT.res    163         grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "user time(s):" | awk '{print $NF}' > $OUTFILE_GIT-time-$1.log
169         time_sum=$(awk 'BEGIN {sum=0};{sum +=     164         time_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_GIT-time-$1.log)
170         printf "Gitsource-$1 total user time(s    165         printf "Gitsource-$1 total user time(s): $time_sum\n" | tee -a $OUTFILE_GIT.result
171                                                   166 
172         avg_time=$(awk 'BEGIN {sum=0};{sum +=     167         avg_time=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_GIT-time-$1.log)
173         printf "Gitsource-$1 avg user times(s)    168         printf "Gitsource-$1 avg user times(s): $avg_time\n" | tee -a $OUTFILE_GIT.result
174                                                   169 
175         grep "Gitsource-$1-#" $OUTFILE_GIT.res    170         grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "power consumption(J):" | awk '{print $NF}' > $OUTFILE_GIT-energy-$1.log
176         en_sum=$(awk 'BEGIN {sum=0};{sum += $1    171         en_sum=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum}' $OUTFILE_GIT-energy-$1.log)
177         printf "Gitsource-$1 total power consu    172         printf "Gitsource-$1 total power consumption(J): $en_sum\n" | tee -a $OUTFILE_GIT.result
178                                                   173 
179         avg_en=$(awk 'BEGIN {sum=0};{sum += $1    174         avg_en=$(awk 'BEGIN {sum=0};{sum += $1};END {print sum/'$LOOP_TIMES'}' $OUTFILE_GIT-energy-$1.log)
180         printf "Gitsource-$1 avg power consump    175         printf "Gitsource-$1 avg power consumption(J): $avg_en\n" | tee -a $OUTFILE_GIT.result
181                                                   176 
182         # Permance is the number of run gitsou    177         # Permance is the number of run gitsource per second, denoted 1/t, where 1 is the number of run gitsource in t
183         # seconds. It is well known that P=E/t    178         # seconds. It is well known that P=E/t, where P is power measured in watts(W), E is energy measured in joules(J),
184         # and t is time measured in seconds(s)    179         # and t is time measured in seconds(s). This means that performance per watt becomes
185         #        1/t     1/t     1                180         #        1/t     1/t     1
186         #       ----- = ----- = ---               181         #       ----- = ----- = ---
187         #         P      E/t     E                182         #         P      E/t     E
188         # with unit given by 1 per joule.         183         # with unit given by 1 per joule.
189         ppw=`echo "scale=9;1/$avg_en" | bc | a    184         ppw=`echo "scale=9;1/$avg_en" | bc | awk '{printf "%.9f", $0}'`
190         printf "Gitsource-$1 performance per w    185         printf "Gitsource-$1 performance per watt(1/J): $ppw\n" | tee -a $OUTFILE_GIT.result
191         printf "\n" | tee -a $OUTFILE_GIT.resu    186         printf "\n" | tee -a $OUTFILE_GIT.result
192                                                   187 
193         driver_name=`echo $(scaling_name)`        188         driver_name=`echo $(scaling_name)`
194         store_csv_gitsource "$driver_name-$1"     189         store_csv_gitsource "$driver_name-$1" "Average" $avg_des_perf $avg_freq $avg_load $avg_time $avg_en $ppw
195 }                                                 190 }
196                                                   191 
197 # $1: base scaling_driver $2: base governor $3    192 # $1: base scaling_driver $2: base governor $3: comparison scaling_driver $4: comparison governor
198 __calc_comp_gitsource()                           193 __calc_comp_gitsource()
199 {                                                 194 {
200         base=`grep "$1-$2" $OUTFILE_GIT.csv |     195         base=`grep "$1-$2" $OUTFILE_GIT.csv | grep "Average"`
201         comp=`grep "$3-$4" $OUTFILE_GIT.csv |     196         comp=`grep "$3-$4" $OUTFILE_GIT.csv | grep "Average"`
202                                                   197 
203         if [ -n "$base" -a -n "$comp" ]; then     198         if [ -n "$base" -a -n "$comp" ]; then
204                 printf "\n====================    199                 printf "\n==================================================\n" | tee -a $OUTFILE_GIT.result
205                 printf "Gitsource comparison $    200                 printf "Gitsource comparison $1-$2 VS $3-$4" | tee -a $OUTFILE_GIT.result
206                 printf "\n====================    201                 printf "\n==================================================\n" | tee -a $OUTFILE_GIT.result
207                                                   202 
208                 # get the base values             203                 # get the base values
209                 des_perf_base=`echo "$base" |     204                 des_perf_base=`echo "$base" | awk '{print $3}' | sed s/,//`
210                 freq_base=`echo "$base" | awk     205                 freq_base=`echo "$base" | awk '{print $4}' | sed s/,//`
211                 load_base=`echo "$base" | awk     206                 load_base=`echo "$base" | awk '{print $5}' | sed s/,//`
212                 time_base=`echo "$base" | awk     207                 time_base=`echo "$base" | awk '{print $6}' | sed s/,//`
213                 energy_base=`echo "$base" | aw    208                 energy_base=`echo "$base" | awk '{print $7}' | sed s/,//`
214                 ppw_base=`echo "$base" | awk '    209                 ppw_base=`echo "$base" | awk '{print $8}' | sed s/,//`
215                                                   210 
216                 # get the comparison values       211                 # get the comparison values
217                 des_perf_comp=`echo "$comp" |     212                 des_perf_comp=`echo "$comp" | awk '{print $3}' | sed s/,//`
218                 freq_comp=`echo "$comp" | awk     213                 freq_comp=`echo "$comp" | awk '{print $4}' | sed s/,//`
219                 load_comp=`echo "$comp" | awk     214                 load_comp=`echo "$comp" | awk '{print $5}' | sed s/,//`
220                 time_comp=`echo "$comp" | awk     215                 time_comp=`echo "$comp" | awk '{print $6}' | sed s/,//`
221                 energy_comp=`echo "$comp" | aw    216                 energy_comp=`echo "$comp" | awk '{print $7}' | sed s/,//`
222                 ppw_comp=`echo "$comp" | awk '    217                 ppw_comp=`echo "$comp" | awk '{print $8}' | sed s/,//`
223                                                   218 
224                 # compare the base and comp va    219                 # compare the base and comp values
225                 des_perf_drop=`echo "scale=4;(    220                 des_perf_drop=`echo "scale=4;($des_perf_comp-$des_perf_base)*100/$des_perf_base" | bc | awk '{printf "%.4f", $0}'`
226                 printf "Gitsource-$1 des perf     221                 printf "Gitsource-$1 des perf base: $des_perf_base comprison: $des_perf_comp percent: $des_perf_drop\n" | tee -a $OUTFILE_GIT.result
227                                                   222 
228                 freq_drop=`echo "scale=4;($fre    223                 freq_drop=`echo "scale=4;($freq_comp-$freq_base)*100/$freq_base" | bc | awk '{printf "%.4f", $0}'`
229                 printf "Gitsource-$1 freq base    224                 printf "Gitsource-$1 freq base: $freq_base comprison: $freq_comp percent: $freq_drop\n" | tee -a $OUTFILE_GIT.result
230                                                   225 
231                 load_drop=`echo "scale=4;($loa    226                 load_drop=`echo "scale=4;($load_comp-$load_base)*100/$load_base" | bc | awk '{printf "%.4f", $0}'`
232                 printf "Gitsource-$1 load base    227                 printf "Gitsource-$1 load base: $load_base comprison: $load_comp percent: $load_drop\n" | tee -a $OUTFILE_GIT.result
233                                                   228 
234                 time_drop=`echo "scale=4;($tim    229                 time_drop=`echo "scale=4;($time_comp-$time_base)*100/$time_base" | bc | awk '{printf "%.4f", $0}'`
235                 printf "Gitsource-$1 time base    230                 printf "Gitsource-$1 time base: $time_base comprison: $time_comp percent: $time_drop\n" | tee -a $OUTFILE_GIT.result
236                                                   231 
237                 energy_drop=`echo "scale=4;($e    232                 energy_drop=`echo "scale=4;($energy_comp-$energy_base)*100/$energy_base" | bc | awk '{printf "%.4f", $0}'`
238                 printf "Gitsource-$1 energy ba    233                 printf "Gitsource-$1 energy base: $energy_base comprison: $energy_comp percent: $energy_drop\n" | tee -a $OUTFILE_GIT.result
239                                                   234 
240                 ppw_drop=`echo "scale=4;($ppw_    235                 ppw_drop=`echo "scale=4;($ppw_comp-$ppw_base)*100/$ppw_base" | bc | awk '{printf "%.4f", $0}'`
241                 printf "Gitsource-$1 performan    236                 printf "Gitsource-$1 performance per watt base: $ppw_base comprison: $ppw_comp percent: $ppw_drop\n" | tee -a $OUTFILE_GIT.result
242                 printf "\n" | tee -a $OUTFILE_    237                 printf "\n" | tee -a $OUTFILE_GIT.result
243                                                   238 
244                 store_csv_gitsource "$1-$2 VS     239                 store_csv_gitsource "$1-$2 VS $3-$4" "Comprison(%)" "$des_perf_drop" "$freq_drop" "$load_drop" "$time_drop" "$energy_drop" "$ppw_drop"
245         fi                                        240         fi
246 }                                                 241 }
247                                                   242 
248 # calculate the comparison(%)                     243 # calculate the comparison(%)
249 calc_comp_gitsource()                             244 calc_comp_gitsource()
250 {                                                 245 {
251         # acpi-cpufreq-ondemand VS acpi-cpufre    246         # acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil
252         __calc_comp_gitsource ${all_scaling_na    247         __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[0]} ${all_scaling_names[0]} ${gitsource_governors[1]}
253                                                   248 
254         # amd-pstate-ondemand VS amd-pstate-sc    249         # amd-pstate-ondemand VS amd-pstate-schedutil
255         __calc_comp_gitsource ${all_scaling_na    250         __calc_comp_gitsource ${all_scaling_names[1]} ${gitsource_governors[0]} ${all_scaling_names[1]} ${gitsource_governors[1]}
256                                                   251 
257         # acpi-cpufreq-ondemand VS amd-pstate-    252         # acpi-cpufreq-ondemand VS amd-pstate-ondemand
258         __calc_comp_gitsource ${all_scaling_na    253         __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[0]} ${all_scaling_names[1]} ${gitsource_governors[0]}
259                                                   254 
260         # acpi-cpufreq-schedutil VS amd-pstate    255         # acpi-cpufreq-schedutil VS amd-pstate-schedutil
261         __calc_comp_gitsource ${all_scaling_na    256         __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[1]} ${all_scaling_names[1]} ${gitsource_governors[1]}
262 }                                                 257 }
263                                                   258 
264 # $1: file_name, $2: title, $3: ylable, $4: co    259 # $1: file_name, $2: title, $3: ylable, $4: column
265 plot_png_gitsource()                              260 plot_png_gitsource()
266 {                                                 261 {
267         # all_scaling_names[1] all_scaling_nam    262         # all_scaling_names[1] all_scaling_names[0] flag
268         #    amd-pstate           acpi-cpufreq    263         #    amd-pstate           acpi-cpufreq
269         #         N                   N           264         #         N                   N             0
270         #         N                   Y           265         #         N                   Y             1
271         #         Y                   N           266         #         Y                   N             2
272         #         Y                   Y           267         #         Y                   Y             3
273         ret=`grep -c "${all_scaling_names[1]}"    268         ret=`grep -c "${all_scaling_names[1]}" $OUTFILE_GIT.csv`
274         if [ $ret -eq 0 ]; then                   269         if [ $ret -eq 0 ]; then
275                 ret=`grep -c "${all_scaling_na    270                 ret=`grep -c "${all_scaling_names[0]}" $OUTFILE_GIT.csv`
276                 if [ $ret -eq 0 ]; then           271                 if [ $ret -eq 0 ]; then
277                         flag=0                    272                         flag=0
278                 else                              273                 else
279                         flag=1                    274                         flag=1
280                 fi                                275                 fi
281         else                                      276         else
282                 ret=`grep -c "${all_scaling_na    277                 ret=`grep -c "${all_scaling_names[0]}" $OUTFILE_GIT.csv`
283                 if [ $ret -eq 0 ]; then           278                 if [ $ret -eq 0 ]; then
284                         flag=2                    279                         flag=2
285                 else                              280                 else
286                         flag=3                    281                         flag=3
287                 fi                                282                 fi
288         fi                                        283         fi
289                                                   284 
290         gnuplot << EOF                            285         gnuplot << EOF
291                 set term png                      286                 set term png
292                 set output "$1"                   287                 set output "$1"
293                                                   288 
294                 set title "$2"                    289                 set title "$2"
295                 set xlabel "Test Cycles (round    290                 set xlabel "Test Cycles (round)"
296                 set ylabel "$3"                   291                 set ylabel "$3"
297                                                   292 
298                 set grid                          293                 set grid
299                 set style data histogram          294                 set style data histogram
300                 set style fill solid 0.5 borde    295                 set style fill solid 0.5 border
301                 set boxwidth 0.8                  296                 set boxwidth 0.8
302                                                   297 
303                 if ($flag == 1) {                 298                 if ($flag == 1) {
304                         plot \                    299                         plot \
305                         "<(sed -n -e 's/,//g'     300                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${gitsource_governors[0]}", \
306                         "<(sed -n -e 's/,//g'     301                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${gitsource_governors[1]}"
307                 } else {                          302                 } else {
308                         if ($flag == 2) {         303                         if ($flag == 2) {
309                                 plot \            304                                 plot \
310                                 "<(sed -n -e '    305                                 "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${gitsource_governors[0]}", \
311                                 "<(sed -n -e '    306                                 "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${gitsource_governors[1]}"
312                         } else {                  307                         } else {
313                                 if ($flag == 3    308                                 if ($flag == 3 ) {
314                                         plot \    309                                         plot \
315                                         "<(sed    310                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${gitsource_governors[0]}", \
316                                         "<(sed    311                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${gitsource_governors[1]}", \
317                                         "<(sed    312                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${gitsource_governors[0]}", \
318                                         "<(sed    313                                         "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${gitsource_governors[1]}"
319                                 }                 314                                 }
320                         }                         315                         }
321                 }                                 316                 }
322                 quit                              317                 quit
323 EOF                                               318 EOF
324 }                                                 319 }
325                                                   320 
326 amd_pstate_gitsource()                            321 amd_pstate_gitsource()
327 {                                                 322 {
328         printf "\n----------------------------    323         printf "\n---------------------------------------------\n"
329         printf "*** Running gitsource             324         printf "*** Running gitsource                     ***"
330         printf "\n----------------------------    325         printf "\n---------------------------------------------\n"
331                                                   326 
332         pre_clear_gitsource                       327         pre_clear_gitsource
333                                                   328 
334         install_gitsource                         329         install_gitsource
335                                                   330 
336         get_lines_csv_gitsource "Governor"        331         get_lines_csv_gitsource "Governor"
337         if [ $? -eq 0 ]; then                     332         if [ $? -eq 0 ]; then
338                 # add titles and unit for csv     333                 # add titles and unit for csv file
339                 store_csv_gitsource "Governor"    334                 store_csv_gitsource "Governor" "Round" "Des-perf" "Freq" "Load" "Time" "Energy" "Performance Per Watt"
340                 store_csv_gitsource "Unit" ""     335                 store_csv_gitsource "Unit" "" "" "GHz" "" "s" "J" "1/J"
341         fi                                        336         fi
342                                                   337 
343         backup_governor                           338         backup_governor
344         for governor in ${gitsource_governors[    339         for governor in ${gitsource_governors[*]} ; do
345                 printf "\nSpecified governor i    340                 printf "\nSpecified governor is $governor\n\n"
346                 switch_governor $governor         341                 switch_governor $governor
347                 loop_gitsource $governor          342                 loop_gitsource $governor
348                 gather_gitsource $governor        343                 gather_gitsource $governor
349         done                                      344         done
350         restore_governor                          345         restore_governor
351                                                   346 
352         plot_png_gitsource "gitsource_time.png    347         plot_png_gitsource "gitsource_time.png" "Gitsource Benchmark Time" "Time (s)" 6
353         plot_png_gitsource "gitsource_energy.p    348         plot_png_gitsource "gitsource_energy.png" "Gitsource Benchmark Energy" "Energy (J)" 7
354         plot_png_gitsource "gitsource_ppw.png"    349         plot_png_gitsource "gitsource_ppw.png" "Gitsource Benchmark Performance Per Watt" "Performance Per Watt (1/J)" 8
355                                                   350 
356         calc_comp_gitsource                       351         calc_comp_gitsource
357                                                   352 
358         post_clear_gitsource                      353         post_clear_gitsource
359 }                                                 354 }
                                                      

~ [ 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