File: 494

package info (click to toggle)
pcp 7.0.5-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,916 kB
  • sloc: ansic: 1,478,844; sh: 177,285; xml: 160,462; cpp: 83,809; python: 24,349; perl: 18,303; yacc: 6,877; lex: 2,864; makefile: 2,694; awk: 165; fortran: 60; java: 52
file content (155 lines) | stat: -rwxr-xr-x 4,388 bytes parent folder | download
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
#!/bin/sh
# PCP QA Test No. 494
# pmlogrewrite man page examples
#
# Copyright (c) 2011 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 pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"

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

_filter()
{
    sed \
	-e "s;$tmp;TMP;g" \
	-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}

_cmp()
{
    if [ ! -f $1.0 ]
    then
	echo "Arrgh ... cannot find $1.0" | _filter
	return
    fi
    if [ ! -f $2.0 ]
    then
	echo "Arrgh ... cannot find $2.0" | _filter
	return
    fi
    pmdumplog -z -dilmst $1 | tee -a $seq_full >$tmp.in
    pmdumplog -z -dilmst $2 | tee -a $seq_full >$tmp.out
    echo "pmdumplog diffs ..."
    diff -u $tmp.in $tmp.out | _filter
}

_cmp2()
{
    if [ ! -f $1.0 ]
    then
	echo "Arrgh ... cannot find $1.0" | _filter
	return
    fi
    if [ ! -f $2.0 ]
    then
	echo "Arrgh ... cannot find $2.0" | _filter
	return
    fi
    echo "--- input metadata ---"
    pminfo -d -a $1 $3
    echo "--- output metadata ---"
    pminfo -d -a $2 $3
    pmval $TIMEZONE -r -f 1 -w 12 -U $1 $3 | tee -a $seq_full >$tmp.in
    pmval $TIMEZONE -r -f 1 -w 12 -U $2 $3 | tee -a $seq_full >$tmp.out
    echo "pmval diffs ..."
    diff -u $tmp.in $tmp.out | _filter
}

TIMEZONE=-z

# real QA test starts here
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]]	spec
# double -> 
archives/rewrite		global { time -> 30 }
archives/rewrite		global { time -> -23:59:59.999 }
archives/rewrite		indom 29.* { indom -> 109.* }
archives/rewrite		metric 30.*.* { pmid -> 123.*.* }
archives/rewrite		indom 29.* { indom -> 109.* } metric sample.bin { indom -> 109.2 }
archives/rewrite		indom 29.* { indom -> 109.* } metric sample.bin { indom -> 123.2 }
archives/proc		indom 60.2 { inst 1 -> 60 iname "1 minute" -> "60 second" inst 5 -> 300 iname "5 minute" -> "300 second" inst 15 -> 900 iname "15 minute" -> "900 second" }
End-of-File
do
    echo | tee -a $seq_full
    echo "$spec" >$tmp.config
    echo "=== `cat $tmp.config` ===" | tee -a $seq_full
    rm -f $tmp.new.*
    pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
    _cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done

TIMEZONE='-Z PST8'
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]]	spec|metric...
# double -> 
archives/babylon.pmview_v2		metric disk.dev.read { type -> U64 } metric disk.dev.write { type -> U64 } metric disk.dev.total { type -> U64 }|disk.dev.read disk.dev.write disk.dev.total
End-of-File
do
    echo | tee -a $seq_full
    metrics=`echo "$spec" | sed -e 's/.*|//'`
    spec=`echo "$spec" | sed -e 's/|.*//'`
    echo "$spec" >$tmp.config
    echo "=== `cat $tmp.config` ===" | tee -a $seq_full
    rm -f $tmp.new.*
    pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
    for m in $metrics
    do
	_cmp2 `echo $arch_args | sed -e 's/|.*//'` $tmp.new $m
    done
done

TIMEZONE=-z
echo | tee -a $seq_full
echo "=== proc metrics migration ===" | tee -a $seq_full
cat <<End-of-File >$tmp.config
# proc metrics are all in 7 clusters
metric 60.8.* { pmid -> 123.*.* }
metric 60.9.* { pmid -> 123.*.* }
metric 60.13.* { pmid -> 123.*.* }
metric 60.24.* { pmid -> 123.*.* }
metric 60.31.* { pmid -> 123.*.* }
metric 60.32.* { pmid -> 123.*.* }
metric 60.51.* { pmid -> 123.*.* }
# only one instance domain for Linux proc metrics
indom 60.9 { indom -> 123.0 }
End-of-File
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config archives/proc $tmp.new 2>&1 | _filter

pminfo -m -a archives/proc | LC_COLLATE=POSIX sort >$tmp.in
pminfo -m -a $tmp.new | LC_COLLATE=POSIX sort >$tmp.out
echo
echo "pmns diffs ..."
diff -u $tmp.in $tmp.out | _filter

for arg in -i -m
do
    pmdumplog -z $arg archives/proc >$tmp.in 2>$tmp.err
    if [ -s $tmp.err ]
    then
	echo "stderr from pmdumplog -z $arg archives/proc ..."
	cat $tmp.err
    fi
    pmdumplog -z $arg $tmp.new >$tmp.out 2>$tmp.err
    if [ -s $tmp.err ]
    then
	echo "stderr from pmdumplog -z $arg $tmp.new ..." | _filter
	cat $tmp.err
    fi
    echo
    echo "pmdumplog $arg diffs ..."
    diff -u $tmp.in $tmp.out | _filter
done

# success, all done
exit