]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - gw-tests/lib.sh
Do not invoke gnuplot when there is nothing to plot
[can-benchmark.git] / gw-tests / lib.sh
index 2312d435fb3626920cf24be33bc39aa69ecedee5..467321de429e8c8b1be3214b658f84f1a18c20ff 100644 (file)
@@ -27,7 +27,7 @@ PATH=$PWD/../_compiled/bin/:$PATH
 sshgw() {
     local socket="$HOME/.ssh/cangw-connection"
 
-    if [[ ! -S $socket ]]; then
+    if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then
        # Create master connection to speed up subsequenct command.
        # The ssh is put into background and the connection is closed
        # after 10 minutes)
@@ -44,6 +44,7 @@ _plot() {
     local testname=`basename $0 .sh`
 
     plot_cmds | sed -e "/set title/ s/[\"']\(.*\)[\"']/\"\1\\\\n($kvers)\"/" > plot.gp
+    if [[ ! -s plot.gp ]]; then return; fi
     if [ -z "$OPT_NO_X11" ]; then
        echo "set terminal x11 enhanced; $(< plot.gp)" | gnuplot -persist
     fi
@@ -59,16 +60,6 @@ _plot() {
 
 }
 
-create_dirs() {
-    local kver=$1
-    local traffic=$2
-    local test=$3
-
-    local  d=results/$kver/$traffic/$test
-    mkdir -p $d
-    echo $d
-}
-
 echo_plot() {
     plot=$1
     [[ "$_plot_separator" ]] && echo ", \\"
@@ -98,7 +89,8 @@ _run() {
     fi
     for OPT_TRAFFIC in $traffics; do
     for kvers in $kernel_versions; do
-       dir=$(create_dirs $kvers $OPT_TRAFFIC $(basename $0 .sh))
+       dir="results/host-$(uname -r)/$kvers/$OPT_TRAFFIC/$(basename $0 .sh)"
+       mkdir -p $dir
        script=$PWD/$0
        cd $dir
        echo "Working directory: $dir"
@@ -114,6 +106,8 @@ _run() {
            sshgw 'chrt -p -f 50 `pidof irq/146-can1` > /dev/null || :'
            sshgw 'chrt -p -f 49 `pidof sirq-net-rx/0` > /dev/null || :'
            sshgw 'chrt -p -f 49 `pidof sirq-net-tx/0` > /dev/null || :'
+           # Set the length of qdisc queue to avoid ENOBUFS errors
+           ifconfig can0 txqueuelen 200
            cleanupgw
 
            main