3 # exercise pmlogsummary "-B" option (display value distribution in bins)
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
15 status
=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # usage: _xtract metric
21 pmdumplog
-D1 archives
/binning
$1 >$tmp.out
2>$tmp.err
22 cat $tmp.err
$tmp.out \
24 $1 == "pmResult" { state=1; time=$7; stamp=$6; next }
25 state == 1 && /\('"$1"'\)/ { state=2; next }
26 state == 2 { state=0; print time,stamp,$2; next }
27 NF==0 { state=0; next }' \
28 | LC_COLLATE
=POSIX _POSIX2_VERSION
=0 sort -u +1n
-2
31 # usage: _filterbins nbins < pmlogsummary output (with args=-ymMB nbins)
34 $PCP_AWK_PROG -v nbins
=$1 '{
36 for (i=0; i < nbins; i++)
37 printf " Bin%d = %d\n", i, $(7+(i*2))
41 # usage: _dobinning nbins min max < values
44 size
=`echo "scale=10; ( $3 - $2 ) / $1" | bc`
45 #echo BINSIZE=$size NBINS=$1
47 $PCP_AWK_PROG -v nbins
=$1 -v size
=$size -v min
=$2 '
48 { for (i=0; i < nbins; i++) {
49 if ($1 >= (size*i) + min && $1 <= (size*(i+1))+min) {
50 #printf "%f is in bin %d\n", $1, i
55 #printf "%f out of %f-%f\n", $1, (size*i)+min, (size*(i+1))+min
57 #printf "value is %f\n", $1
59 END { printf "(%d)\n", total
60 for (i=0; i < nbins; i++)
61 printf " Bin%d = %d\n", i, bins[i]
69 if (count == 0 || $3 > max) max = $3
70 if (count == 0 || $3 < min) min = $3
74 END { printf "COUNT=%d MAX=%f MIN=%f\n", count, max, min }'
81 value = (($3 - prevval)/($2 - prevtime))/1000.0
83 if (count == 1 || value > max) max = value
84 if (count == 1 || value < min) min = value
91 END { printf "COUNT=%d MAX=%f MIN=%f\n", count-1, max, min }'
94 # real QA test starts here
96 echo "=== testing instanteous metric value distribution ==="
98 _xtract sample.scale_step.time_up_nanosecs | _noncounter_values
> $tmp.noncount
99 eval `fgrep COUNT $tmp.noncount`
100 #echo count=$COUNT maximum=$MAX minimum=$MIN
101 $PCP_ECHO_PROG $PCP_ECHO_N "QA calculates: ""$PCP_ECHO_C"
102 fgrep
-v COUNT
$tmp.noncount | _dobinning
$nbins $MIN $MAX
104 $PCP_ECHO_PROG $PCP_ECHO_N "pmlogsummary calculates: ""$PCP_ECHO_C"
105 pmlogsummary
-ymMB $nbins archives
/binning sample.scale_step.time_up_nanosecs \
109 echo "=== testing counter metric value distribution ==="
111 _xtract sample.milliseconds | _counter_values
> $tmp.count
112 eval `fgrep COUNT $tmp.count`
113 #echo count=$COUNT maximum=$MAX minimum=$MIN
114 $PCP_ECHO_PROG $PCP_ECHO_N "QA calculates: ""$PCP_ECHO_C"
115 fgrep
-v COUNT
$tmp.count | _dobinning
$nbins $MIN $MAX
117 $PCP_ECHO_PROG $PCP_ECHO_N "pmlogsummary calculates: ""$PCP_ECHO_C"
118 pmlogsummary
-ymMB $nbins archives
/binning | fgrep sample.milliseconds \
123 echo "=== testing boundary conditions ==="
124 pmlogsummary
-B 1 archives
/binning
>/dev
/null
2>&1
125 [ $?
-ne 0 ] && echo " urk - error test #1 failed!"
126 pmlogsummary
-B 0 archives
/binning
>/dev
/null
2>&1
127 [ $?
-ne 0 ] && echo " urk - error test #2 failed!"
128 pmlogsummary
-B -7 archives
/binning
>/dev
/null
2>&1
129 [ $?
-eq 0 ] && echo " urk - error test #3 failed!"