Commit | Line | Data |
---|---|---|
851803ea JD |
1 | #!/bin/sh |
2 | ||
8be770fa JD |
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 | |
851803ea | 11 | |
aa2b5f31 JD |
12 | BINARY=./tracepoint_benchmark |
13 | MODNAME=tpbench | |
851803ea JD |
14 | REPORT=/tmp/testreport |
15 | TMPLOG=/tmp/testlog | |
16 | WRAPPER="" | |
6e443277 | 17 | CLEANUP="" |
851803ea JD |
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="" | |
aa2b5f31 | 47 | $STAP $STAPPROBE -F -m $MODNAME |
851803ea JD |
48 | } |
49 | ||
50 | stap_disk() { | |
51 | echo -n "* SystemTap Write to disk : " | tee >> $REPORT | |
52 | WRAPPER="" | |
aa2b5f31 | 53 | $STAP $STAPPROBE -o $STAPTMP -m $MODNAME & |
851803ea JD |
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 | |
aa2b5f31 | 67 | CLEANUP="rmmod $MODNAME 2>/dev/null" |
851803ea JD |
68 | ;; |
69 | stap_disk) | |
70 | TEST=stap_disk | |
6e443277 | 71 | CLEANUP="killall stapio 2>/dev/null" |
851803ea JD |
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 | ||
aa2b5f31 | 84 | eval $CLEANUP |
851803ea JD |
85 | |
86 | sync | |
aa2b5f31 | 87 | /usr/bin/time -f "%E" -o $TMPLOG $BINARY ${nr_threads} |
851803ea JD |
88 | cat $TMPLOG >> $REPORT |
89 | ||
90 | $TEST | |
91 | ||
92 | sync | |
aa2b5f31 | 93 | /usr/bin/time -f "%E" -o $TMPLOG $WRAPPER $BINARY ${nr_threads} |
851803ea JD |
94 | cat $TMPLOG >> $REPORT |
95 | done | |
96 | ||
97 | cat $REPORT | |
98 |