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