20611
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
# Author: Makarius
|
|
5 |
#
|
|
6 |
# DESCRIPTION: Produce statistics from isatest session logs.
|
|
7 |
|
|
8 |
ISATEST_LOG=~isatest/log
|
|
9 |
|
|
10 |
|
|
11 |
## diagnostics
|
|
12 |
|
|
13 |
PRG="$(basename "$0")"
|
|
14 |
|
|
15 |
function usage()
|
|
16 |
{
|
|
17 |
echo
|
|
18 |
echo "Usage: $PRG PLATFORM TIMESPAN SESSIONS..."
|
|
19 |
echo
|
|
20 |
echo " Produce statistics from isatest session logs,"
|
|
21 |
echo " looking TIMESPAN days into the past."
|
|
22 |
echo
|
|
23 |
exit 1
|
|
24 |
}
|
|
25 |
|
|
26 |
function fail()
|
|
27 |
{
|
|
28 |
echo "$1" >&2
|
|
29 |
exit 2
|
|
30 |
}
|
|
31 |
|
|
32 |
|
|
33 |
## arguments
|
|
34 |
|
|
35 |
[ "$1" = "-?" ] && usage
|
|
36 |
[ "$#" -lt "3" ] && usage
|
|
37 |
|
|
38 |
PLATFORM="$1"; shift
|
|
39 |
TIMESPAN="$1"; shift
|
|
40 |
SESSIONS="$@"
|
|
41 |
|
|
42 |
|
|
43 |
## main
|
|
44 |
|
|
45 |
ALL_DATA="/tmp/isatest-all$$.dat"
|
|
46 |
SESSION_DATA="/tmp/isatest$$.dat"
|
|
47 |
|
|
48 |
zgrep "^Finished .*elapsed" \
|
|
49 |
$(find -name "isatest-makeall-${PLATFORM}*" -ctime "-${TIMESPAN}") | \
|
|
50 |
perl -e '
|
|
51 |
while (<>) {
|
|
52 |
if (m/isatest-makeall-\w+-\w+-(\d+)-(\d+)-(\d+)-.*:Finished (\S+) \(.*, (\d+):(\d+):(\d+) cpu time\)/) {
|
|
53 |
my $year = $1;
|
|
54 |
my $month = $2;
|
|
55 |
my $day = $3;
|
|
56 |
my $name = $4;
|
|
57 |
my $h = $5;
|
|
58 |
my $m = $6;
|
|
59 |
my $s = $7;
|
|
60 |
|
|
61 |
my $date = $month - 1 + ($day - 1) / 31;
|
|
62 |
my $time = ($h * 3600 + $m * 60 + $s) / 60;
|
|
63 |
|
|
64 |
printf "%s %.2f %.2f\n", $name, $date, $time;
|
|
65 |
}
|
|
66 |
}' > "$ALL_DATA"
|
|
67 |
|
|
68 |
for SESSION in $SESSIONS
|
|
69 |
do
|
|
70 |
fgrep "$SESSION " "$ALL_DATA" > "$SESSION_DATA"
|
|
71 |
gnuplot <<EOF
|
|
72 |
set terminal png
|
|
73 |
set output "${SESSION}.png"
|
|
74 |
plot [] [0:40] "$SESSION_DATA" using 2:3 title "$SESSION" smooth sbezier, "$SESSION_DATA" using 2:3 title "$SESSION" smooth csplines
|
|
75 |
EOF
|
|
76 |
done
|
|
77 |
|
|
78 |
rm -f "$ALL_DATA" "$SESSION_DATA"
|