Add the source files for the swift library.
[swifty.git] / src / libswift / mfold / loggraphs
1 #!/bin/bash
2
3 if [ -z "$SERVERS" ]; then
4     SERVERS="servers.txt"
5 fi
6
7 . env.default.sh
8
9 if [ ! $MAXGNUPLOTS ]; then
10     MAXGNUPLOTS=200
11 fi
12
13 VERSION=`date`,`git log --summary | head -1`
14
15 cd harvest
16
17 # HEAD=`head -1 *.log | grep -v '^$' | cut -f1 | sort | head -1`
18 # TAIL=`tail -n1 -q *.log | grep -v '^$' | cut -f1 | sort | tail -n1 -q`
19
20 i=0
21 for fromstr in `grep -v '^#' ../$SERVERS`; do
22     from=${fromstr%:*}
23     for tostr in `grep -v '^#' ../$SERVERS`; do
24         to=${tostr%:*}
25         CWNDLOG="$from-$to-cwnd.log"
26         if [ ! -e $CWNDLOG ]; then
27             continue
28         fi
29         GP="$from-$to.gnuplot"
30
31         echo "set term png large size 2048,768" > $GP
32         PNG="$from-$to.big.png"
33         if [ -e $PNG ]; then rm $PNG; fi
34         echo "set out '$PNG'" >> $GP
35
36         echo "set y2tics" >> $GP
37         echo "set y2label 'packets'" >> $GP
38         echo "set ylabel 'microseconds'" >> $GP
39         echo "set xlabel 'run time millis'" >> $GP
40         echo "set title '$VERSION'" >> $GP
41         #echo "set xrange [$HEAD:$TAIL]" >> $GP
42         CWNDLOG="$from-$to-cwnd.log"
43         echo -ne "plot '$CWNDLOG' using 1:2 with lines lt rgb '#00aa00' title 'cwnd'"\
44                 " axis x1y2, "\
45                 " '$CWNDLOG' using 1:3 with lines lt rgb '#99ff99'  title 'data out'"\
46                 " axis x1y2 "\
47                 >> $GP
48         RTTLOG="$from-$to-rtt.log"
49         if [ -e $RTTLOG ]; then
50             echo -ne ", '$RTTLOG' using 1:2 with lines lt rgb '#2833ff'  title 'rtt' "\
51                 "axis x1y1, "\
52                 "'$RTTLOG' using 1:3 with lines lt rgb '#8844ff' title 'dev' "\
53                 "axis x1y1"\
54                 >> $GP
55         fi
56         OWDLOG="$from-$to-owd.log"
57         if [ -e $OWDLOG ]; then
58             echo -ne ", '$OWDLOG' using 1:2 with lines lt rgb '#ff00ee' title 'owd' "\
59                 "axis x1y1, "\
60                 "'$OWDLOG' using 1:3 with lines lw 2 lt rgb '#0044cc'  title 'min owd'"\
61                 "axis x1y1, "\
62                 "'$OWDLOG' using 1:(\$3+25000) with lines lw 2 lt rgb '#0000ff' title 'target'"\
63                 "axis x1y1 "\
64                 >> $GP
65         fi
66         RDATALOG="$from-$to-rdata.log"
67         if [ -e $RDATALOG ]; then
68             echo -ne ", '$RDATALOG' using 1:(1) with points "\
69                 "lt rgb '#0f0000' title 'r-losses'"\
70                 >> $GP
71         fi
72         TDATALOG="$from-$to-tdata.log"
73         if [ -e $TDATALOG ]; then
74             echo -ne ", '$TDATALOG' using 1:(1) with points "\
75                 "lt rgb '#ff0000' title 't-losses'"\
76                 >> $GP
77         fi
78         echo  >> $GP
79
80         echo "set term png size 512,192" >> $GP
81         PNG="$from-$to.thumb.png"
82         if [ -e $PNG ]; then rm $PNG; fi
83         echo "set out '$PNG'" >> $GP
84         echo "unset title" >> $GP
85         echo "unset xlabel" >> $GP
86         echo "unset ylabel" >> $GP
87         echo "replot" >> $GP
88
89         ( cat $GP | gnuplot ) &
90         let i++
91         if [ $i == $MAXGNUPLOTS ]; then
92             wait
93             i=0
94         fi
95     done
96 done
97
98 wait
99 cd ..