blob: d6fad8fa638d8c55ecb2b3970d6a8fc3e2af39b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/bash
SELECT="$1"
OUTPUT="$2"
DATA=`mktemp`
cat > "$DATA"
function gnuplot_conf {
# data format
echo "set timefmt '%Y-%m-%d'"
# X axis
echo "set xlabel ''"
echo "set format x '%b %d'"
echo "set xdata time"
echo "set xtics 1209600 rotate by 45 right font ', 7'"
echo "unset mxtics"
# grid
echo "set grid"
# legend
echo "set key outside bottom center"
# file output (for scripts)
if [ ! -z "$OUTPUT" ]; then
echo "set terminal pngcairo size 960, 480 font 'Liberation Serif,12'"
echo "set output '$OUTPUT'"
fi
# timestamp
TS="{/*0.7 `date`}"
if [ "$SELECT" == "population" ]; then
echo "set title \"Population over time\n$TS\""
echo "set ylabel 'Players'"
echo -n "plot '$DATA' "
echo -n "using 1:2 title 'Mean player count', "
echo "'' using 1:11 title 'Peak player count'"
elif [ "$SELECT" == "ping" ]; then
echo "set title \"Mean ping over time\n$TS\""
echo "set ylabel \"Ping [ms]\""
echo "set yrange [0:240]"
echo "set ytics 20"
echo "set bars 0.5"
echo -n "plot '$DATA' "
echo -n "using 1:3:5 title 'Standard deviation' "
echo -n "with yerrorbars pt 0 lc rgb '#C0C0C0',"
echo -n "'' using 1:3:4 title 'Standard deviation of the mean' "
echo -n "with yerrorbars pt 0 lc rgb 'red',"
echo -n "'' using 1:3 title 'Mean ping' "
echo -n "with points pt 2 lc rgb 'blue'"
elif [ "$SELECT" == "ping-distrib" ]; then
echo "set title \"Ping distribution over time\n$TS\""
echo "set ylabel 'Fraction of players'"
echo "set yrange [0:1]"
echo "set ytics 0.1"
echo -n "plot '$DATA'"
echo -n "using 1:6 title 'Above 60ms', "
echo -n "'' using 1:7 title 'Above 110ms', "
echo -n "'' using 1:8 title 'Above 160ms', "
echo -n "'' using 1:9 title 'Above 210ms', "
echo "'' using 1:10 title 'Above 260ms'"
else
echo "SELECT is wrong" 1>&2
fi
}
if [ -z "$OUTPUT" ]; then
gnuplot -p -c <(gnuplot_conf)
else
gnuplot -c <(gnuplot_conf)
fi
rm -f "$DATA"
|