4 # Derived metrics - exercise pmFetch processing
6 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
17 if grep -q 'pmRegisterDerived' $PCP_DIR/usr
/include
/pcp
/pmapi.h
21 echo "No derived metric support" >$seq.notrun
22 echo "$seq: [not run] `cat $seq.notrun`"
26 unset PCP_DERIVED_CONFIG
28 status
=0 # success is the default!
29 $sudo rm -rf $tmp.
* $seq.full
30 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
32 # Derived metric expr dump from 0x8513a48...
33 # expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
36 cat $tmp.out
>>$seq.full
37 awk <$tmp.out
>$tmp.
sed '
39 $1 == "expr" && $2 == "node" && $3 ~ /^0x/ { print "s/" $3 "/<addr-" n ">/"; n++ }
41 echo "=== sed ===" >>$seq.full
42 cat $tmp.
sed >>$seq.full
43 sed -f $tmp.
sed <$tmp.out \
45 -e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
46 -e 's/=0x0 /=(nil) /g' \
48 # -e 's/ val=[0-9][0-9]*/ val=<number>/g'
51 # expr node <addr-6> type=NAME left=(nil) right=(nil) save_last=1 [sample.pdu] master=0
53 # [0] inst=-1, val=49794
56 sed <$tmp.out
-e 's/val=/val /' \
59 /expr.*sample\./ { want=1; next }
60 want == 1 && $3 == "val" { if (seen[$4] != "y") {
61 print "s/ val=" $4 "$/ val=<value-" n ">/"
66 $1 == "expr" { want = 0 }'
67 echo "=== sed2 ===" >>$seq.full
68 cat $tmp.sed2
>>$seq.full
72 # real QA test starts here
74 echo "No errors here ..." |
tee -a $seq.full
75 cat <<End-of-File >$tmp.config
76 # simple constant, no arithmetic
78 # simple renaming to test all data types ... no arithmetic
79 myname.a = sample.long.million
80 myname.b = sample.longlong.million
81 myname.c = sample.float.million
82 myname.d = sample.double.million
83 myname.e = sample.string.null
84 myname.f = sample.string.hullo
85 myname.g = sample.string.write_me
87 myname.h = sample.long.million + sample.long.hundred + sample.long.ten + sample.long.one
88 myname.i = sample.longlong.million - sample.longlong.hundred - sample.longlong.ten - sample.longlong.one
89 myname.j = sample.float.million - sample.float.hundred * sample.float.ten / sample.float.one
90 myname.k = sample.long.million - ( sample.float.hundred * sample.double.hundred * sample.longlong.hundred ) + sample.long.one
91 # arithmetic over sets of values (instance domains)
92 myname.l = sample.bin / 50
93 myname.m = 3*sample.bin
94 myname.n = sample.bin + sample.bucket*2 - (sample.bin + 100) - sample.bucket
99 for args
in myname.const myname.a myname
"myname.a sample.long" \
100 "sample.long myname.a" "sample.longlong myname.a myname.b sample.long" \
101 "sample.string myname.f sample.bin myname"
103 echo |
tee -a $seq.full
104 echo "=== $args ===" |
tee -a $seq.full
105 pminfo
-c $tmp.config
-Dfetch,derive
,appl2
-f $args >$tmp.out
2>&1
109 echo |
tee -a $seq.full
110 echo "All the arithmetic operators and operand types ..." |
tee -a $seq.full
111 cat <<End-of-File >$tmp.config
112 arith.l = sample.load - sample.load + sample.load / sample.load * sample.load - sample.load
113 arith.ul = sample.daemon_pid - sample.daemon_pid + sample.daemon_pid / sample.daemon_pid * sample.daemon_pid - sample.daemon_pid
114 arith.ll = sample.longlong.hundred - sample.longlong.hundred + sample.longlong.hundred / sample.longlong.hundred * sample.longlong.hundred - sample.longlong.hundred
115 arith.ull = sample.ulonglong.hundred - sample.ulonglong.hundred + sample.ulonglong.hundred / sample.ulonglong.hundred * sample.ulonglong.hundred - sample.ulonglong.hundred
116 arith.f = sample.float.hundred - sample.float.hundred + sample.float.hundred / sample.float.hundred * sample.float.hundred - sample.float.hundred
117 arith.d = sample.double.hundred - sample.double.hundred + sample.double.hundred / sample.double.hundred * sample.double.hundred - sample.double.hundred
118 arith.promote.l_l_r_ll = sample.long.one + sample.longlong.hundred
119 arith.promote.l_ll_r_l = sample.longlong.hundred + sample.long.one
120 arith.promote.l_ll_r_ul = sample.longlong.hundred + sample.ulong.one
121 arith.promote.l_ull_r_l = sample.ulonglong.hundred + sample.long.one
122 arith.promote.l_l_r_ull = sample.long.one + sample.ulonglong.hundred
123 arith.promote.l_ul_r_ull = sample.ulong.one + sample.ulonglong.hundred
124 arith.promote.l_ull_r_ul = sample.ulonglong.hundred + sample.ulong.one
125 arith.promote.l_l_r_f = sample.long.one + sample.float.hundred
126 arith.promote.l_ul_r_f = sample.ulong.one + sample.float.hundred
127 arith.promote.l_ll_r_f = sample.longlong.one + sample.float.hundred
128 arith.promote.l_ull_r_f = sample.ulonglong.one + sample.float.hundred
129 arith.promote.l_f_r_l = sample.float.hundred + sample.long.one
130 arith.promote.l_f_r_ul = sample.float.hundred + sample.ulong.one
131 arith.promote.l_f_r_ll = sample.float.hundred + sample.longlong.one
132 arith.promote.l_f_r_ull = sample.float.hundred + sample.ulonglong.one
133 arith.eval.mul.l_l_r_l = sample.long.ten * sample.long.hundred
134 arith.eval.mul.l_ull_r_ull = sample.ulonglong.ten * sample.ulonglong.hundred
135 arith.eval.div.l_f_r_f = sample.float.hundred / sample.float.ten
136 arith.eval.div.l_zero_f_r_f = 0 / sample.float.ten
137 arith.eval.div.l_zero_d_r_d = 0 / sample.double.ten
138 arith.eval.op.l_err = sample.needprofile + 1
139 arith.eval.op.r_err = 1 + sample.needprofile
144 pminfo
-c $tmp.config
-Dderive,appl2
-f arith
>$tmp.out
2>&1
145 _filter
<$tmp.out | _filter2
147 echo |
tee -a $seq.full
148 echo "Errors and empty results here ..." |
tee -a $seq.full
149 cat <<End-of-File >$tmp.config
150 myname.a = sample.needprofile
151 myname.b = 100 + sample.long.hundred * ( 2 - sample.needprofile )
152 myname.c = sample.needprofile - sample.not_ready
153 myname.d = sample.not_ready - sample.needprofile
154 myname.e = sample.noinst
155 myname.f = ( sample.long.hundred + sample.long.one ) * ( sample.noinst - 1 )
162 echo |
tee -a $seq.full
163 echo "=== $args ===" |
tee -a $seq.full
164 pminfo
-c $tmp.config
-Dfetch,derive
,appl0
,appl2
-f $args >$tmp.out
2>&1