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 JD |
11 | |
12 | BINARY=tracepoint_benchmark | |
13 | REPORT=/tmp/testreport | |
14 | TMPLOG=/tmp/testlog | |
15 | WRAPPER="" | |
6e443277 | 16 | CLEANUP="" |
851803ea JD |
17 | STAP=stap |
18 | STAPTMP=/tmp/stapconsole | |
19 | STAPPROBE=testutrace.stp | |
20 | ||
21 | rm $REPORT 2>/dev/null | |
22 | ||
23 | ust_flight_recorder() { | |
24 | # flight recorder, don't record trace to disk. | |
25 | # default buffer size is 4k | |
26 | echo -n "* UST Flight recorder : " | tee >> $REPORT | |
27 | export UST_AUTOCOLLECT=0 | |
28 | export UST_OVERWRITE=1 | |
29 | export UST_SUBBUF_NUM=16 | |
30 | WRAPPER=usttrace | |
31 | } | |
32 | ||
33 | ust_disk() { | |
34 | # Collect traces to disk | |
35 | # default buffer size is 4k | |
36 | echo -n "* UST Write to disk : " | tee >> $REPORT | |
37 | export UST_AUTOCOLLECT=1 | |
38 | export UST_OVERWRITE=0 | |
39 | export UST_SUBBUF_NUM=16 | |
40 | WRAPPER=usttrace | |
41 | } | |
42 | ||
43 | stap_flight_recorder() { | |
44 | echo -n "* SystemTap Flight recorder : " | tee >> $REPORT | |
45 | WRAPPER="" | |
46 | $STAP $STAPPROBE -F -m $BINARY | |
47 | } | |
48 | ||
49 | stap_disk() { | |
50 | echo -n "* SystemTap Write to disk : " | tee >> $REPORT | |
51 | WRAPPER="" | |
52 | $STAP $STAPPROBE -o $STAPTMP -m $BINARY & | |
53 | sleep 5 | |
54 | } | |
55 | ||
56 | echo "Userspace tracing scalability test report" |tee >> $REPORT | |
57 | case "$1" in | |
58 | ust_flight_recorder) | |
59 | TEST=ust_flight_recorder | |
60 | ;; | |
61 | ust_disk) | |
62 | TEST=ust_disk | |
63 | ;; | |
64 | stap_flight_recorder) | |
65 | TEST=stap_flight_recorder | |
6e443277 | 66 | CLEANUP="rmmod $BINARY 2>/dev/null" |
851803ea JD |
67 | ;; |
68 | stap_disk) | |
69 | TEST=stap_disk | |
6e443277 | 70 | CLEANUP="killall stapio 2>/dev/null" |
851803ea JD |
71 | ;; |
72 | *) | |
73 | echo "Usage : $0 {ust_flight_recorder|ust_disk|stap_flight_recorder|stap_disk}" | |
74 | exit 1 | |
75 | ;; | |
76 | esac | |
77 | ||
78 | for nr_threads in 1 2 4 8; do | |
79 | echo "" | tee >> $REPORT | |
80 | echo Number of threads: $nr_threads | tee >> $REPORT | |
81 | echo -n "* Baseline : " | tee >> $REPORT | |
82 | ||
6e443277 | 83 | $CLEANUP |
851803ea JD |
84 | |
85 | sync | |
86 | /usr/bin/time -f "%E" -o $TMPLOG ./$BINARY ${nr_threads} | |
87 | cat $TMPLOG >> $REPORT | |
88 | ||
89 | $TEST | |
90 | ||
91 | sync | |
92 | /usr/bin/time -f "%E" -o $TMPLOG $WRAPPER ./$BINARY ${nr_threads} | |
93 | cat $TMPLOG >> $REPORT | |
94 | done | |
95 | ||
96 | cat $REPORT | |
97 |