Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 034
blobef79cd714c4b0ad0910fd46f05c4e5d47d3f54ae
1 #! /bin/sh
2 # PCP QA Test No. 034
3 # pmlogger with different logging rates
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
15 trap "rm -f $tmp.*; exit" 0 1 2 3 15
17 # real QA test starts here
20 # Logs are built for 70 samples (-s70) (see Makefile)
21 # The sample metric rates are 100msec, 500msec, 900msec
22 # Theoretically,....
23 # This means that (x + x/5 + x/9 = 70) for integral x.
24 # => 59x = 70 * 45
25 # => x ~= 53.39
26 # But x is integral
27 # So, x = 54, x/5 = 10, x/9 = 6 (54 + 10 + 6 = 70)
29 # Note below that n[i] is not incremented on its 1st occurrence
30 # => expect values of 53, 9, 5
32 for arch in tmparch/bar tmparch/mv-bar tmparch/noti-bar
34 echo
35 echo "=== $arch ==="
36 pmdumplog $arch \
37 | sed -e 's/:/ /g' \
38 | $PCP_AWK_PROG '
39 /^[0-9]/ { print $3,$NF }' \
40 | $PCP_AWK_PROG '
41 { if (l[$2] != "") {
42 delta = $1 - l[$2];
43 if (delta < 0)
44 delta += 60;
45 # print $2,delta
46 t[$2] += delta
47 n[$2]++
49 l[$2] = $1
51 END { for (i in n) {
52 printf "%d msec requested: ",i
53 if (n[i] != 0)
54 ave = 1000*t[i]/n[i]
55 else
56 ave = 0
57 if (i == 100 && 51 <= n[i] && n[i] <= 54)
58 printf "no. of samples within range, "
59 else if (i == 500 && 9 <= n[i] && n[i] <= 11)
60 printf "no. of samples within range, "
61 else if (i == 900 && 4 <= n[i] && n[i] <= 6)
62 printf "no. of samples within range, "
63 else
64 printf "no. of samples (%d) unexpected, ",n[i]
65 if (0.9 * i <= ave && ave <= 1.1 * i)
66 printf "avg within 10%% of requested delay\n"
67 else
68 printf "avg (%.2f msec) outside 10%% of requested delay\n",1000*t[i]/n[i]
70 }' \
71 | LC_COLLATE=POSIX sort
72 done