forked from andikleen/pmu-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtl-tester
executable file
·218 lines (188 loc) · 8.26 KB
/
tl-tester
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
# simple regression tester for toplev
# this just tests if all events resolve etc, as it would
# need the individual CPUs.
# for non root set kernel.perf_event_paranoid = -1
set -e
WRAP=${WRAP:-}
failed() {
echo FAILED
[ -f nflog ] && ( sort nflog | uniq ) && rm nflog
}
trap failed ERR 0
. ./cpumap.sh
rm -f nflog
cat >hello.c <<EOL
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
EOL
set -x
LOAD="${LOAD:--- gcc -o /dev/null hello.c}"
LOAD0="-- taskset -c 0 $LOAD"
set -o pipefail
SMTCPUS="snb jkt ivb ivt hsw hsx bdw skl bdx knl skx clx"
NOSMTCPUS="slm simple"
ALLCPUS="$SMTCPUS $NOSMTCPUS"
if [ $(whoami) = root ] ; then
ALL="--all"
else
ALL="--metrics -l5 --tsx --power"
fi
checklog0() {
grep -v unparseable log$$
}
DCPU=hsw
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py $LOAD
# test with a locale that outputs FP numbers with , (github issue #43)
LC_ALL=pl_PL.utf8 EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py $LOAD
DIRECT_MSR=1 EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py $LOAD
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -d -l4 $LOAD | tee log$$
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -d -l4 --single-thread $LOAD | tee log$$
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -d -l4 --single-thread --columns $LOAD | tee log
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -d --all --core S0-C0-T0 $LOAD0 | tee log
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -v -d -l4 $LOAD | tee log
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -x, -v -d -l4 $LOAD | tee log
checklog0
# temporarily disabled because perf has a regression that causes segfaults with -r
#EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc -r2 -l4 $LOAD
KERNEL_VERSION=2.1 EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc --all $LOAD | tee log$$
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc --metrics -x, -v -d -l4 $LOAD | tee log$$
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py -g --raw -v --debug --stats -d $ALL --kernel $LOAD | tee log$$
checklog0
EVENTMAP=${cpus[$DCPU]} FORCECPU=$DCPU $WRAP ./toplev.py --no-desc --stats -d $ALL --kernel --valcsv val.csv --no-multiplex $LOAD | tee log$$
checklog0
grep :k log$$
grep /k log$$
EVENTMAP=${cpus[$DCPU]} FORCECPU=simple $WRAP ./toplev.py --no-desc -l1 $LOAD
# check errata handling
EVENTMAP=GenuineIntel-6-56 FORCECPU=bdw $WRAP ./toplev.py --handle-errata --force-events --no-desc --all $LOAD | tee log
grep BDE70 log
# test L1 uses a single group
onegroup() {
if [ `cat /proc/sys/kernel/nmi_watchdog` = 1 ] ; then return ; fi
grep perf $1 | tr -cd '{}' | awk ' { if ($1 != "{}") { print "more than one group for L1" ; exit(1); } } '
}
badschedules=0
badschedlist=""
checklog() {
grep -v unparseable $1
if grep "not supported 100.00%" $1 ; then
echo "WARNING unsupported schedule in $1"
badschedules=$[$badschedules + 1]
badschedlist="$badschedlist $1"
fi
}
for j in $SMTCPUS ; do
if ! grep -q hypervisor /proc/cpuinfo ; then
TOPOLOGY=topology EVENTMAP=${cpus[$j]} UNCORE=${cpus[$j]} FORCEHT=1 FORCECPU=$j $WRAP ./toplev.py --force-events -d -l1 --filterquals $LOAD 2>&1 | tee log.$j
[ $j != "knl" ] && onegroup log.$j
checklog log.$j
egrep "not found|missing" log.$j >> nflog || true
fi
TOPOLOGY=topology EVENTMAP=${cpus[$j]} UNCORE=${cpus[$j]} FORCEHT=0 FORCECPU=$j $WRAP ./toplev.py --force-events -d -l1 --filterquals $LOAD 2>&1 | tee log.$j
[ $j != "knl" ] && onegroup log.$j
egrep "not found|missing" log.$j >> nflog || true
if ! grep -q hypervisor /proc/cpuinfo ; then
TOPOLOGY=topology EVENTMAP=${cpus[$j]} UNCORE=${cpus[$j]} FORCEHT=1 FORCECPU=$j $WRAP ./toplev.py --force-events -d $ALL --filterquals $LOAD 2>&1 | tee log.$j
checklog log.$j
fi
TOPOLOGY=topology EVENTMAP=${cpus[$j]} FORCEHT=0 FORCECPU=$j $WRAP ./toplev.py --force-events --filterquals -d $ALL $LOAD 2>&1 | tee log.$j
TOPOLOGY=topology EVENTMAP=${cpus[$j]} FORCEHT=1 FORCECPU=$j FORCE_NMI_WATCHDOG=1 \
$WRAP ./toplev.py --force-events --filterquals -d $ALL $LOAD 2>&1 | tee log.$j
TOPOLOGY=topology EVENTMAP=${cpus[$j]} UNCORE=${cpus[$j]} FORCEHT=0 FORCECPU=$j \
$WRAP ./toplev.py --force-events -d $ALL --filterquals $LOAD 2>&1 | tee log.$j
checklog log.$j
egrep "not found|missing" log.$j >> nflog || true
done
for j in $NOSMTCPUS ; do
EVENTMAP=${cpus[$j]} FORCECPU=$j $WRAP ./toplev.py -d -l1 $LOAD 2>&1 | tee log.$j
# SLM now needs two groups
[ $j != "slm" ] && onegroup log.$j
checklog log.$j
EVENTMAP=${cpus[$j]} FORCECPU=$j $WRAP ./toplev.py -d $ALL $LOAD 2>&1 | tee log.$j
checklog log.$j
egrep "not found|missing" log.$j >> nflog || true
done
# misc features
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -o log$$ -d --ignore-errata --stats --metrics --force-events --no-multiplex -l4 $LOAD
grep Turbo_Utilization log$$
rm log$$
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -d --all --fast $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --perf-output x$$.csv -d --all $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --import x$$.csv -d --all
rm x$$.csv
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -d --stats --metrics --no-multiplex --columns -l4 $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -d --no-desc --power -l4 $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -d --no-desc $ALL --no-group $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py -d --no-desc --sw -l4 $LOAD
EVENTMAP=${cpus[skl]} FORCECPU=skl $WRAP ./toplev.py --single-thread --user $LOAD | tee log$$
onegroup log$$
grep :u log$$
grep /u log$$
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --all --list-metric-groups $LOAD
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --metric-group +TopDownL1,TLB $LOAD
if python -c 'import matplotlib.pyplot' ; then
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --graph -o x.png -d --metrics -l4 $LOAD
fi
EVENTMAP=${cpus[ivb]} FORCECPU=ivb $WRAP ./toplev.py -d -l4 -I 100 sleep 1
EVENTMAP=${cpus[ivb]} FORCECPU=ivb $WRAP ./toplev.py -o log$$ -m -l4 -I 100 $LOAD
grep IPC log$$
checklog0
rm log$$
EVENTMAP=${cpus[ivb]} FORCECPU=ivb $WRAP ./toplev.py -d -l4 -I 100 --columns sleep 1
EVENTMAP=${cpus[ivb]} FORCECPU=ivb $WRAP ./toplev.py -d -l4 -I 100 --columns -x, sleep 1
EVENTMAP=${cpus[skl]} FORCECPU=ivb $WRAP ./toplev.py -d -l4 --valcsv val.csv --user $LOAD | tee log$$
grep :u log$$
grep /u log$$
rm log$$
EVENTMAP=${cpus[hsw]} FORCECPU=hsw $WRAP ./toplev.py --all --sample-repeat 5 --filterqual -a sleep 0.1 | tee log
# do all perf.data exist?
rm perf.data.{1,2,3,4,5}
EVENTMAP=${cpus[skl]} FORCECPU=skl $WRAP ./toplev.py -o log$$ --single-thread -r3 true
grep '\+-.*[0-9][1-9]' log$$
rm log$$
# need new perf
# test other perf output formats
EVENTMAP=${cpus[snb]} FORCEHT=0 FORCECPU=snb $WRAP ./toplev.py -o log$$ -d -l4 -I 1000 -a --per-core sleep 1
checklog0
EVENTMAP=${cpus[snb]} FORCEHT=0 FORCECPU=snb $WRAP ./toplev.py -o log$$ -d -l4 -I 1000 -a --per-socket sleep 1
checklog0
EVENTMAP=${cpus[snb]} FORCEHT=0 FORCECPU=snb $WRAP ./toplev.py -o log$$ -d --no-desc -l4 -I 1000 -a -A sleep 1
checklog0
EVENTMAP=${cpus[hsx]} FORCECPU=hsx $WRAP ./toplev.py -l4 true
$WRAP ./toplev.py -o /dev/null --no-desc -v -l5 --run-sample $LOAD
HYPERVISOR=1 $WRAP ./toplev.py -o /dev/null --no-desc -v -l5 --run-sample $LOAD
for cpu in $SMTCPUS ; do
TOPOLOGY=topology EVENTMAP=${cpus[$cpu]} UNCORE=${cpus[$cpu]} FORCECPU=$cpu \
$WRAP ./toplev.py -o /dev/null --force-events --no-desc -v --all --filterqual --show-sample $LOAD >&log$$
cat log$$
# need to ignore errors for now to allow testing on laptop for uncore events
egrep "missing|not found" log$$ >> nflog || true
if ! grep -q hypervisor /proc/cpuinfo ; then
[ "$cpu" != knl ] && grep /p log$$
[ "$cpu" = hsw -o "$cpu" = bdw -o "$cpu" = skl ] && grep /pp log$$
fi
done
for cpu in $NOSMTCPUS ; do
EVENTMAP=${cpus[$cpu]} UNCORE=${cpus[$cpu]} FORCECPU=$cpu \
$WRAP ./toplev.py -o /dev/null --force-events --no-desc -v --all --filterqual --show-sample $LOAD >&log$$
cat log$$
egrep "not found|missing" log$$ >> nflog || true
done
trap "" ERR 0
set +x +e
echo
echo "$badschedules bad schedules: $badschedlist"
echo "SUCCEEDED"
for i in $ALLCPUS ; do rm log.$i ; done
[ -f nflog ] && ( sort nflog | uniq ) && rm nflog