File: 927

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (130 lines) | stat: -rwxr-xr-x 3,403 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
# PCP QA Test No. 927
#
# Copyright (c) 2017 Ken McDonell.  All Rights Reserved.
#
# New derived metric features:
# - floating point constants
# - relational operators
# - boolean operators
#

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

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

_need_metric kernel.all.uptime

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

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

# Derived metric expr dump from 0x8513a48...
# expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
_filter()
{
    cat $tmp.out >>$here/$seq.full
    awk <$tmp.out >$tmp.sed '
BEGIN				{ n = 0 }
$1 == "expr" && $2 == "node" && $3 ~ /^0x/	{ print "s/" $3 "/<addr-" n ">/"; n++ }
				{ next }'
    echo "=== sed ===" >>$here/$seq.full
    cat $tmp.sed >>$here/$seq.full
    sed -f $tmp.sed <$tmp.out \
    | sed \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
	-e 's/=0x0 /=(nil) /g' \
	-e "s;$tmp;TMP;"
# -e 's/ val=[0-9][0-9]*/ val=<number>/g'
}

_filter2()
{
    sed \
	-e "s;$tmp;TMP;g" \
	-e '/^event\./d' \
    # end
}

export PCP_DERIVED_CONFIG=$tmp.config

# real QA test starts here
cat <<End-of-File >$tmp.config
qa_$seq.bin_2_5 = 2 * sample.bin / 5
qa_$seq.bin_frac = 0.4 * sample.bin
qa_$seq.bin_frac2 = sample.bin * .4
qa_$seq.rel_lt = sample.long.hundred < 101
qa_$seq.rel_leq = 43 - (4 * 10 + (sample.ulonglong.hundred <= 100) + 1)
qa_$seq.rel_neq = instant(sample.seconds) != 0
qa_$seq.rel_true = (sample.long.hundred <= 100) + (sample.long.hundred >= 100) - (sample.long.hundred == 100)
qa_$seq.rel_false = (sample.long.hundred < 100) + (sample.long.hundred > 100) + (sample.long.hundred != 100)
qa_$seq.rel_eq = sample.long.hundred + sample.float.million == sample.double.million + sample.ulonglong.hundred
qa_$seq.bool.and_true = 1 && sample.long.one
qa_$seq.bool.and_false = sample.double.one && 0
qa_$seq.bool.or_complex = sample.long.hundred < 100 || sample.long.hundred > 100 || sample.long.hundred != 100 || sample.long.hundred == 100
End-of-File

echo "expression trees ..."
pminfo -v -Dderive,appl0,appl1 qa_$seq >$tmp.out 2>&1
_filter

echo
echo "live metadata ..."
pminfo -d qa_$seq

echo
echo "live values ..."
pminfo -f qa_$seq

cat <<End-of-File >$tmp.logger.config
log mandatory on 500 msec {
    # need all the metrics in the derived metric expressions above
    sample.bin
    sample.long.one
    sample.long.hundred
    sample.ulonglong.hundred
    sample.float.million
    sample.double.one
    sample.double.million
    sample.seconds
    sample.milliseconds
}
End-of-File

pmlogger -T +1.5sec -c $tmp.logger.config -l $tmp.logger.log $tmp
cat $tmp.logger.log >>$here/$seq.full

echo
echo "archive metadata ..."
PCP_DERIVED_CONFIG= pminfo -d -a $tmp
echo "---"
pminfo -d -a $tmp qa_$seq

echo
echo "archive values ..."
pminfo -f -a $tmp qa_$seq

echo
echo "error cases ..."
cat <<End-of-File >$tmp.config
qa_$seq.bad_neq = sample.seconds #& 0
qa_$seq.bad_and = sample.milliseconds > sample.seconds &@ 1>2
qa_$seq.bad_or = sample.milli|seconds
qa_$seq.bad_non_ctr_dim_right = sample.milliseconds > hinv.physmem
qa_$seq.bad_non_ctr_dim_left = kernel.all.uptime <= sample.milliseconds
End-of-File
pminfo -f 2>&1 qa_$seq | _filter2

# success, all done
status=0
exit