| 1 | #! /bin/sh |
| 2 | |
| 3 | # This script file runs allcalc and |
| 4 | # displays graphs from the output files. |
| 5 | |
| 6 | # Default values and variable declaration # |
| 7 | num=0 |
| 8 | window=1 |
| 9 | delay=FALSE |
| 10 | args=$# |
| 11 | |
| 12 | # Formatting for Bit Rate Plot # |
| 13 | echo "set title 'Bit Rate vs. Start Window Time'">gnudata |
| 14 | echo "set xlabel 'Time(s)'">>gnudata |
| 15 | echo "set ylabel 'Bit Rate'">>gnudata |
| 16 | echo "set data style steps">>gnudata |
| 17 | echo "set yrange [0:*]">>gnudata |
| 18 | |
| 19 | # Usage statement # |
| 20 | if [ $# = 0 ]; then |
| 21 | clear |
| 22 | echo "Usage: -d delay plot and rate plot(default=rate plot) -w window_time" |
| 23 | echo "-g to produce .gif file(s) -l logFile -f flow_ids--seperated by spaces" |
| 24 | echo "note: the -f option must be specified last" |
| 25 | rm gnudata |
| 26 | else |
| 27 | echo "Ode to LAZYPLUS" |
| 28 | |
| 29 | # Searches command line for arguments # |
| 30 | while [ -n "$(echo $1 | grep '-')" ]; do |
| 31 | case $1 in |
| 32 | -w ) window=$2 |
| 33 | args=$(($args-2)) |
| 34 | shift;; |
| 35 | -d ) delay=TRUE |
| 36 | num=1;; |
| 37 | -g ) gif=TRUE |
| 38 | if [ $delay = TRUE ]; then |
| 39 | num=2 |
| 40 | else |
| 41 | num=1 |
| 42 | fi;; |
| 43 | -l ) logFile=$2 |
| 44 | args=$(($args-2)) |
| 45 | shift;; |
| 46 | -f ) flow=$2 |
| 47 | args=$(($args-1)) |
| 48 | count=0 |
| 49 | # Loops through all arguments after the -f option # |
| 50 | while [ $args -gt $num ]; do |
| 51 | ./allcalc -f $2 -w $window $logFile $2.iljjfe |
| 52 | file=$2.iljjfe |
| 53 | |
| 54 | # Determines whether to send plot or replot command to # |
| 55 | # gnuplot scripts # |
| 56 | if [ $count = 0 ]; then |
| 57 | echo "plot '$file' using 5:9 title 'flow $2'">>gnudata |
| 58 | if [ $delay = TRUE ]; then |
| 59 | echo "set title 'Delay vs. Recieve Time'">gnudata1 |
| 60 | echo "set ylabel 'Delay'">>gnudata1 |
| 61 | echo "set xlabel 'Recieve Time'">>gnudata1 |
| 62 | echo "set data style lines">>gnudata1 |
| 63 | echo "plot '$file' using 3:4 title 'flow $2'">>gnudata1 |
| 64 | fi |
| 65 | else |
| 66 | echo "replot '$file' using 5:9 title 'flow $2'">>gnudata |
| 67 | echo "replot '$file' using 3:4 title 'flow $2'">>gnudata1 |
| 68 | fi |
| 69 | shift |
| 70 | args=$(($args-1)) |
| 71 | count=$(($count+1)) |
| 72 | done |
| 73 | |
| 74 | if [ $gif = TRUE ]; then |
| 75 | echo "Enter test name" |
| 76 | read testname |
| 77 | plot=rate_$testname.gif |
| 78 | echo "set term gif">>gnudata |
| 79 | echo "set output '$plot'">>gnudata |
| 80 | echo "replot">>gnudata |
| 81 | if [ $delay = TRUE ]; then |
| 82 | plot=delay_$testname.gif |
| 83 | echo "set term gif">>gnudata1 |
| 84 | echo "set output '$plot'">>gnudata1 |
| 85 | echo "replot">>gnudata1 |
| 86 | fi |
| 87 | fi |
| 88 | |
| 89 | # Sends gnuplot the script files # |
| 90 | gnuplot -persist gnudata |
| 91 | if [ $delay = TRUE ]; then |
| 92 | gnuplot -persist gnudata1 |
| 93 | fi |
| 94 | |
| 95 | # Cleanup # |
| 96 | rm gnudata |
| 97 | rm gnudata1 |
| 98 | rm *.iljjfe;; |
| 99 | esac |
| 100 | shift |
| 101 | done |
| 102 | |
| 103 | fi |
| 104 |