1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#! /bin/sh
# PCP QA Test No. 425
# Test out wrapping for pmlogsummary
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_wrap_off()
{
wrap=0
unset PCP_COUNTER_WRAP
echo "--- Wrapping OFF ---"
}
_wrap_on()
{
wrap=1
PCP_COUNTER_WRAP=
export PCP_COUNTER_WRAP
echo "--- Wrapping ON ---"
}
_calc_stats()
{
_archive=$1
_metric=$2
_wrap=$3
pmdumplog $_archive $_metric \
| sed -n -e "/($2)/"'{
s/:/ /
s/:/ /
p
}' \
| $PCP_AWK_PROG -v wrap=$_wrap '
BEGIN { maxuint=4294967295 ; print "wrap =", wrap}
NR==1 { hr=$1; min=$2; offset=0; seen=0 }
$1 != hr || $2 != min { offset+=60*(60*(hr-$1)+(min-$2))
hr=$1; min=$2
}
{ t=offset+$3 }
{ printf $1 ":" $2 ":" $3 " value " $7 }
NR>1 {
newv = $7
printf " delta(t)=" t-lastt
printf " delta(v)=" newv-lastv
print ""
if (newv < lastv && wrap == 1) {
newv += maxuint;
}
rate=(newv-lastv)/(t-lastt)
printf " rate=%f",rate
if (rate > 0) {
avr += rate
count++
if (seen == 0) {
minr = rate
maxr = rate
seen = 1
}
else {
if (rate > maxr) maxr=rate
if (rate < minr) minr=rate
}
}
else
printf " ... SKIP"
}
{ print ""; lastt=t; lastv=$7 }
END { print ""
printf "avg-rate: %f\n",avr/count
printf "max-rate: %f\n",maxr
printf "min-rate: %f\n",minr
}'
}
_compare_results()
{
results=$1
$PCP_AWK_PROG '
function stat_match(val1, val2, label) {
if (val1-tolerance <= val2 && val2 <= val1+tolerance) {
print "matches on", label;
}
else {
print "mismatches on", label;
print "mismatch between:", val1, "and", val2;
}
}
BEGIN { tolerance = 1e7 }
/avg-rate/ { avg_rate = $2; next; }
/max-rate/ { max_rate = $2; next; }
/min-rate/ { min_rate = $2; next; }
/sample.wrap.long/ {
summary_stoch_avg = $2;
summary_time_avg = $3;
summary_min = $4;
summary_max = $5;
stat_match(avg_rate, summary_stoch_avg, "average");
stat_match(min_rate, summary_min, "minimum");
stat_match(max_rate, summary_max, "maximum");
}
/SKIP/ { print "wrap detected"; }
' $results
}
# real QA test starts here
archive="src/wrap"
metric="sample.wrap.long"
_wrap_off > $seq.full
_calc_stats $archive $metric $wrap >> $seq.full
pmlogsummary -bmM $archive $metric >> $seq.full
_wrap_on >> $seq.full
_calc_stats $archive $metric $wrap >> $seq.full
pmlogsummary -bmM $archive $metric >> $seq.full
_compare_results $seq.full
echo
echo "If failure, check $seq.full"
# success, all done
status=0
exit
|