From: Laurent Mazet Date: Sun, 12 Oct 2025 21:21:18 +0000 (+0200) Subject: take into account of dedicated cpu(s) X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=d65bcc0846af6ec67993d76a8c7aa79c929db72a;p=benchmarks.git take into account of dedicated cpu(s) --- diff --git a/generatecandle.sh b/generatecandle.sh index 93d8c2e..040df9c 100755 --- a/generatecandle.sh +++ b/generatecandle.sh @@ -3,18 +3,29 @@ base=$(cd $(dirname $0); pwd) for csv; do - core="any core" sed 1d $csv | cut -d, -f1 | sort | uniq | while IFS=$'\n' read title; do - name=$($base/getname.sh "$title") + test=$($base/getname.sh "$title") - output=$name.pdf + for dcore in 0 1 2; do - awk -F, '$1 == "'"$title"'" { sub (/[^,]*,/, ""); gsub (/,/, " "); print }' $csv > $name.tab + name=$test-${dcore}k - cat $base/candles.gp | \ - m4 -D CORE="$core" -D DATA="$name.tab" -D TITLE="$title" | \ - gnuplot > "$output" + case "$dcore" in + 0) core="any core";; + 1) core="1 core";; + 2) core="2 cores";; + esac + + awk -F, '$1 == "'"$title"'" && $2 == '$dcore' { sub (/[^,]*,/, ""); gsub (/,/, " "); print }' $csv > $name.tab + if [ -s $name.tab ]; then + cat $base/candles.gp | \ + m4 -D CORE="$core" -D DATA="$name.tab" -D TITLE="$title" | \ + gnuplot > $name.pdf + else + rm -f $name.tab + fi + done done done diff --git a/generatedoc.sh b/generatedoc.sh index 2054852..3181c32 100755 --- a/generatedoc.sh +++ b/generatedoc.sh @@ -8,27 +8,34 @@ echo "" for tab; do - test=$(echo $tab | sed 's/.tab//') + test=$(echo $tab | awk -F'[.-]' '{ print $1 }') + dcore=$(echo $tab | awk -F'[.-]' '{ print $2 }' | sed 's/k//') + title=$($base/getname.sh -r $test) + case $dcore in + 0) core="No dedicated core";; + 1) core="1 dedicated core";; + 2) core="1 dedicated cores";; + esac - echo "

$title

" + echo "

$title - $core

" echo "

Statistic summary

" echo "" echo "" echo "" - awk '{ printf ""; for (i=0; i%s", $(i+1); printf "\n" }' $tab + awk '{ printf ""; for (i=1; i%s", $(i+1); printf "\n" }' $tab echo "" echo "
Load
(%)
Minimum
(us)
Average
(us)
Maximun
(us)
Standard Dev.
(us)
25th %
(us)
Median
(us)
75th %
(us)
" - echo "
" + echo "
" for load in $(cat $tab | cut -f1 -d\ ); do echo "

Measures with load of $load%

" echo "
" - echo "" - echo "" + echo "" + echo "" echo "
" done diff --git a/generateplot.sh b/generateplot.sh index f0d08ea..cc3f4bf 100755 --- a/generateplot.sh +++ b/generateplot.sh @@ -7,7 +7,7 @@ for data; do title=$(awk '/Test:/ { sub(/[^:]*: /, ""); print}' $log) core=$(awk -F: '/Dedicated core/ { print ($2 == 0) ? "any core" : $2 " core" ($2 > 1 ? "s" : "") }' $log) - load=$(echo $data | sed 's/.*-\([0-9]*\)%.*/\1%/') + load=$(awk '/CPU load/ { print $3 }' $log) output=$(echo $data | sed 's/\.dat/-raw.pdf/') cat $base/rawmeasures.gp | \ diff --git a/gettable.awk b/gettable.awk index 478316b..13ecff7 100755 --- a/gettable.awk +++ b/gettable.awk @@ -2,7 +2,9 @@ BEGIN { OFS="," - #print "Test", "Load", "Minimum (us)", "Average (us)", "Maximun (us)", "Standard Dev. (us)", "25th % (us)", "Median (us)", "75th % (us)" + if (!nohead) { + print "Test", "Dedicated core(s)", "Load (%)", "Minimum (us)", "Average (us)", "Maximun (us)", "Standard Dev. (us)", "25th % (us)", "Median (us)", "75th % (us)" + } } /Test:/ { @@ -12,6 +14,8 @@ BEGIN { { sub (/us$/, "") } +/Dedicated/ { dcore=$3 } +/CPU load/ { load=$3 } /Minimum/ { min=$3 } /Maximum/ { max=$3 } /Average/ { avg=$3 } @@ -22,6 +26,5 @@ BEGIN { /75th/ { p75=$4 } /Histogram/ { - print test, COMMENT, min, avg, max, std, p25, med, p75 + print test, dcore, load, min, avg, max, std, p25, med, p75 } -# for p in 0 100; do ./gettable.awk -v COMMENT=$p% test-$p%.log; done > result.csv diff --git a/gettable.sh b/gettable.sh index 910f561..9e5e8d5 100755 --- a/gettable.sh +++ b/gettable.sh @@ -2,14 +2,16 @@ base=$(cd $(dirname $0); pwd) -echo "Test,Load (%),Minimum (us),Average (us),Maximun (us),Standard Dev. (us),25th % (us),Median (us),75th % (us)" +awk '/nohead/ {getline; sub(/print/, ""); gsub (/ *"/, ""); print}' $base/gettable.awk nbcpu=$(grep -c processor /proc/cpuinfo) -for t in *.exe; do - t=$(echo $t | sed 's/\.exe//'); - for k in $(seq 0 $nbcpu); do - p=$(expr $k \* 100 / $nbcpu) - f=$t-$p%.log - [ -f $f ] && awk -f $base/gettable.awk -v COMMENT=$p $f +for exe in *.exe; do + test=$(echo $exe | sed 's/\.exe//'); + for core in $(seq 0 2); do + for cpu in $(seq 0 $nbcpu); do + load=$(expr $cpu \* 100 / $nbcpu) + name=${test}-${core}k-${load}% + [ -f $name.log ] && awk -f $base/gettable.awk -v nohead=1 $name.log + done done done diff --git a/test.sh b/test.sh index 9c871b9..0d52a99 100755 --- a/test.sh +++ b/test.sh @@ -1,15 +1,21 @@ #!/bin/sh +nbcpu=$(grep -c processor /proc/cpuinfo) + run() { - cpu=$1 - load=$2 + dcore=$1 + lcpu=$2 + nbcpu=$3 + load=$(expr $lcpu \* 100 / $nbcpu) for exe in *.exe; do test=$(echo $exe | sed 's/\.exe//') + name=$test-${dcore}k-${load}% echo "\033[0;1mTest $test\033[0;0m" - ./getinfo.sh | tee $test-$load.log - { ./$exe -d 1 -n 10000 -s -o $test-$load.dat | tee -a $test-$load.log; \ + ./getinfo.sh | tee $name.log + echo "CPU load: $load% ($lcpu/$nbcpu)" | tee -a $name.log + { ./$exe -d 1 -k $dcore -n 10000 -s -o $name.dat | tee -a $name.log; \ kill -2 $(ps -e | awk '/[l]oad/ || /[s]leep/ { print $1 }') 2>/dev/null; } & - ./load -n $cpu >/dev/null + ./load -n $lcpu >/dev/null echo "Cleaning..." sleep 1 done @@ -18,8 +24,8 @@ run() { touch purge rm -f purge *.log *.dat -nbcpu=$(grep -c processor /proc/cpuinfo) -for k in $(seq 0 $nbcpu); do - p=$(expr $k \* 100 / $nbcpu) - run $k $p% +for d in 0 1 2; do + for c in $(seq 0 $nbcpu); do + run $d $c $nbcpu + done done