13 while [ $# -gt 0 ]; do
15 -P|--no-plot) OPT_PLOT_DISABLE=1; shift;;
16 -p|--plot) OPT_PLOT_ONLY=1; shift;;
17 -X|--no-x11-plot) OPT_NO_X11=1; shift;;
19 all|flood|50|oneatatime) OPT_TRAFFIC=$2;;
20 *) error "Unknown traffic specification: $2";;
24 all|none|cpu|eth|can) OPT_LOAD=$2;;
25 *) error "Unknown load specification: $2";;
28 -u) OPT_UPDATE=1; shift;;
32 PATH=$PWD/../_compiled/bin/:$PATH
35 local socket="$HOME/.ssh/cangw-connection"
37 if [[ "$1" = "-f" ]]; then
40 if [[ "$NO_GW_NEEDED" ]]; then return; fi
43 if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then
44 # Create master connection to speed up subsequenct command.
45 ssh -N -f -M -S $socket root@192.168.2.3 >/dev/null 2>&1
47 ssh -x -a -S $socket root@192.168.2.3 "$@"
55 local testname=`basename $0 .sh`
57 for i in "" $ADDITIONAL_PLOTS; do
58 plot_cmds $i | sed -e "/set title/ s/[\"']\(.*\)[\"']/\"\1\\\\n{\/*0.75 (GW kernel $kvers, Traffic $traffic, Load $load)}\"/" > plot.gp
59 if [[ ! -s plot.gp ]]; then continue; fi
60 if [ -z "$OPT_NO_X11" ]; then
61 echo "set terminal x11 enhanced; $(< plot.gp)" | gnuplot -persist
63 test "$(gnuplot --version)" = "gnuplot 4.2 patchlevel 5 " && continue
64 echo "set terminal pdfcairo solid color enhanced; " \
65 "set output \"graph$i.pdf\";" \
66 "set pointsize 0.5;" \
67 "$(< plot.gp)" | gnuplot
68 echo 'set terminal pngcairo color enhanced size 750,525 font ",10" ;' \
69 "$(< plot.gp)" | gnuplot > graph$i.png
70 convert -resize 150x105 -gamma 0.5 -quality 90 -type Palette -depth 8 graph$i.png tgraph$i.png
71 # echo 'set terminal pngcairo color enhanced size 150,105 font ",1";' \
72 # "$(< plot.gp)" | gnuplot > thumb/${testname}$i.png
78 [[ "$_plot_separator" ]] && echo ", \\"
83 traffic_and_length() {
87 50) opts="-p $((2*(44+$1*8)))";;
88 oneatatime) opts="-o";;
89 *) error "Unknown traffic specification: $traffic"
95 unset LATESTER_CONTROL_HACKBENCH
98 cpu) export LATESTER_CONTROL_HACKBENCH=$(sshgw 'nohup setpgid hackbench -g 3 -l 100000 >/dev/null & echo $!');;
99 eth) ping -f -s 60000 -q 192.168.2.3 & loadpid=$!;; # TODO: Generate eth load from another computer
100 can) latester -q -d can1 -i 0x7ff & loadpid=$!;;
101 *) error "Unknown load specification: $load"
108 cpu) sshgw "kill -9 -$LATESTER_CONTROL_HACKBENCH; killall -q -9 hackbench || :";;
111 *) error "Unknown load specification: $load"
116 if [[ "$OPT_UPDATE" && -f plot.sh && ( plot.sh -nt $test.sh ) ]]; then echo "skiping: up-to-date"; return; fi
117 # Remove data from the last measurement
119 # Kill load generators left possibly from the past runs
121 killall -q latester || :
122 if [[ ! "$NO_GW_NEEDED" ]]; then
123 sshgw 'killall -q hackbench || :'
124 # Set can interfaces up
125 sshgw 'for i in 0 1; do ip link show dev can$i|grep -q UP || ip link set can$i up type can bitrate 1000000; done'
126 # Delete all vcan interfaces
127 sshgw 'for dev in $(ip l|grep -o vcan[^:]\\+); do ip link del dev $dev; done'
129 sshgw 'if pid=`pidof irq/145-can0`; then chrt -p -f 50 $pid > /dev/null; fi'
130 sshgw 'if pid=`pidof irq/146-can1`; then chrt -p -f 50 $pid > /dev/null; fi'
131 sshgw 'if pid=`pidof sirq-net-rx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
132 sshgw 'if pid=`pidof sirq-net-tx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
133 # Set the length of qdisc queue to avoid ENOBUFS errors
134 sshgw 'ifconfig can0 txqueuelen 1000; ifconfig can1 txqueuelen 1000'
135 ifconfig can0 txqueuelen 200
136 ifconfig can1 txqueuelen 200
139 type prepare >/dev/null 2>&1 && prepare || :
145 if [[ ! "$NO_GW_NEEDED" ]]; then
149 if [ ! "$SKIPPED" ]; then
150 # Create a plot script at the end to signalize that the
151 # measurement was successfully finished
155 export hostkvers=$hostkvers
156 export traffic=$traffic
158 cd \$(dirname \$0)/$(dirname $script)
159 exec ./$(basename $script) --plot "\$@"
167 if [[ $OPT_TRAFFIC = all ]]
168 then traffics="flood 50 oneatatime"
169 else traffics=${traffic:-$OPT_TRAFFIC}
171 if [[ $OPT_LOAD = all ]]
172 then loads="none cpu eth" # TODO: can
173 else loads=${load:-$OPT_LOAD}
175 hostkvers=${hostkvers:-host-$(uname -r)}
176 kvers=${kvers:-$(sshgw -f uname -r)}
177 test=$(basename $0 .sh)
178 for load in $loads; do
179 for traffic in $traffics; do
180 dir="results/$hostkvers/$kvers/$traffic/$load/$test"
182 script=$(echo $dir | sed -e 's/[^/]*/../g')/${test}.sh
184 if [[ ! "$OPT_PLOT_ONLY" ]]; then
185 echo "Working directory: $dir"
188 if [[ ! "$OPT_PLOT_DISABLE" ]]; then
206 if [[ ! "$test_end_called" ]]; then
208 error "bug in the test script: No test_end called"
210 if ! test -n "$exit_ok"; then
211 error "FATAL: Command '$cmd' exit with code $code"