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