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 [[ "$1" = "-f" ]]; then
39 if [[ "$NO_GW_NEEDED" ]]; then return; fi
42 if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then
43 # Create master connection to speed up subsequenct command.
44 ssh -N -f -M -S $socket root@192.168.2.3 >/dev/null 2>&1
46 ssh -x -a -S $socket root@192.168.2.3 "$@"
54 local testname=`basename $0 .sh`
56 for i in "" $ADDITIONAL_PLOTS; do
57 plot_cmds $i | sed -e "/set title/ s/[\"']\(.*\)[\"']/\"\1\\\\n{\/*0.75 (GW kernel $kvers, Traffic $traffic, Load $load)}\"/" > plot.gp
58 if [[ ! -s plot.gp ]]; then continue; fi
59 if [ -z "$OPT_NO_X11" ]; then
60 echo "set terminal x11 enhanced; $(< plot.gp)" | gnuplot -persist
62 test "$(gnuplot --version)" = "gnuplot 4.2 patchlevel 5 " && continue
63 echo "set terminal pdfcairo solid color enhanced; " \
64 "set output \"graph$i.pdf\";" \
65 "set pointsize 0.5;" \
66 "$(< plot.gp)" | gnuplot
67 echo 'set terminal pngcairo color enhanced size 750,525 font ",10" ;' \
68 "$(< plot.gp)" | gnuplot > graph$i.png
69 convert -resize 150x105 -gamma 0.5 -quality 90 -type Palette -depth 8 graph$i.png tgraph$i.png
70 # echo 'set terminal pngcairo color enhanced size 150,105 font ",1";' \
71 # "$(< plot.gp)" | gnuplot > thumb/${testname}$i.png
77 [[ "$_plot_separator" ]] && echo ", \\"
82 traffic_and_length() {
86 50) opts="-p $((2*(44+$1*8)))";;
87 oneatatime) opts="-o";;
88 *) error "Unknown traffic specification: $traffic"
96 cpu) sshgw 'hackbench -g 3 -l 100000' & loadpid=$!;;
97 eth) ping -f -s 60000 -q 192.168.2.3 & loadpid=$!;; # TODO: Generate eth load from another computer
98 can) latester -q -d can1 -i 0x7ff & loadpid=$!;;
99 *) error "Unknown load specification: $load"
106 cpu) kill $loadpid; sshgw "killall -q hackbench || :";;
109 *) error "Unknown load specification: $load"
114 # Remove data from the last measurement
116 # Kill load generators left possibly from the past runs
118 killall -q latester || :
119 if [[ ! "$NO_GW_NEEDED" ]]; then
120 sshgw 'killall -q hackbench || :'
121 # Set can interfaces up
122 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'
123 # Delete all vcan interfaces
124 sshgw 'for dev in $(ip l|grep -o vcan[^:]\\+); do ip link del dev $dev; done'
126 sshgw 'if pid=`pidof irq/145-can0`; then chrt -p -f 50 $pid > /dev/null; fi'
127 sshgw 'if pid=`pidof irq/146-can1`; then chrt -p -f 50 $pid > /dev/null; fi'
128 sshgw 'if pid=`pidof sirq-net-rx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
129 sshgw 'if pid=`pidof sirq-net-tx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
130 # Set the length of qdisc queue to avoid ENOBUFS errors
131 ifconfig can0 txqueuelen 200
132 ifconfig can1 txqueuelen 200
135 type prepare >/dev/null 2>&1 && prepare || :
141 if [[ ! "$NO_GW_NEEDED" ]]; then
145 if [ ! "$SKIPPED" ]; then
146 # Create a plot script at the end to signalize that the
147 # measurement was successfully finished
151 export hostkvers=$hostkvers
152 export traffic=$traffic
154 cd \$(dirname \$0)/$(dirname $script)
155 exec ./$(basename $script) --plot "\$@"
163 if [[ $OPT_TRAFFIC = all ]]
164 then traffics="flood 50 oneatatime"
165 else traffics=${traffic:-$OPT_TRAFFIC}
167 if [[ $OPT_LOAD = all ]]
168 then loads="none cpu eth" # TODO: can
169 else loads=${load:-$OPT_LOAD}
171 hostkvers=${hostkvers:-host-$(uname -r)}
172 kvers=${kvers:-$(sshgw -f uname -r)}
173 test=$(basename $0 .sh)
174 for load in $loads; do
175 for traffic in $traffics; do
176 dir="results/$hostkvers/$kvers/$traffic/$load/$test"
178 script=$(echo $dir | sed -e 's/[^/]*/../g')/${test}.sh
180 if [[ ! "$OPT_PLOT_ONLY" ]]; then
181 echo "Working directory: $dir"
184 if [[ ! "$OPT_PLOT_DISABLE" ]]; then
202 if [[ ! "$test_end_called" ]]; then
204 error "bug in the test script: No test_end called"
206 if ! test -n "$exit_ok"; then
207 error "FATAL: Command '$cmd' exit with code $code"