summaryrefslogtreecommitdiff
path: root/qa/370
blob: 69dc7ca360b382e49a0003b0febb78b951078bfb (plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/sh
# PCP QA Test No. 370
#
# exercise sar2pcp
#
# Copyright (c) 2012 Red Hat.
# Copyright (c) 2010 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

which sar >/dev/null 2>&1 || _notrun "sar not installed"
which sadf >/dev/null 2>&1 || _notrun "sadf not installed"
which sar2pcp >/dev/null 2>&1 || _notrun "sar2pcp not installed"

version=`sar -V 2>&1 | sed -n -e '/sysstat version /{
s/.* //
p
}'`

rm -f $seq.out
file_version=$version
case "$version"
in
    9.0.4*)	# RHEL6
	ln $seq.out.4 $seq.out || exit 1
	file_version=9.0.4
	;;
    9.0.6.1)
	ln $seq.out.5 $seq.out || exit 1
	;;
    9.0.6*)
	ln $seq.out.1 $seq.out || exit 1
	file_version=9.0.6
	;;
    9.1.7*)
	ln $seq.out.2 $seq.out || exit 1
	file_version=9.1.7
	;;
    10.0.1*)
	ln $seq.out.3 $seq.out || exit 1
	file_version=10.0.1
	;;
    10.0.5*)
	ln $seq.out.6 $seq.out || exit 1
	file_version=10.0.5
	;;
    10.2.0)
	ln $seq.out.7 $seq.out || exit 1
	;;
    *)
	_notrun "no qualified output for sysstat version $version"
	;;
esac
[ -f src/sa-sysstat-$file_version ] || \
    _notrun "no data file (sa-sysstat-$file_version) for sysstat version $version"

status=0	# success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here

sar2pcp src/sa-sysstat-$file_version $tmp

# version 9.x output
# 11:07:39        CPU     %user     %nice   %system   %iowait    %steal     %idle
# 11:07:44        all      3.20      0.10      1.60      0.00      0.00     95.10
#
# version 10.x output
# 04:50:52 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
# 04:50:57 PM     all      0.31      0.00      0.31      0.00      0.00     99.38
#
sar -f src/sa-sysstat-$file_version -u \
| tee -a $seq.full \
| sed -n '/^[0-2][0-9]:/{
s/^00\(:..:..\) PM/12\1/
s/^01\(:..:..\) PM/13\1/
s/^02\(:..:..\) PM/14\1/
s/^03\(:..:..\) PM/15\1/
s/^04\(:..:..\) PM/16\1/
s/^05\(:..:..\) PM/17\1/
s/^06\(:..:..\) PM/18\1/
s/^07\(:..:..\) PM/19\1/
s/^08\(:..:..\) PM/20\1/
s/^09\(:..:..\) PM/21\1/
s/^10\(:..:..\) PM/22\1/
s/^11\(:..:..\) PM/23\1/
s/^\(..:..:..\) AM/\1/
p
}' \
| $PCP_AWK_PROG >$tmp.sar '
NR == 1		{ next }
		# percent to utilization
		{ for (i = 2; i <= NF; i++) { $i = $i / 100 }
		  print
		}'

echo "check user CPU time ..."
pmval -f 8 -t 5 -a $tmp kernel.all.cpu.user \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "kernel.all.cpu.user" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($3-$NF > 0.000001 || $3-$NF < -0.000001) print "[",NR,"] mismatch:",$1,$3,$NF }'

echo
echo "check timestamps ..."
$PCP_AWK_PROG <$tmp.both '
$1 != $9	{ print "[",NR,"] mismatch:",$0 }'

echo
echo "check sys CPU time ..."
# note sar's -u view of system is really sys+intr
# ... saved by derived metrics!
# also need to relax tolerance in comparison, 'cause sar seems to get
# the arithmetic "not quite right" (tm)
echo "system = kernel.all.cpu.sys + kernel.all.cpu.intr" >$tmp.config
export PCP_DERIVED_CONFIG=$tmp.config
pmval -f 8 -t 5 -a $tmp system \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "system = kernel.all.cpu.sys + kernel.all.cpu.intr" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($5-$NF > 0.001 || $5-$NF < -0.001) print "[",NR,"] mismatch:",$1,$5,$NF }'

echo >>$seq.full
# version 9.x output
# 11:07:39          tps      rtps      wtps   bread/s   bwrtn/s
# 11:07:44         0.00      0.00      0.00      0.00      0.00
#
# version 10.x output
# 04:50:52 PM       tps      rtps      wtps   bread/s   bwrtn/s
# 04:50:57 PM      0.80      0.00      0.80      0.00      6.40
#
sar -f src/sa-sysstat-$file_version -b \
| tee -a $seq.full \
| sed -n '/^[0-2][0-9]:/{
s/^00\(:..:..\) PM/12\1/
s/^01\(:..:..\) PM/13\1/
s/^02\(:..:..\) PM/14\1/
s/^03\(:..:..\) PM/15\1/
s/^04\(:..:..\) PM/16\1/
s/^05\(:..:..\) PM/17\1/
s/^06\(:..:..\) PM/18\1/
s/^07\(:..:..\) PM/19\1/
s/^08\(:..:..\) PM/20\1/
s/^09\(:..:..\) PM/21\1/
s/^10\(:..:..\) PM/22\1/
s/^11\(:..:..\) PM/23\1/
s/^\(..:..:..\) AM/\1/
p
}' \
| $PCP_AWK_PROG >$tmp.sar '
NR == 1		{ next }
		# blocks to Kbytes
		{ for (i = 5; i <= NF; i++) { $i = $i /2 }
		  print
		}'

echo
echo "check user disk iops ..."
# units are iops, so within 0.01 iop is ok
pmval -f 8 -t 5 -a $tmp disk.all.total \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "disk.all.total" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($2-$NF > 0.01 || $2-$NF < -0.01) print "[",NR,"] mismatch:",$1,$2,$NF }'

echo
echo "check user disk write thruput ..."
# units are iops, so within 0.01 iop is ok
pmval -f 8 -t 5 -a $tmp disk.all.write_bytes \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "disk.all.write_bytes" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($6-$NF > 0.01 || $6-$NF < -0.01) print "[",NR,"] mismatch:",$1,$6,$NF }'

echo
echo "full dump ..."
# note proc.nprocs -> proc.nproc mapping needed after sar2pcp changes in
# commit 48e373f0609a0a0804bc052d5e9dec41a5a2928e so output matches 370's
# "out" files
#
pmdumplog -lm -z $tmp 2>&1 \
| sed \
	-e 's/245\.0\.[0-9][0-9]*/245.0.NN/g' \
	-e 's/(proc.nprocs)/(proc.nproc)/'

# success, all done
exit