Fix some bashism not working on fedora
[benchmarks.git] / ust-systemtap-tracepoints / runtest.sh
1 #!/bin/sh
2
3 # UST vs SystemTap scalability test
4 # This script can run 4 different tests :
5 # - UST in flight recorder mode
6 # - UST writing the trace to disk
7 # - SystemTap in flight recorder mode
8 # - SystemTap writing the trace to disk
9
10 # You need to be root to run the SystemTap tests because of the rmmod
11
12 BINARY=./tracepoint_benchmark
13 MODNAME=tpbench
14 REPORT=/tmp/testreport
15 TMPLOG=/tmp/testlog
16 WRAPPER=""
17 CLEANUP=""
18 STAP=stap
19 STAPTMP=/tmp/stapconsole
20 STAPPROBE=testutrace.stp
21
22 rm $REPORT 2>/dev/null
23
24 ust_flight_recorder() {
25 # flight recorder, don't record trace to disk.
26 # default buffer size is 4k
27 echo -n "* UST Flight recorder : " | tee >> $REPORT
28 export UST_AUTOCOLLECT=0
29 export UST_OVERWRITE=1
30 export UST_SUBBUF_NUM=16
31 WRAPPER=usttrace
32 }
33
34 ust_disk() {
35 # Collect traces to disk
36 # default buffer size is 4k
37 echo -n "* UST Write to disk : " | tee >> $REPORT
38 export UST_AUTOCOLLECT=1
39 export UST_OVERWRITE=0
40 export UST_SUBBUF_NUM=16
41 WRAPPER=usttrace
42 }
43
44 stap_flight_recorder() {
45 echo -n "* SystemTap Flight recorder : " | tee >> $REPORT
46 WRAPPER=""
47 $STAP $STAPPROBE -F -m $MODNAME
48 }
49
50 stap_disk() {
51 echo -n "* SystemTap Write to disk : " | tee >> $REPORT
52 WRAPPER=""
53 $STAP $STAPPROBE -o $STAPTMP -m $MODNAME &
54 sleep 5
55 }
56
57 echo "Userspace tracing scalability test report" |tee >> $REPORT
58 case "$1" in
59 ust_flight_recorder)
60 TEST=ust_flight_recorder
61 ;;
62 ust_disk)
63 TEST=ust_disk
64 ;;
65 stap_flight_recorder)
66 TEST=stap_flight_recorder
67 CLEANUP="rmmod $MODNAME 2>/dev/null"
68 ;;
69 stap_disk)
70 TEST=stap_disk
71 CLEANUP="killall stapio 2>/dev/null"
72 ;;
73 *)
74 echo "Usage : $0 {ust_flight_recorder|ust_disk|stap_flight_recorder|stap_disk}"
75 exit 1
76 ;;
77 esac
78
79 for nr_threads in 1 2 4 8; do
80 echo "" | tee >> $REPORT
81 echo Number of threads: $nr_threads | tee >> $REPORT
82 echo -n "* Baseline : " | tee >> $REPORT
83
84 eval $CLEANUP
85
86 sync
87 /usr/bin/time -f "%E" -o $TMPLOG $BINARY ${nr_threads}
88 cat $TMPLOG >> $REPORT
89
90 $TEST
91
92 sync
93 /usr/bin/time -f "%E" -o $TMPLOG $WRAPPER $BINARY ${nr_threads}
94 cat $TMPLOG >> $REPORT
95 done
96
97 cat $REPORT
98
This page took 0.030412 seconds and 4 git commands to generate.