--- a/Admin/isatest-statistics Tue Sep 19 21:49:09 2006 +0200
+++ b/Admin/isatest-statistics Tue Sep 19 21:49:38 2006 +0200
@@ -15,10 +15,10 @@
function usage()
{
echo
- echo "Usage: $PRG PLATFORM TIMESPAN SESSIONS..."
+ echo "Usage: $PRG DIR PLATFORM TIMESPAN SESSIONS..."
echo
- echo " Produce statistics from isatest session logs,"
- echo " looking TIMESPAN days into the past."
+ echo " Produce statistics from isatest session logs, looking TIMESPAN"
+ echo " days into the past. Outputs .png files into DIR."
echo
exit 1
}
@@ -33,8 +33,9 @@
## arguments
[ "$1" = "-?" ] && usage
-[ "$#" -lt "3" ] && usage
+[ "$#" -lt "4" ] && usage
+DIR="$1"; shift
PLATFORM="$1"; shift
TIMESPAN="$1"; shift
SESSIONS="$@"
@@ -44,9 +45,10 @@
ALL_DATA="/tmp/isatest-all$$.dat"
SESSION_DATA="/tmp/isatest$$.dat"
+mkdir -p "$DIR" || fail "Bad directory: $DIR"
zgrep "^Finished .*elapsed" \
- $(find -name "isatest-makeall-${PLATFORM}*" -ctime "-${TIMESPAN}") | \
+ $(find "$ISATEST_LOG" -name "isatest-makeall-${PLATFORM}*" -ctime "-${TIMESPAN}") | \
perl -e '
while (<>) {
if (m/isatest-makeall-\w+-\w+-(\d+)-(\d+)-(\d+)-.*:Finished (\S+) \(.*, (\d+):(\d+):(\d+) cpu time\)/) {
@@ -54,14 +56,9 @@
my $month = $2;
my $day = $3;
my $name = $4;
- my $h = $5;
- my $m = $6;
- my $s = $7;
+ my $time = ($5 * 3600 + $6 * 60 + $7) / 60;
- my $date = $year + ($month - 1) / 31 + ($day - 1) / 365;
- my $time = ($h * 3600 + $m * 60 + $s) / 60;
-
- printf "%s %.2f %.2f\n", $name, $date, $time;
+ printf "$name $year-$month-$day %.2f\n", $time;
}
}' > "$ALL_DATA"
@@ -70,8 +67,12 @@
fgrep "$SESSION " "$ALL_DATA" > "$SESSION_DATA"
gnuplot <<EOF
set terminal png
-set output "${SESSION}.png"
-plot [] [0:50] "$SESSION_DATA" using 2:3 title "$SESSION" smooth sbezier, "$SESSION_DATA" using 2:3 title "$SESSION" smooth csplines
+set output "$DIR/${SESSION}.png"
+set xdata time
+set timefmt "%Y-%m-%d"
+set format x "%d-%b"
+set xlabel "$SESSION"
+plot [] [0:] "$SESSION_DATA" using 2:3 title "" smooth sbezier, "$SESSION_DATA" using 2:3 title "" smooth csplines
EOF
done