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";;
31 PATH=$PWD/../_compiled/bin/:$PATH
34 local socket="$HOME/.ssh/cangw-connection"
36 if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then
37 # Create master connection to speed up subsequenct command.
38 ssh -N -f -M -S $socket root@192.168.2.3 >/dev/null 2>&1
40 ssh -x -a -S $socket root@192.168.2.3 "$@"
48 local testname=`basename $0 .sh`
50 plot_cmds | sed -e "/set title/ s/[\"']\(.*\)[\"']/\"\1\\\\n(GW kernel $kvers, Traffic $traffic, Load $load)\"/" > plot.gp
51 if [[ ! -s plot.gp ]]; then return; fi
52 if [ -z "$OPT_NO_X11" ]; then
53 echo "set terminal x11 enhanced; $(< plot.gp)" | gnuplot -persist
56 echo 'set terminal postscript color eps enhanced size 6cm,4cm lw 1 "Times-Roman" 10;' \
58 "$(< plot.gp)" | gnuplot > ${testname}$I.eps
59 echo "set terminal postscript color eps enhanced;" \
60 "$(< plot.gp)" | gnuplot | epstopdf --filter > ${testname}$I.pdf
62 convert -density 30 -gamma 0.5 -quality 90 -type Palette -depth 8 ${testname}$I.pdf thumb/${testname}$I.png
63 convert -density 150 -gamma 0.7 -quality 90 -type Palette -depth 8 ${testname}$I.pdf ${testname}$I.png
69 [[ "$_plot_separator" ]] && echo ", \\"
74 traffic_and_length() {
78 50) opts="-p $((2*(44+$1*8)))";;
79 oneatatime) opts="-o";;
80 *) error "Unknown traffic specification: $traffic"
88 cpu) sshgw 'hackbench -g 3 -l 10000' & loadpid=$!;;
89 eth) ping -f -s 60000 -q 192.168.2.3 & loadpid=$!;; # TODO: Generate eth load from another computer
90 can) latester -q -d can1 -i 0x7ff & loadpid=$!;;
91 *) error "Unknown load specification: $load"
98 cpu) kill $loadpid; sshgw "killall -q hackbench || :";;
101 *) error "Unknown load specification: $load"
106 # Remove data from the last measurement
112 export hostkvers=$hostkvers
113 export traffic=$traffic
115 cd \$(dirname \$0)/$(dirname $script)
116 exec ./$(basename $script) --plot "\$@"
119 # Kill load generators left possibly from the past runs
121 killall -q latester || :
122 sshgw 'killall -q hackbench || :'
123 # Set can interfaces up
124 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'
125 # Delete all vcan interfaces
126 sshgw 'for dev in $(ip l|grep -o vcan[^:]\\+); do ip link del dev $dev; done'
128 sshgw 'if pid=`pidof irq/145-can0`; then chrt -p -f 50 $pid > /dev/null; fi'
129 sshgw 'if pid=`pidof irq/146-can1`; then chrt -p -f 50 $pid > /dev/null; fi'
130 sshgw 'if pid=`pidof sirq-net-rx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
131 sshgw 'if pid=`pidof sirq-net-tx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
132 # Set the length of qdisc queue to avoid ENOBUFS errors
133 ifconfig can0 txqueuelen 200
134 ifconfig can1 txqueuelen 200
137 type prepare >/dev/null 2>&1 && prepare || :
145 if [[ $OPT_TRAFFIC = all ]]
146 then traffics="flood 50 oneatatime"
147 else traffics=${traffic:-$OPT_TRAFFIC}
149 if [[ $OPT_LOAD = all ]]
150 then loads="none cpu eth" # TODO: can
151 else loads=${load:-$OPT_LOAD}
153 hostkvers=${hostkvers:-host-$(uname -r)}
154 kvers=${kvers:-$(sshgw uname -r)}
155 test=$(basename $0 .sh)
156 for load in $loads; do
157 for traffic in $traffics; do
158 dir="results/$hostkvers/$kvers/$traffic/$load/$test"
160 script=$(echo $dir | sed -e 's/[^/]*/../g')/${test}.sh
162 if [[ ! "$OPT_PLOT_ONLY" ]]; then
163 echo "Working directory: $dir"
166 if [[ ! "$OPT_PLOT_DISABLE" ]]; then
184 if [[ ! "$test_end_called" ]]; then
186 error "bug in the test script: No test_end called"
188 if ! test -n "$exit_ok"; then
189 error "FATAL: Command '$cmd' exit with code $code"