summaryrefslogtreecommitdiff
path: root/qa/922
blob: cd92d266b70945adf546708f039e1a746e66fcee (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh
# PCP QA Test No. 922
# exercise rate() function for derived metrics
#
# Copyright (c) 2014 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

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

# real QA test starts here

cat <<End-of-File >$tmp.config
delta.cpu.user = delta(kernel.all.cpu.user)
rate.cpu.user = rate(kernel.all.cpu.user)

delta.milliseconds = delta(sample.milliseconds)
rate.milliseconds = rate(sample.milliseconds)

delta.seconds = delta(sample.seconds)
rate.seconds = rate(sample.seconds)

delta.step_counter = delta(sample.step_counter)
rate.step_counter = rate(sample.step_counter)

delta.kbyte_ctr = delta(sample.kbyte_ctr)
rate.kbyte_ctr = rate(sample.kbyte_ctr)

End-of-File

echo "--- kernel.all.cpu.user ---"

cat <<End-of-File >$tmp.pmie
raw = kernel.all.cpu.user;
delta.cpu = delta.cpu.user;
rate.cpu = rate.cpu.user;
ruleset
    100 * (kernel.all.cpu.user - rate.cpu.user ) / kernel.all.cpu.user > 1 ->
	print "kernel.all.cpu.user pct error: %v"
else
    100 * (kernel.all.cpu.user - rate.cpu.user ) / kernel.all.cpu.user < -1 ->
	print "kernel.all.cpu.user pct error: %v"
;
End-of-File

pminfo -d kernel.all.cpu.user delta.cpu.user rate.cpu.user
pmval -z -f3 -w12 -t 5min -asrc/960624.08.17_v2 kernel.all.cpu.user
pmval -z -f3 -w12 -r -t 5min -a src/960624.08.17_v2 kernel.all.cpu.user
pmie -z -v -c $tmp.pmie -t 5min -a src/960624.08.17_v2 2>&1 \
| _filter_pmie_log

echo
echo "--- sample.milliseconds ---"

cat <<End-of-File >$tmp.pmie
raw = sample.milliseconds;
delta.milliseconds = delta.milliseconds;
rate.milliseconds = rate.milliseconds;
ruleset
    100 * (sample.milliseconds - rate.milliseconds ) / sample.milliseconds > 1 ->
	print "sample.milliseconds pct error: %v"
else
    100 * (sample.milliseconds - rate.milliseconds ) / sample.milliseconds < -1 ->
	print "sample.milliseconds pct error: %v"
;
End-of-File

pminfo -d sample.milliseconds delta.milliseconds rate.milliseconds
pmval -z -f3 -w12 -t 3sec -a src/ok-bigbin sample.milliseconds
pmval -z -f3 -w12 -r -t 3sec -a src/ok-bigbin sample.milliseconds
pmie -z -v -c $tmp.pmie -t 3sec -a src/ok-bigbin 2>&1 \
| _filter_pmie_log

echo
echo "--- sample.seconds ---"

cat <<End-of-File >$tmp.pmie
raw = sample.seconds;
delta.seconds = delta.seconds;
rate.seconds = rate.seconds;
ruleset
    100 * (sample.seconds - rate.seconds ) / sample.seconds > 1 ->
	print "sample.seconds pct error: %v"
else
    100 * (sample.seconds - rate.seconds ) / sample.seconds < -1 ->
	print "sample.seconds pct error: %v"
;
End-of-File

pminfo -d sample.seconds delta.seconds rate.seconds
pmval -z -f3 -w12 -t 2sec -a src/ok-foo sample.seconds
pmval -z -f3 -w12 -r -t 2sec -a src/ok-foo sample.seconds
pmie -z -v -c $tmp.pmie -t 2sec -a src/ok-foo 2>&1 \
| _filter_pmie_log

echo
echo "--- sample.step_counter ---"

cat <<End-of-File >$tmp.pmie
raw = sample.step_counter;
delta.step_counter = delta.step_counter;
rate.step_counter = rate.step_counter;
ruleset
    100 * (sample.step_counter - rate.step_counter ) / sample.step_counter > 1 ->
	print "sample.step_counter pct error: %v"
else
    100 * (sample.step_counter - rate.step_counter ) / sample.step_counter < -1 ->
	print "sample.step_counter pct error: %v"
;
End-of-File

pminfo -d sample.step_counter delta.step_counter rate.step_counter
pmval -z -f3 -w12 -t 60sec -a src/reduce-gap sample.step_counter
pmval -z -f3 -w12 -r -t 60sec -a src/reduce-gap sample.step_counter
pmie -z -v -c $tmp.pmie -t 60sec -a src/reduce-gap 2>&1 \
| _filter_pmie_log

echo
echo "--- sample.kbyte_ctr ---"

cat <<End-of-File >$tmp.pmie
raw = sample.kbyte_ctr;
delta.kbyte_ctr = delta.kbyte_ctr / 1 Kbyte;
rate.kbyte_ctr = rate.kbyte_ctr / 1 Kbyte;
ruleset
    100 * (sample.kbyte_ctr - rate.kbyte_ctr ) / sample.kbyte_ctr > 1 ->
	print "sample.kbyte_ctr pct error: %v"
else
    100 * (sample.kbyte_ctr - rate.kbyte_ctr ) / sample.kbyte_ctr < -1 ->
	print "sample.kbyte_ctr pct error: %v"
;
End-of-File

pminfo -d sample.kbyte_ctr delta.kbyte_ctr rate.kbyte_ctr
pmval -z -f3 -w12 -t 1sec -a src/sample_expr sample.kbyte_ctr
pmval -z -f3 -w12 -r -t 1sec -a src/sample_expr sample.kbyte_ctr
pmie -z -v -c $tmp.pmie -t 1sec -a src/sample_expr 2>&1 \
| _filter_pmie_log

# success, all done
status=0

exit