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 for i in "" $ADDITIONAL_PLOTS; do
51 plot_cmds $i | sed -e "/set title/ s/[\"']\(.*\)[\"']/\"\1\\\\n{\/*0.75 (GW kernel $kvers, Traffic $traffic, Load $load)}\"/" > plot.gp
52 if [[ ! -s plot.gp ]]; then return; fi
53 if [ -z "$OPT_NO_X11" ]; then
54 echo "set terminal x11 enhanced; $(< plot.gp)" | gnuplot -persist
56 echo "set terminal pdfcairo solid color enhanced; set output \"graph$i.pdf\";" \
57 "$(< plot.gp)" | gnuplot
58 echo 'set terminal pngcairo color enhanced size 750,525 font ",10" ;' \
59 "$(< plot.gp)" | gnuplot > graph$i.png
61 convert -resize 150x105 -gamma 0.5 -quality 90 -type Palette -depth 8 graph$i.png tgraph$i.png
62 # echo 'set terminal pngcairo color enhanced size 150,105 font ",1";' \
63 # "$(< plot.gp)" | gnuplot > thumb/${testname}$i.png
70 [[ "$_plot_separator" ]] && echo ", \\"
75 traffic_and_length() {
79 50) opts="-p $((2*(44+$1*8)))";;
80 oneatatime) opts="-o";;
81 *) error "Unknown traffic specification: $traffic"
89 cpu) sshgw 'hackbench -g 3 -l 10000' & loadpid=$!;;
90 eth) ping -f -s 60000 -q 192.168.2.3 & loadpid=$!;; # TODO: Generate eth load from another computer
91 can) latester -q -d can1 -i 0x7ff & loadpid=$!;;
92 *) error "Unknown load specification: $load"
99 cpu) kill $loadpid; sshgw "killall -q hackbench || :";;
102 *) error "Unknown load specification: $load"
107 # Remove data from the last measurement
109 # Kill load generators left possibly from the past runs
111 killall -q latester || :
112 sshgw 'killall -q hackbench || :'
113 # Set can interfaces up
114 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'
115 # Delete all vcan interfaces
116 sshgw 'for dev in $(ip l|grep -o vcan[^:]\\+); do ip link del dev $dev; done'
118 sshgw 'if pid=`pidof irq/145-can0`; then chrt -p -f 50 $pid > /dev/null; fi'
119 sshgw 'if pid=`pidof irq/146-can1`; then chrt -p -f 50 $pid > /dev/null; fi'
120 sshgw 'if pid=`pidof sirq-net-rx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
121 sshgw 'if pid=`pidof sirq-net-tx/0`; then chrt -p -f 49 $pid > /dev/null; fi'
122 # Set the length of qdisc queue to avoid ENOBUFS errors
123 ifconfig can0 txqueuelen 200
124 ifconfig can1 txqueuelen 200
127 type prepare >/dev/null 2>&1 && prepare || :
132 # Create a plot script at the end to signalize that the
133 # measurement was successfully finished
137 export hostkvers=$hostkvers
138 export traffic=$traffic
140 cd \$(dirname \$0)/$(dirname $script)
141 exec ./$(basename $script) --plot "\$@"
148 if [[ $OPT_TRAFFIC = all ]]
149 then traffics="flood 50 oneatatime"
150 else traffics=${traffic:-$OPT_TRAFFIC}
152 if [[ $OPT_LOAD = all ]]
153 then loads="none cpu eth" # TODO: can
154 else loads=${load:-$OPT_LOAD}
156 hostkvers=${hostkvers:-host-$(uname -r)}
157 kvers=${kvers:-$(sshgw uname -r)}
158 test=$(basename $0 .sh)
159 for load in $loads; do
160 for traffic in $traffics; do
161 dir="results/$hostkvers/$kvers/$traffic/$load/$test"
163 script=$(echo $dir | sed -e 's/[^/]*/../g')/${test}.sh
165 if [[ ! "$OPT_PLOT_ONLY" ]]; then
166 echo "Working directory: $dir"
169 if [[ ! "$OPT_PLOT_DISABLE" ]]; then
187 if [[ ! "$test_end_called" ]]; then
189 error "bug in the test script: No test_end called"
191 if ! test -n "$exit_ok"; then
192 error "FATAL: Command '$cmd' exit with code $code"