]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - gw-tests/lib.sh
Allow rerunning only the necessary experiments
[can-benchmark.git] / gw-tests / lib.sh
index c5492e886da4ccf11637bdefcd57605513e7accf..75fb899c4c0d34910d59ef0157a63ceb98639a83 100644 (file)
@@ -25,6 +25,7 @@ while [ $# -gt 0 ]; do
                *) error "Unknown load specification: $2";;
            esac;
            shift 2;;
+       -u) OPT_UPDATE=1; shift;;
     esac
 done
 
@@ -91,9 +92,10 @@ traffic_and_length() {
 }
 
 start_load() {
+    unset LATESTER_CONTROL_HACKBENCH
     case $load in
        none) ;;
-       cpu) sshgw 'hackbench -g 3 -l 100000' & loadpid=$!;;
+       cpu) export LATESTER_CONTROL_HACKBENCH=$(sshgw 'nohup setpgid hackbench -g 3 -l 100000  >/dev/null & echo $!');;
        eth) ping -f -s 60000 -q 192.168.2.3 & loadpid=$!;; # TODO: Generate eth load from another computer
        can) latester -q -d can1 -i 0x7ff & loadpid=$!;;
        *) error "Unknown load specification: $load"
@@ -103,7 +105,7 @@ start_load() {
 kill_load() {
     case $load in
        none) ;;
-       cpu) kill $loadpid; sshgw "killall -q hackbench || :";;
+       cpu) sshgw "kill -9 -$LATESTER_CONTROL_HACKBENCH; killall -q -9 hackbench || :";;
        eth) kill $loadpid;;
        can) kill $loadpid;;
        *) error "Unknown load specification: $load"
@@ -111,6 +113,7 @@ kill_load() {
 }
 
 _measure() {
+    if [[ "$OPT_UPDATE" && -f plot.sh && ( plot.sh -nt $test.sh ) ]]; then echo "skiping: up-to-date"; return; fi
     # Remove data from the last measurement
     rm -rf *
     # Kill load generators left possibly from the past runs