]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Update plotting -- not finished
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 7 Dec 2010 21:53:00 +0000 (22:53 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 7 Dec 2010 21:53:00 +0000 (22:53 +0100)
gw-tests/lib.sh

index 2fdf1ff2a5579f656186c129addb8192c6b814f7..741520f105183236dd9e5f9e1a94b798ce0b1e1b 100644 (file)
@@ -11,8 +11,8 @@ error() {
 
 while [ $# -gt 0 ]; do
     case "$1" in
-       -P) OPT_PLOT_DISABLE=1; shift;;
-       -p) OPT_PLOT_ONLY=1; shift;;
+       -P|--no-plot) OPT_PLOT_DISABLE=1; shift;;
+       -p|--plot) OPT_PLOT_ONLY=1; shift;;
        -X|--no-x11-plot) OPT_NO_X11=1; shift;;
        -t) case "$2" in
                all|flood|50|oneatatime) OPT_TRAFFIC=$2;;
@@ -69,7 +69,7 @@ echo_plot() {
 
 traffic_and_length() {
     local opts
-    case $OPT_TRAFFIC in
+    case $traffic in
        flood) opts='';;
        50)        opts="-p $((2*(44+$1*8)))";;
        oneatatime)        opts="-o";;
@@ -79,29 +79,27 @@ traffic_and_length() {
 }
 
 _run() {
-    if [[ ! "$OPT_PLOT_ONLY" ]]; then
-       host_kernel_versions=host-$(uname -r)
-       kernel_versions=$(sshgw uname -r)
-    else
-       host_kernel_versions=$(cd results; ls -d host-*)
-       kernel_versions=$(cd results/host-$(uname -r)/; ls)
-    fi
     if [[ $OPT_TRAFFIC = all ]]
     then traffics="flood 50 oneatatime"
     else traffics=$OPT_TRAFFIC
     fi
-    for hostkvers in $host_kernel_versions; do
-    for OPT_TRAFFIC in $traffics; do
-    for kvers in $kernel_versions; do
-       dir="results/$hostkvers/$kvers/$OPT_TRAFFIC/$(basename $0 .sh)"
+    hostkvers=host-$(uname -r)
+    kvers=$(sshgw uname -r)
+    test=$(basename $0 .sh)
+    for traffic in $traffics; do
+       dir="results/$hostkvers/$kvers/$traffic/$test"
        mkdir -p $dir
-       script=$PWD/$0
+       script=$(echo $dir | sed -e 's/[^/]*/../g')/${test}.sh
        cd $dir
        echo "Working directory: $dir"
        if [[ ! "$OPT_PLOT_ONLY" ]]; then
            # Remove data from the last measurement
            rm -rf *
            touch .results
+           cat > plot.sh <<-EOF
+               #!/bin/bash
+               exec $script --plot
+               EOF
            # Set can interfaces up
            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'
            # Delete all vcan interfaces
@@ -116,15 +114,13 @@ _run() {
            cleanupgw
 
            main
-           cp $script .
+
        fi
        if [[ ! "$OPT_PLOT_DISABLE" ]]; then
-           _plot
+           ./plot.sh
        fi
        cd -
     done
-    done
-    done
 }
 
 test_end() {