| 1 | #!/bin/bash |
| 2 | # |
| 3 | # run ust benchmark |
| 4 | # |
| 5 | |
| 6 | echo "ust benchmark" |
| 7 | |
| 8 | NR_EVENTS=4000000 |
| 9 | NR_CPUS=2 |
| 10 | echo "using $NR_CPUS processor(s)" |
| 11 | echo "using $NR_EVENTS events per cpu" |
| 12 | |
| 13 | |
| 14 | rm -f /tmp/bench.txt |
| 15 | # without markers |
| 16 | echo ">running without markers" |
| 17 | #t1=$(/usr/bin/time -f%e usttrace ./bench1 $NR_CPUS $NR_EVENTS 2>&1 1> /dev/null) |
| 18 | t1=$(/usr/bin/time -f%e ./bench1 $NR_CPUS $NR_EVENTS 2>&1 1> /dev/null) |
| 19 | echo " time=$t1 sec" |
| 20 | |
| 21 | |
| 22 | rm -f /tmp/bench.txt |
| 23 | # with markers |
| 24 | echo ">running with markers activated" |
| 25 | t2=$(/usr/bin/time -f%e usttrace ./bench2 $NR_CPUS $NR_EVENTS 2>&1 1> /dev/null) |
| 26 | echo " time=$t2 sec" |
| 27 | |
| 28 | |
| 29 | #penalty = t2 - t1 |
| 30 | echo |
| 31 | penalty=$(echo "$t2 - $t1;" | bc) |
| 32 | echo "time penalty=$penalty sec" |
| 33 | |
| 34 | #event = penalty / (nr_events * nr_cpus) |
| 35 | event=$(echo "scale=10; ($penalty / ($NR_EVENTS * $NR_CPUS));" | bc) |
| 36 | echo "time penalty per event=$event sec" |
| 37 | |
| 38 | rm -f /tmp/bench.txt |