File: 1432

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 (151 lines) | stat: -rwxr-xr-x 3,871 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
#!/bin/sh
# PCP QA Test No. 1432
# check cpu time calculation for overhead PMDA
#
# Copyright (c) 2022 Ken McDonell.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

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

[ -d $PCP_PMDAS_DIR/overhead ] || _notrun "overhead PMDA not installed"

_cleanup()
{
    cd $here
    [ -n "$pid1" ] && kill -TERM $pid1
    [ -n "$pid2" ] && kill -TERM $pid2
    rm -f src/hanoi-$seq
    _cleanup_pmda overhead
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success is the default!

_prepare_pmda overhead
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e "s@$PCP_SYSCONF_DIR@PCP_SYSCONF_DIR@g" \
    # end
}

_filter_pminfo()
{
    tee -a $seq_full \
    | sed \
	-e "s/\([[\"]\)$pid1 /\1MYPID /g" \
	-e "s/\([[\"]\)$pid2 /\1MYPID /g" \
    | $PCP_AWK_PROG '
/\.utime$/			{ i = 0; state = 1 }
/\.stime$/			{ i = 0; state = 2 }
/\.qa\.cpu$/			{ i = 0; state = 3 }
$1 == "overhead.cpu"		{ state = 4 }
NF == 0				{ state = 0 }
# usr time should be around 1.0 for MP systems, but could be as low
# as 0.50 for a single CPU system, but on a slow VM (like vm03) it
# could be as low as 0.2
# $7 is ...
#     inst [1474761 or "1474761 hanoi-1432"] value 0.009988213907589045
#                                                  ^^^^^^^^^^^^^^^^^^^^
#
state == 1 && $1 == "inst"	{ u[i++] = $7
				  if (0.2 <= $7 && $7 <= 1.05)
				    $7 = "OK"
				  else
				    print $7 " (below) is outside the 0.2 ... 1.05 range"
				}
# sys time should be really small, but there is an element of non-determinism
# here, so allow it to creep up to 0.1
#
state == 2 && $1 == "inst"	{ s[i++] = $7
				  if ($7 <= 0.1)
				    $7 = "OK"
				  else
				    print $7 " (below) is outside the 0 ... 0.1 range"
				}
# since sys is close to 0, the total should be similar to usr
# and total should be _exactly_ the same as sys+usr ... but allow 0.1% slop
#
state == 3 && $1 == "inst"	{ c[i] = $7
				  if (c[i] < 0.999*(s[i]+u[i])) 
				    printf "(below) cpu: %.6f too small cf utime+stime: %.6f\n", c[i], s[i]+u[i]
				  else if (c[i] > 1.001*(s[i]+u[i])) 
				    printf "(below) cpu: %.6f too large cf utime+stime: %.6f\n", c[i], s[i]+u[i]
				  else if (0.2 <= $7 && $7 <= 1.05)
				    $7 = "OK"
				  else
				    print $7 " (below) is outside the 0.2 ... 1.05 range"
				  i++
				}
# overhead.cpu is just the sum of the components, so should be equal, but
# allow 0.01% slop for arithmetic error
# $6 is ...
# inst [1 or "qa"] value 1.997642781517809
#                        ^^^^^^^^^^^^^^^^^
state == 4 && $1 == "inst"	{ t = 0
				  for (i = 0; i < 2; i++)
				    t += c[i]
				  if ($6 < 0.9999*t)
				    printf "(below) cpu: %.6f too small cf sum of cpu times: %.6f\n", $6, t
				  else if ($6 > 1.0001*t)
				    printf "(below) cpu: %.6f too large cf sum of cpu times: %.6f\n", $6, t
				  else
				    $6 = "OK"
				}
				{ print }
'
}

cat <<End-of-File >$tmp.conf
# Installed by PCP QA test $seq on `date`
version 1
group qa {
    id: 1
    pattern: ^hanoi-$seq\$
}
End-of-File

# 32-disk Tower of Hanoi problem takes about 30 seconds on my laptop
# 26 Nov 2022
# 33-disk Tower of Hanoi problem takes about 55 seconds on bozo
# 22 Jan 2023
#
[ -f src/hanoi-$seq ] || ln src/hanoi src/hanoi-$seq
src/hanoi-$seq 33 &
pid1=$!
src/hanoi-$seq 33 &
pid2=$!

# real QA test starts here
cd $PCP_PMDAS_DIR/overhead
# get to a known starting place ...
#
$sudo ./Remove >/dev/null 2>&1
cat <<End-of-File | $sudo ./Install | _filter
5
$tmp.conf
End-of-File

# wait for 2nd refresh() so we have values
#
sleep 6
pminfo -f overhead >$tmp.out
_filter_pminfo <$tmp.out

# success, all done
exit