summaryrefslogtreecommitdiff
path: root/qa/130
blob: 1e2c2a0a08ad11e5125bda59c150287c0e509be5 (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
#! /bin/sh
# PCP QA Test No. 130
# Compare rpc.server metrics with what nfsstat reports
#
# 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

rm -f $seq.out
if [ $PCP_PLATFORM != irix ]
then
    echo "TODO: Need to reconcile rpc.server metrics" >$seq.notrun
    echo "$seq: [not run] `cat $seq.notrun`"
    exit 0
fi

echo checking PCP metric values against: nfsstat -rs

trap "rm -f $tmp.*; exit" 0 1 2 3 15
signal=$PCP_BINADM_DIR/pmsignal

# Don't bother about dupage
# Not very popular and has a bug: pv#652216


cat > $tmp.workload << \EOF
ls -R /hosts/localhost/usr >/dev/null 2>/dev/null &
KILL_PID=$!
sleep 3
$signal -s KILL $KILL_PID >/dev/null 2>&1
EOF
chmod u+x $tmp.workload

$tmp.workload >/dev/null 2>&1
sleep 2

# Example Output:
# > pminfo -f rpc.server
# 
# rpc.server.badcalls
#     value 0
# 
# rpc.server.badlen
#     value 0
# 
# rpc.server.calls
#     value 111217257
# 
# rpc.server.duphits
#     value 426
# 
# rpc.server.nullrecv
#     value 11687166
# 
# rpc.server.xdrcall
#     value 0
# 
# > nfsstat -rs
# 
# Server RPC:
# calls      badcalls   nullrecv   badlen     xdrcall    duphits    dupage
# 111220948  0          11687178   0          0          426        6198.58 


pminfo -f rpc.server >$tmp.pminfo
nfsstat -rs >$tmp.nfs

# acceptance: abs diff within 10 or diff within 5%
#
cat $tmp.pminfo $tmp.nfs | tee $seq.full | $PCP_AWK_PROG '
NF == 0	{ next }
/Server RPC/ { nfstat=1; next }
/rpc.server/ { # pminfo name 
               metric = $1
               sub("rpc.server.", "", metric)
               next
             }
/value/ { # pminfo value
          value=$2
          if (metric == "dupage") {
             value /= 1000
          }
          pminfo[metric] = value
          next
        } 
NF>3 && nfstat==1 && /calls/ { # stat names
          for(i=1;i<=NF;i++){
	     stat_names[i] = $i
          }
	  next
        }
NF>3 && nfstat==1 { # stat values
          for(i=1;i<=NF;i++){
	    name = stat_names[i]
            stat_chk[name] = 1
	    stat_value = $i
            if (! (name in pminfo) ) { 
		print name ": not in pminfo output" 
		next
            }
            pminfo_value = pminfo[name]
            delta = pminfo_value - stat_value
	    if (delta < 0) delta *= -1

            ok=0
	    if (delta < 10) { 
                  ok = 1 
            }
            else {
                if (stat_value == 0) {
                   ok = 0 
                } else { 
		    pct = delta / stat_value
		    ok = (0.95 <= pct && pct <= 1.05)
                }
            }
            if (ok) 
		  print name ": OK"
	    else
		  print name ": mismatch, pcp=" pminfo_value " nfsstat=" stat_value 
          }
        }
END {
	for (name in pminfo) {
           if (! (name in stat_chk) ) {
		print name ": not in stats output" 
           }
        }
    }
' | sort