Produce statistics from isatest session logs.
authorwenzelm
Tue Sep 19 20:53:42 2006 +0200 (2006-09-19)
changeset 20611ef4661e2e602
parent 20610 09ef37366a31
child 20612 706c22b3a8fb
Produce statistics from isatest session logs.
Admin/isatest-statistics
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Admin/isatest-statistics	Tue Sep 19 20:53:42 2006 +0200
     1.3 @@ -0,0 +1,78 @@
     1.4 +#!/usr/bin/env bash
     1.5 +#
     1.6 +# $Id$
     1.7 +# Author: Makarius
     1.8 +#
     1.9 +# DESCRIPTION: Produce statistics from isatest session logs.
    1.10 +
    1.11 +ISATEST_LOG=~isatest/log
    1.12 +
    1.13 +
    1.14 +## diagnostics
    1.15 +
    1.16 +PRG="$(basename "$0")"
    1.17 +
    1.18 +function usage()
    1.19 +{
    1.20 +  echo
    1.21 +  echo "Usage: $PRG PLATFORM TIMESPAN SESSIONS..."
    1.22 +  echo
    1.23 +  echo "  Produce statistics from isatest session logs,"
    1.24 +  echo "  looking TIMESPAN days into the past."
    1.25 +  echo
    1.26 +  exit 1
    1.27 +}
    1.28 +
    1.29 +function fail()
    1.30 +{
    1.31 +  echo "$1" >&2
    1.32 +  exit 2
    1.33 +}
    1.34 +
    1.35 +
    1.36 +## arguments
    1.37 +
    1.38 +[ "$1" = "-?" ] && usage
    1.39 +[ "$#" -lt "3" ] && usage
    1.40 +
    1.41 +PLATFORM="$1"; shift
    1.42 +TIMESPAN="$1"; shift
    1.43 +SESSIONS="$@"
    1.44 +
    1.45 +
    1.46 +## main
    1.47 +
    1.48 +ALL_DATA="/tmp/isatest-all$$.dat"
    1.49 +SESSION_DATA="/tmp/isatest$$.dat"
    1.50 +
    1.51 +zgrep "^Finished .*elapsed" \
    1.52 +  $(find -name "isatest-makeall-${PLATFORM}*" -ctime "-${TIMESPAN}") | \
    1.53 +perl -e '
    1.54 +  while (<>) {
    1.55 +    if (m/isatest-makeall-\w+-\w+-(\d+)-(\d+)-(\d+)-.*:Finished (\S+) \(.*, (\d+):(\d+):(\d+) cpu time\)/) {
    1.56 +        my $year = $1;
    1.57 +        my $month = $2;
    1.58 +        my $day = $3;
    1.59 +        my $name = $4;
    1.60 +        my $h = $5;
    1.61 +        my $m = $6;
    1.62 +        my $s = $7;
    1.63 +
    1.64 +        my $date = $month - 1 + ($day - 1) / 31;
    1.65 +        my $time = ($h * 3600 + $m * 60 + $s) / 60;
    1.66 +
    1.67 +        printf "%s %.2f %.2f\n", $name, $date, $time;
    1.68 +    }
    1.69 +  }' > "$ALL_DATA"
    1.70 +
    1.71 +for SESSION in $SESSIONS
    1.72 +do
    1.73 +  fgrep "$SESSION " "$ALL_DATA" > "$SESSION_DATA"
    1.74 +  gnuplot <<EOF
    1.75 +set terminal png
    1.76 +set output "${SESSION}.png"
    1.77 +plot [] [0:40] "$SESSION_DATA" using 2:3 title "$SESSION" smooth sbezier, "$SESSION_DATA" using 2:3 title "$SESSION" smooth csplines
    1.78 +EOF
    1.79 +done
    1.80 +
    1.81 +rm -f "$ALL_DATA" "$SESSION_DATA"