1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-22 00:20:36 +02:00
wernermisc/ircstat/stat
Werner Almesberger 0508e23104 ircstat/stat, ircstat/mlstat: print month/year only every 4th month
While still readable in the X11 output, the month/year labels got too
close in the PNG output. We thus only print them every 4th month now,
instead of every 3rd.
2013-05-01 14:01:34 -03:00

60 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
Q=en.qi-hardware.com/irclogs/qi-hardware
M=en.qi-hardware.com/mmlogs/milkymist
# Saving to: `en.qi-hardware.com/irclogs/qi-hardware_2010-06-11.log.html'
all=false
case "$1" in
-a) all=true;;
"") break;;
*) echo "usage: $0 [-a]" 1>&2
exit 1;;
esac
N=4
t=
>_out
n=0
off=2
for y in 10 11 12 13; do
for m in 1 2 3 4 5 6 7 8 9 10 11 12; do
mm=`printf "%02d" $m`
[ "`echo ${Q}_20${y}-${mm}-*`" = "${Q}_20${y}-${mm}-*" ] &&
[ "`echo ${M}_20${y}-${mm}-*`" = "${M}_20${y}-${mm}-*" ] &&
continue
if [ `expr $n % $N` = 0 ]; then
[ "$t" ] && t=$t,
t="$t \"$m/$y\" $n"
else
t="$t, \"\" $n"
fi
# cat ${Q}_20${y}-${mm}-*.log.html | gzip -9 | wc -c >>_out
qn=`sed 's/<[^>]*>/ /g' ${Q}_20${y}-${mm}-*.log.html |
gzip -9 | wc -c`
mn=`sed 's/<[^>]*>/ /g' ${M}_20${y}-${mm}-*.log.html |
gzip -9 | wc -c`
echo $qn $mn >>_out
n=`expr $n + 1`
done
done
if $all; then
src=_out
else
src="<sed '\$d' _out"
fi
gnuplot -persist <<EOF
set xtics ($t)
set grid xtics
set title "Traffic on the Qi-Hardware IRC channels"
set xlabel "Month"
set ylabel "Traffic (kbytes gzip'ed)"
plot "$src" using (\$1/1000) with lines title "#qi-hardware" lw 2, \
"$src" using (\$2/1000) with lines title "#milkymist" lw 2, \
"$src" using :((\$1+\$2)/1000) with lines title "Both" lw 2
set term png
set output "out.png"
replot
EOF