#!/bin/bash # # run ust benchmark # iters=20 NR_EVENTS=7000000 NR_CPUS=1 TIME="./ptime" #PROG_NOMARKER="find /usr" PROG_NOMARKER="./bench1 $NR_CPUS $NR_EVENTS" #PROG_MARKER=$PROG_NOMARKER PROG_MARKER="./bench2 $NR_CPUS $NR_EVENTS" CMD_NOMARKER="$TIME '$PROG_NOMARKER >/dev/null 2>&1'" CMD_MARKER="$TIME '$PROG_MARKER >/dev/null 2>&1'" CMD_MARKERCONN="UST_AUTOPROBE=1 $TIME '$PROG_MARKER >/dev/null 2>&1'" CMD_MARKERTRACE="UST_TRACE=1 UST_AUTOPROBE=1 UST_OVERWRITE=1 UST_AUTOCOLLECT=0 $TIME '$PROG_MARKER >/dev/null 2>&1'" echo "ust benchmark" rm -f result-*.txt average-*.txt perevent-*.txt echo "using $NR_CPUS processor(s)" echo "using $NR_EVENTS events per cpu" n=0 while [ $n -lt "$iters" ]; do # without markers echo ">running without markers" echo 3 >/proc/sys/vm/drop_caches t1=$(sh -c "$CMD_NOMARKER") echo "$t1" >>result-nomark.txt echo " time=$t1 sec" n=$(($n+1)) done ./average average-nomark.txt ## with markers, not connected #n=0 #while [ $n -lt "$iters" ]; do # echo ">running with markers, not connected" # echo 3 >/proc/sys/vm/drop_caches # t2=$(sh -c "$CMD_MARKER") # echo "$t2" >>result-mark.txt # echo " time=$t2 sec" # n=$(($n+1)) #done #./average average-mark.txt #echo "( $(perevent-mark.txt ## with markers, connected #n=0 #while [ $n -lt "$iters" ]; do # echo ">running with markers activated" # echo 3 >/proc/sys/vm/drop_caches # t2=$(sh -c "$CMD_MARKERCONN") # echo "$t2" >>result-markconn.txt # echo " time=$t2 sec" # n=$(($n+1)) #done #./average average-markconn.txt #echo "( $(perevent-markconn.txt # with markers, connected, tracing n=0 while [ $n -lt "$iters" ]; do echo ">running with markers activated, trace recording" echo 3 >/proc/sys/vm/drop_caches t3=$(sh -c "$CMD_MARKERTRACE") echo "$t3" >>result-marktrace.txt echo " time=$t3 sec" n=$(($n+1)) done ./average average-marktrace.txt echo "( $(perevent-marktrace.txt function print_penalty() { echo "" #penalty = t2 - t1 penalty=$(echo "$2 - $1;" | bc) echo "Penalty ($3) = $penalty sec" #event = penalty / (nr_events * nr_cpus) event=$(echo "scale=10; ($penalty / ($NR_EVENTS * $NR_CPUS));" | bc) echo "Penalty per event ($3) = $event sec" } #print_penalty $t1 $t2 "Penalty for markers enabled, not tracing" #print_penalty $t1 $t3 "Penalty for markers enabled, tracing" rm -f /tmp/bench.txt