3 # pmlogsummary exerciser
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
32 # pmdumplog -D1 produces something like ...
34 # pmResult dump from 0x100051d0 timestamp: 882429086.522227 18:11:26.522 ...
35 # 29.0.64 (sample.rapid): numval: 1 valfmt: 0 vlist[]:
38 # 29.0.7 (sample.drift): numval: 1 valfmt: 0 vlist[]:
43 # the initial archive processing may cause the same pmResult to
44 # be reported twice, hence the sort at the end
46 # _xtract produces 3 columns: time time_t value
48 # Usage: _xtract metric
50 pmdumplog
-D1 $tmp.merge
$1 2>&1 \
52 $1 == "pmResult" { state=1; time=$7; stamp=$6; next }
53 state == 1 && /\('"$1"'\)/ { state=2; next }
54 state == 2 { state=0; print time,stamp,$2; next }
55 NF==0 { state=0; next }' \
56 | LC_COLLATE
=POSIX _POSIX2_VERSION
=0 sort -u +1n
-2
61 $debug && echo "+ check pmlogsummary=$1 qa=$2"
64 { if ($1 == 0 && $2 == 0)
70 if (-0.05 <= err && err <= 0.05)
73 print "Fail: pmlogsummary=" $1 " qa=" $2
79 _check_counter_stocave
()
81 from_summary
=`pmlogsummary -x $tmp.merge $1 \
82 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
84 echo "_check_counter_stocave" >>$seq.full
85 from_qa
=`_xtract $1 | tee -a $seq.full | $PCP_AWK_PROG '
88 avg += ($3 - prevval)/($2 - prevtime)
95 END { print avg/(count-1) }'`
97 _check
$from_summary $from_qa
102 _check_noncounter_stocave
()
104 from_summary
=`pmlogsummary -x $tmp.merge $1 \
105 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
107 from_qa
=`pmdumplog -m $tmp.merge $1 | $PCP_AWK_PROG '
108 /\('"$1"'\)/ { sum += $5; count++; next }
109 END { print sum/count }'`
111 _check
$from_summary $from_qa
116 _check_counter_timeave
()
118 from_summary
=`pmlogsummary $tmp.merge $1 \
119 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
121 from_qa
=`_xtract $1 | $PCP_AWK_PROG '
123 if (count > 0) avg += ($3 - prevval)
124 if (count == 0) firsttime = $2
130 END { print avg/(lasttime-firsttime) }'`
132 _check
$from_summary $from_qa
137 _check_noncounter_timeave
()
139 from_summary
=`pmlogsummary $tmp.merge $1 \
140 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
142 from_qa
=`_xtract $1 | $PCP_AWK_PROG '
144 if (count > 0) avg += (prevval * ($2 - prevtime))
145 if (count == 0) firsttime = $2
151 END { print avg/(prevtime-firsttime) }'`
153 _check
$from_summary $from_qa
160 pmdumplog
-m $tmp.merge sample.drift |
$PCP_AWK_PROG '
161 /sample.drift/ { if (($5 < min) || (count < 1)) min = $5; count++; next }
162 END { printf "%.3f",min }'
167 pmdumplog
-m $tmp.merge sample.drift |
$PCP_AWK_PROG '
168 /sample.drift/ { if (($5 > max) || (count < 1)) max = $5; count++; next }
169 END { printf "%.3f",max }'
174 $PCP_AWK_PROG -v min
=$minimum -v max
=$maximum '
176 if ($3 == min) print "Minimum test passed."
177 else printf "Minimum test failed (pmlogsummary:%.3f != qa:%.3f)\n",$3,min
178 if ($4 == max) print "Maximum test passed."
179 else printf "Maximum test failed (pmlogsummary:%.3f != qa:%.3f)\n",$4,max
186 # use stochastic average of counter
190 from_summary
=`pmlogsummary -x $tmp.merge $1 \
191 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
193 from_qa
=`_xtract $1 \
195 BEGIN { prevval = -1; print "scale=3"; printf "( 0" }
199 printf " + ((%f-%f)/(%f-%f))",$3,prevval,$2,prevtime
207 END { printf ") / %d\n",count }' \
210 _check
$from_summary $from_qa
213 # use stochastic average of counter
215 _check_old_overflow
()
218 export PCP_COUNTER_WRAP
220 from_summary
=`pmlogsummary -x $tmp.merge $1 \
221 | $PCP_AWK_PROG '$1 == "'$1'" { print $2 }'`
223 from_qa
=`_xtract $1 \
225 BEGIN { prevval = -1; print "scale=3"; printf "( 0" }
230 # this wrap adjustment only works for 32-bit counters
232 if (current < prevval) current += (4294967295+1)
233 printf " + ((%f-%f)/(%f-%f))",current,prevval,$2,prevtime
240 END { printf ") / %d\n",count }' \
243 _check
$from_summary $from_qa
248 # real QA test starts here
250 cat >$tmp.a.config
<<End-of-File
251 log mandatory on 30 msec {
259 cat >$tmp.b.config
<<End-of-File
260 log mandatory on 90 msec {
268 echo "Creating log files ..."
269 $sudo rm -f $tmp.a
.0 $tmp.a.meta
$tmp.a.index
270 $sudo rm -f $tmp.b
.0 $tmp.b.meta
$tmp.b.index
271 pmlogger
-c $tmp.a.config
-l $tmp.a.log
-s 3 $tmp.a
>$tmp.a.err
2>&1
272 pmlogger
-c $tmp.b.config
-l $tmp.b.log
-s 5 $tmp.b
>$tmp.b.err
2>&1
274 echo "=== tmp.a ===" >>$seq.full
275 pmdumplog
$tmp.a
>>$seq.full
276 echo "=== tmp.b ===" >>$seq.full
277 pmdumplog
$tmp.b
>>$seq.full
281 cat $tmp.a.err
$tmp.a.log | _filter_pmlogger_log
282 cat $tmp.b.err
$tmp.b.log | _filter_pmlogger_log
286 pmlogextract
$tmp.a
$tmp.b
$tmp.merge
288 echo "=== tmp.merge ===" >>$seq.full
289 pmdumplog
$tmp.merge
>>$seq.full
291 # ensure no mark records in archive...
293 mv $tmp.merge
.0 $tmp.markedmerge
.0
294 src
/stripmark
$tmp.markedmerge
.0 $tmp.merge
.0 2>&1 \
295 |
sed -e 's/byte [0-9][0-9]*/byte N/'
298 echo "Checking non-counter stochastic average (sample.drift) ..."
299 _check_noncounter_stocave sample.drift
302 echo "Checking non-counter time average (sample.drift) ..."
303 _check_noncounter_timeave sample.drift
306 echo "Checking counter stochastic average (sample.xmit_pdu) ..."
307 _check_counter_stocave sample.xmit_pdu
310 echo "Checking counter time averaging (sample.xmit_pdu) ..."
311 _check_counter_timeave sample.xmit_pdu
314 echo "Checking minimum & maximum ..."
315 minimum
=`_qa_minimum`
316 maximum
=`_qa_maximum`
317 pmlogsummary
-mM $tmp.merge | _check_minmax
320 echo "Checking overflow (sample.rapid) ..."
321 _check_overflow sample.rapid
324 echo "Checking PCP 1.x style overflow (sample.rapid) ..."
325 _check_old_overflow sample.rapid