3 # check for mem leaks in pmlogrewrite
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 which pmlogrewrite
>/dev
/null
2>&1 || _notrun
"pmlogrewrite not installed"
19 status
=0 # success is the default!
20 $sudo rm -rf $tmp.
* $seq.full
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
27 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
34 echo "Arrgh ... $1.0 missing" | _filter
39 echo "Arrgh ... $2.0 missing" | _filter
42 pmdumplog
-z -a $1 |
tee -a $seq.full |
sed -e '/\[[0-9][0-9]* bytes]/d' >$tmp.
in
43 pmdumplog
-z -a $2 |
tee -a $seq.full |
sed -e '/\[[0-9][0-9]* bytes]/d' >$tmp.out
44 if [ -n "$oldfilter" ]
46 $oldfilter <$tmp.
in >$tmp.tmp
49 if [ -n "$newfilter" ]
51 $newfilter <$tmp.out
>$tmp.tmp
54 echo "pmdumplog diffs ..."
55 diff -u $tmp.
in $tmp.out | _filter
58 # find sample.mirage values and rescale like pmlogrewrite is expected to
60 # 10:47:07.419 29.0.37 (sample.mirage):
61 # inst [0 or "m-00"] value 27
62 # inst [12 or "m-12"] value 1226
63 # inst [13 or "m-13"] value 1325
64 # inst [15 or "m-15"] value 1524
65 # inst [16 or "m-16"] value 1623
66 # 29.0.7 (sample.drift): value 88
70 /\(sample.mirage\):/ { xlate=1; print; next }
71 xlate == 1 && $1 != "inst" { xlate = 0 }
72 xlate == 1 && $1 == "inst" { $6 = int((3600*$6 + 512)/1024) }
76 # same as _scale, w/out scale conversion ... copy awk whitespace rewriting
80 /\(sample.mirage\):/ { xlate=1; print; next }
81 xlate == 1 && $1 != "inst" { xlate = 0 }
82 xlate == 1 && $1 == "inst" { $6 = $6+0 }
86 # real QA test starts here
88 cat <<End-of-File >$tmp.conf
90 hostname -> whizz-bang.engr.sgi.com
96 iname "15 minute" -> "forever"
97 iname "1 minute" -> "1 minute is not very long unlike this string"
100 metric 1.*.* { pmid -> 42.*.* }
101 metric irix.kernel.all.load { name->load type->double }
102 metric hinv.ncpu { name->hinv.number_of_cpus type->U64 }
105 cat $tmp.conf
>>$seq.full
106 _run_valgrind pmlogrewrite
-c $tmp.conf archives
/src-rattle
$tmp.new
2>$tmp.err | _filter
107 cat $tmp.err
>>$seq.full
108 _cmp archives
/src-rattle
$tmp.new
110 cat <<End-of-File >$tmp.conf
111 metric sample.mirage_longlong { type->U32 indom->NULL }
112 metric sample.scale_step.time_up_secs { type->FLOAT units->0,1,0,0,MSEC,0 }
115 cat $tmp.conf
>>$seq.full
116 _run_valgrind pmlogrewrite
-c $tmp.conf archives
/sample_expr
$tmp.new
2>$tmp.err | _filter
117 cat $tmp.err
>>$seq.full
118 _cmp archives
/sample_expr
$tmp.new
120 cat <<End-of-File >$tmp.conf
121 metric sample.bin { name -> x23456789.sample.bin type -> 64 }
122 metric sample.mirage { type -> FLOAT units -> 1,-1,0,MBYTE,HOUR,0 }
123 metric sample.drift { delete }
125 iname "bin-100" -> delete
126 iname "bin-400" -> delete
127 iname "bin-500" -> delete
128 iname "bin-600" -> delete
130 indom 29.3 { iname "m-00" -> delete inst 33 -> delete }
133 cat $tmp.conf
>>$seq.full
134 _run_valgrind pmlogrewrite
-s -c $tmp.conf archives
/mirage
$tmp.new
2>$tmp.err | _filter
135 cat $tmp.err
>>$seq.full
138 _cmp archives
/mirage
$tmp.new
141 echo "=== correctness checked in QA 493 ... only care about valgrind here ==="
142 cat <<End-of-File >$tmp.conf
143 metric sample.ulong.bin_ctr {
144 indom -> NULL output MIN
146 units -> 1,0,0,BYTE,0,0
148 metric sample.ulonglong.bin_ctr {
149 indom -> NULL output MAX
151 units -> 1,0,0,BYTE,0,0
153 metric sampledso.double.bin_ctr {
154 indom -> NULL output AVG
157 metric sample.float.bin_ctr {
158 indom -> NULL output SUM
161 metric sample.longlong.bin_ctr {
162 indom -> NULL output FIRST
164 units -> 1,-1,0,KBYTE,SEC,0
166 indom 29.2 { inst 200 -> DELETE }
167 indom 30.2 { inst 800 -> DELETE }
170 cat $tmp.conf
>>$seq.full
171 _run_valgrind pmlogrewrite
-s -c $tmp.conf archives
/mirage
$tmp.new
2>$tmp.err | _filter
172 cat $tmp.err
>>$seq.full