]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
Added scripts for running multiple experiments in batch manner and plot their results.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 6 Dec 2007 13:21:33 +0000 (14:21 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 6 Dec 2007 13:21:33 +0000 (14:21 +0100)
wme_test/plot [new file with mode: 0755]
wme_test/tester [new file with mode: 0755]
wme_test/wclient.c

diff --git a/wme_test/plot b/wme_test/plot
new file mode 100755 (executable)
index 0000000..f2cf444
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+while getopts esp opt
+do
+    case $opt in
+       e) SET_TERM_TEMPLATE='set term postscript color eps size 12cm,9cm; set output "${FILE}.eps"';;
+       s) SET_TERM_TEMPLATE='set term svg; set output "${FILE}.svg"';;
+       p) SET_TERM_TEMPLATE='set term png; set output "${FILE}.png"';;
+    esac
+done
+
+shift $(($OPTIND - 1)) 
+
+while [ $# -gt 0 ];
+do
+    FILE=`basename "$1" .dat`
+    shift
+
+    COMMAND="Results of: $(grep 'Invoked as' ${FILE}.dat|grep -o 'wclient.*'|sed -e 's/ -o [^ ]*//' -e 's/ [^ ]* ?$//')"
+    STREAMS="$(grep -o 'Stream.*' ${FILE}.dat|sort|while read LINE; do echo $LINE\\n; done|tr -d '\n')"
+
+    TITLE="${COMMAND}\n\n${STREAMS}"
+
+    SET_TERM=$(echo $SET_TERM_TEMPLATE|sed -e s/\${FILE}/$FILE/)
+    cat <<EOF | gnuplot -persist
+${SET_TERM}
+set xlabel "Delay [ms]"
+set ylabel "Probability distribution function [%]"
+set title "${TITLE}"
+set key right bottom nobox
+set style data linespoints
+set grid
+plot [0:*] [0.01:99.9999] "${FILE}.dat" index 1 using 1:2 title "AC_VO",\
+                   "${FILE}.dat" index 1 using 1:3 title "AC_VI",\
+                   "${FILE}.dat" index 1 using 1:4 title "AC_BE",\
+                   "${FILE}.dat" index 1 using 1:5 title "AC_BK"
+EOF
+done
diff --git a/wme_test/tester b/wme_test/tester
new file mode 100755 (executable)
index 0000000..2b758ae
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+TEST_DIR=tests
+OUTPUT_PREFIX=$(date +%F_%T)/
+
+while getopts t:o: opt
+do
+    case $opt in
+       t) TEST_DIR="$OPTARG";;
+       o) OUTPUT_PREFIX="$OPTARG"
+    esac
+done
+
+shift $(($OPTIND - 1)) 
+SERVER="$1"
+
+if [ -z "$SERVER" ]
+then
+    echo "Server address argument missing"
+    exit 1
+fi
+
+if echo $OUTPUT_PREFIX|grep -q "/$"
+then
+    mkdir -p $OUTPUT_PREFIX
+    [ -n "$SUDO_USER" ] && chown $SUDO_USER $OUTPUT_PREFIX
+fi
+
+find $TEST_DIR -type f|while read F
+do
+       CMD_LINE=$(echo $F|sed -e "s/${TEST_DIR}//"|tr '/' ' ')
+       OUTPUT=$(echo $CMD_LINE|tr -s '/ -' '_')
+       ./wclient $CMD_LINE -o "${OUTPUT_PREFIX}${OUTPUT}" $SERVER
+done
index 592ea8eee52ab01aef887a7dae03182956c9e9e2..50693b2eb6f533d3372c776f942e6b3ada9c6bd3 100644 (file)
@@ -540,7 +540,8 @@ int main(int argc, char *argv[])
                }
                fflush(stderr);
                i++;
-               if (i == opt_count_sec) exit_flag = 1;
+               if (i == opt_count_sec)
+                       stopper();
        }
 
        fprintf(stderr, "\nWaiting for threads to finish\n");