Skip to content

Commit 19b40d1

Browse files
committed
-Zthreads=N support implemented as additional dimension 'Parallel'
1 parent 4bfa110 commit 19b40d1

50 files changed

Lines changed: 821 additions & 326 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ci/check-profiling.sh

Lines changed: 102 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ cargo build -p collector --bin rustc-fake
3232
# --profiles Check \
3333
# --cargo $bindir/cargo \
3434
# --include helloworld \
35-
# --scenarios Full
36-
#test -f results/perf-Test-helloworld-Check-Full
37-
#grep -q "PERFILE" results/perf-Test-helloworld-Check-Full
35+
# --scenarios Full \
36+
# --parallels 1
37+
#test -f results/perf-Test-helloworld-Check-Full-par1
38+
#grep -q "PERFILE" results/perf-Test-helloworld-Check-Full-par1
3839

3940
# oprofile: untested... it's not used much, and might have the same problems
4041
# that `perf` has due to virtualized hardware.
@@ -50,13 +51,14 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
5051
--profiles Check \
5152
--cargo $bindir/cargo \
5253
--include helloworld \
53-
--scenarios Full
54-
test -f results/cgout-Test-helloworld-Check-Full
55-
grep -q "events: Ir" results/cgout-Test-helloworld-Check-Full
56-
test -f results/cgann-Test-helloworld-Check-Full
57-
grep -q "PROGRAM TOTALS" results/cgann-Test-helloworld-Check-Full
54+
--scenarios Full \
55+
--parallels 1
56+
test -f results/cgout-Test-helloworld-Check-Full-par1
57+
grep -q "events: Ir" results/cgout-Test-helloworld-Check-Full-par1
58+
test -f results/cgann-Test-helloworld-Check-Full-par1
59+
grep -q "PROGRAM TOTALS" results/cgann-Test-helloworld-Check-Full-par1
5860
# Ensure that we also profile the memory allocator
59-
grep -q "malloc" results/cgann-Test-helloworld-Check-Full
61+
grep -q "malloc" results/cgann-Test-helloworld-Check-Full-par1
6062

6163
# Callgrind.
6264
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -66,11 +68,12 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
6668
--profiles Check \
6769
--cargo $bindir/cargo \
6870
--include helloworld \
69-
--scenarios Full
70-
test -f results/clgout-Test-helloworld-Check-Full
71-
grep -q "creator: callgrind" results/clgout-Test-helloworld-Check-Full
72-
test -f results/clgann-Test-helloworld-Check-Full
73-
grep -q "Profile data file" results/clgann-Test-helloworld-Check-Full
71+
--scenarios Full \
72+
--parallels 1
73+
test -f results/clgout-Test-helloworld-Check-Full-par1
74+
grep -q "creator: callgrind" results/clgout-Test-helloworld-Check-Full-par1
75+
test -f results/clgann-Test-helloworld-Check-Full-par1
76+
grep -q "Profile data file" results/clgann-Test-helloworld-Check-Full-par1
7477

7578
# DHAT.
7679
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -80,9 +83,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
8083
--profiles Check \
8184
--cargo $bindir/cargo \
8285
--include helloworld \
83-
--scenarios Full
84-
test -f results/dhout-Test-helloworld-Check-Full
85-
grep -q "dhatFileVersion" results/dhout-Test-helloworld-Check-Full
86+
--scenarios Full \
87+
--parallels 1
88+
test -f results/dhout-Test-helloworld-Check-Full-par1
89+
grep -q "dhatFileVersion" results/dhout-Test-helloworld-Check-Full-par1
8690

8791

8892
# DHAT (copy mode).
@@ -95,9 +99,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
9599
--profiles Check \
96100
--cargo $bindir/cargo \
97101
--include helloworld \
98-
--scenarios Full
99-
test -f results/dhcopy-Test-helloworld-Check-Full
100-
grep -q "dhatFileVersion" results/dhcopy-Test-helloworld-Check-Full
102+
--scenarios Full \
103+
--parallels 1
104+
test -f results/dhcopy-Test-helloworld-Check-Full-par1
105+
grep -q "dhatFileVersion" results/dhcopy-Test-helloworld-Check-Full-par1
101106

102107
# Massif.
103108
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -107,9 +112,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
107112
--profiles Check \
108113
--cargo $bindir/cargo \
109114
--include helloworld \
110-
--scenarios Full
111-
test -f results/msout-Test-helloworld-Check-Full
112-
grep -q "snapshot=0" results/msout-Test-helloworld-Check-Full
115+
--scenarios Full \
116+
--parallels 1
117+
test -f results/msout-Test-helloworld-Check-Full-par1
118+
grep -q "snapshot=0" results/msout-Test-helloworld-Check-Full-par1
113119

114120
# Bytehound.
115121
# This is currently broken in CI, commenting out to fix CI for this.
@@ -120,8 +126,9 @@ grep -q "snapshot=0" results/msout-Test-helloworld-Check-Full
120126
# --profiles Check \
121127
# --cargo $bindir/cargo \
122128
# --include helloworld \
123-
# --scenarios Full
124-
# test -f results/bhout-Test-helloworld-Check-Full
129+
# --scenarios Full \
130+
# --parallels 1
131+
# test -f results/bhout-Test-helloworld-Check-Full-par1
125132

126133
# eprintln. The output file is empty because a vanilla rustc doesn't print
127134
# anything to stderr.
@@ -132,9 +139,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
132139
--profiles Check \
133140
--cargo $bindir/cargo \
134141
--include helloworld \
135-
--scenarios Full
136-
test -f results/eprintln-Test-helloworld-Check-Full
137-
test ! -s results/eprintln-Test-helloworld-Check-Full
142+
--scenarios Full \
143+
--parallels 1
144+
test -f results/eprintln-Test-helloworld-Check-Full-par1
145+
test ! -s results/eprintln-Test-helloworld-Check-Full-par1
138146

139147
# llvm-lines. `Debug` not `Check` because it doesn't support `Check` profiles.
140148
# Including both `helloworld` and `regex-automata-0.4.8` benchmarks, as they exercise the
@@ -147,11 +155,12 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
147155
--profiles Debug \
148156
--cargo $bindir/cargo \
149157
--include helloworld,regex-automata-0.4.8 \
150-
--scenarios Full
151-
test -f results/ll-Test-helloworld-Debug-Full
152-
grep -q "Lines.*Copies.*Function name" results/ll-Test-helloworld-Debug-Full
153-
test -f results/ll-Test-regex-automata-0.4.8-Debug-Full
154-
grep -q "Lines.*Copies.*Function name" results/ll-Test-regex-automata-0.4.8-Debug-Full
158+
--scenarios Full \
159+
--parallels 1
160+
test -f results/ll-Test-helloworld-Debug-Full-par1
161+
grep -q "Lines.*Copies.*Function name" results/ll-Test-helloworld-Debug-Full-par1
162+
test -f results/ll-Test-regex-automata-0.4.8-Debug-Full-par1
163+
grep -q "Lines.*Copies.*Function name" results/ll-Test-regex-automata-0.4.8-Debug-Full-par1
155164

156165
# llvm-ir. `Debug` not `Check` because it works better that way.
157166
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -161,9 +170,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
161170
--profiles Debug \
162171
--cargo $bindir/cargo \
163172
--include helloworld \
164-
--scenarios Full
165-
test -f results/llir-Test-helloworld-Debug-Full
166-
grep -q "; ModuleID" results/llir-Test-helloworld-Debug-Full
173+
--scenarios Full \
174+
--parallels 1
175+
test -f results/llir-Test-helloworld-Debug-Full-par1
176+
grep -q "; ModuleID" results/llir-Test-helloworld-Debug-Full-par1
167177

168178
# mono-items. `Debug` not `Check` because it works better that way.
169179
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -173,9 +183,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
173183
--profiles Debug \
174184
--cargo $bindir/cargo \
175185
--include helloworld \
176-
--scenarios Full
177-
test -f results/mono-items-Test-helloworld-Debug-Full/raw
178-
grep -q "MONO_ITEM" results/mono-items-Test-helloworld-Debug-Full/raw
186+
--scenarios Full \
187+
--parallels 1
188+
test -f results/mono-items-Test-helloworld-Debug-Full-par1/raw
189+
grep -q "MONO_ITEM" results/mono-items-Test-helloworld-Debug-Full-par1/raw
179190

180191
# dep-graph. `IncrFull` not `Full` because it doesn't work with `Full`.
181192
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
@@ -185,9 +196,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
185196
--profiles Check \
186197
--cargo $bindir/cargo \
187198
--include helloworld \
188-
--scenarios IncrFull
189-
test -f results/dep-graph-Test-helloworld-Check-IncrFull.txt
190-
grep -q "hir_owner" results/dep-graph-Test-helloworld-Check-IncrFull.txt
199+
--scenarios IncrFull \
200+
--parallels 1
201+
test -f results/dep-graph-Test-helloworld-Check-IncrFull-par1.txt
202+
grep -q "hir_owner" results/dep-graph-Test-helloworld-Check-IncrFull-par1.txt
191203

192204
#----------------------------------------------------------------------------
193205
# Test option handling
@@ -200,23 +212,24 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
200212
profile_local eprintln $bindir/rustc \
201213
--id Builds1 \
202214
--cargo $bindir/cargo \
203-
--include helloworld
204-
test -f results/eprintln-Builds1-helloworld-Check-Full
205-
test -f results/eprintln-Builds1-helloworld-Check-IncrFull
206-
test -f results/eprintln-Builds1-helloworld-Check-IncrPatched0
207-
test -f results/eprintln-Builds1-helloworld-Check-IncrUnchanged
208-
test -f results/eprintln-Builds1-helloworld-Debug-Full
209-
test -f results/eprintln-Builds1-helloworld-Debug-IncrFull
210-
test -f results/eprintln-Builds1-helloworld-Debug-IncrPatched0
211-
test -f results/eprintln-Builds1-helloworld-Debug-IncrUnchanged
212-
test -f results/eprintln-Builds1-helloworld-Opt-Full
213-
test -f results/eprintln-Builds1-helloworld-Opt-IncrFull
214-
test -f results/eprintln-Builds1-helloworld-Opt-IncrPatched0
215-
test -f results/eprintln-Builds1-helloworld-Opt-IncrUnchanged
216-
test ! -e results/eprintln-Builds1-helloworld-Doc-Full
217-
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrFull
218-
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrPatched0
219-
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrUnchanged
215+
--include helloworld \
216+
--parallels 1
217+
test -f results/eprintln-Builds1-helloworld-Check-Full-par1
218+
test -f results/eprintln-Builds1-helloworld-Check-IncrFull-par1
219+
test -f results/eprintln-Builds1-helloworld-Check-IncrPatched0-par1
220+
test -f results/eprintln-Builds1-helloworld-Check-IncrUnchanged-par1
221+
test -f results/eprintln-Builds1-helloworld-Debug-Full-par1
222+
test -f results/eprintln-Builds1-helloworld-Debug-IncrFull-par1
223+
test -f results/eprintln-Builds1-helloworld-Debug-IncrPatched0-par1
224+
test -f results/eprintln-Builds1-helloworld-Debug-IncrUnchanged-par1
225+
test -f results/eprintln-Builds1-helloworld-Opt-Full-par1
226+
test -f results/eprintln-Builds1-helloworld-Opt-IncrFull-par1
227+
test -f results/eprintln-Builds1-helloworld-Opt-IncrPatched0-par1
228+
test -f results/eprintln-Builds1-helloworld-Opt-IncrUnchanged-par1
229+
test ! -e results/eprintln-Builds1-helloworld-Doc-Full-par1
230+
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrFull-par1
231+
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrPatched0-par1
232+
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrUnchanged-par1
220233

221234
# With `--profiles Doc` specified, `Check`/`Debug`/`Opt` files must not be
222235
# present, and `Doc` files must be present (but not for incremental runs).
@@ -226,23 +239,24 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
226239
--id Builds2 \
227240
--profiles Doc \
228241
--cargo $bindir/cargo \
229-
--include helloworld
230-
test ! -e results/eprintln-Builds2-helloworld-Check-Full
231-
test ! -e results/eprintln-Builds2-helloworld-Check-IncrFull
232-
test ! -e results/eprintln-Builds2-helloworld-Check-IncrUnchanged
233-
test ! -e results/eprintln-Builds2-helloworld-Check-IncrPatched0
234-
test ! -e results/eprintln-Builds2-helloworld-Debug-Full
235-
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrFull
236-
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrUnchanged
237-
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrPatched0
238-
test ! -e results/eprintln-Builds2-helloworld-Opt-Full
239-
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrFull
240-
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrUnchanged
241-
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrPatched0
242-
test -f results/eprintln-Builds2-helloworld-Doc-Full
243-
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrFull
244-
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrPatched0
245-
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrUnchanged
242+
--include helloworld \
243+
--parallels 1
244+
test ! -e results/eprintln-Builds2-helloworld-Check-Full-par1
245+
test ! -e results/eprintln-Builds2-helloworld-Check-IncrFull-par1
246+
test ! -e results/eprintln-Builds2-helloworld-Check-IncrUnchanged-par1
247+
test ! -e results/eprintln-Builds2-helloworld-Check-IncrPatched0-par1
248+
test ! -e results/eprintln-Builds2-helloworld-Debug-Full-par1
249+
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrFull-par1
250+
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrUnchanged-par1
251+
test ! -e results/eprintln-Builds2-helloworld-Debug-IncrPatched0-par1
252+
test ! -e results/eprintln-Builds2-helloworld-Opt-Full-par1
253+
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrFull-par1
254+
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrUnchanged-par1
255+
test ! -e results/eprintln-Builds2-helloworld-Opt-IncrPatched0-par1
256+
test -f results/eprintln-Builds2-helloworld-Doc-Full-par1
257+
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrFull-par1
258+
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrPatched0-par1
259+
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrUnchanged-par1
246260

247261
# With `--scenarios IncrUnchanged` specified, `IncrFull` and `IncrUnchanged`
248262
# files must be present.
@@ -253,11 +267,12 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
253267
--profiles Check \
254268
--cargo $bindir/cargo \
255269
--include helloworld \
256-
--scenarios IncrUnchanged
257-
test ! -e results/eprintln-Runs1-helloworld-Check-Full
258-
test -f results/eprintln-Runs1-helloworld-Check-IncrFull
259-
test -f results/eprintln-Runs1-helloworld-Check-IncrUnchanged
260-
test ! -e results/eprintln-Runs1-helloworld-Check-IncrPatched0
270+
--scenarios IncrUnchanged \
271+
--parallels 1
272+
test ! -e results/eprintln-Runs1-helloworld-Check-Full-par1
273+
test -f results/eprintln-Runs1-helloworld-Check-IncrFull-par1
274+
test -f results/eprintln-Runs1-helloworld-Check-IncrUnchanged-par1
275+
test ! -e results/eprintln-Runs1-helloworld-Check-IncrPatched0-par1
261276

262277
# With `--scenarios IncrPatched` specified, `IncrFull` and `IncrPatched0` files
263278
# must be present.
@@ -268,11 +283,12 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
268283
--profiles Check \
269284
--cargo $bindir/cargo \
270285
--include helloworld \
271-
--scenarios IncrPatched
272-
test ! -e results/eprintln-Runs2-helloworld-Check-Full
273-
test -f results/eprintln-Runs2-helloworld-Check-IncrFull
274-
test ! -e results/eprintln-Runs2-helloworld-Check-IncrUnchanged
275-
test -f results/eprintln-Runs2-helloworld-Check-IncrPatched0
286+
--scenarios IncrPatched \
287+
--parallels 1
288+
test ! -e results/eprintln-Runs2-helloworld-Check-Full-par1
289+
test -f results/eprintln-Runs2-helloworld-Check-IncrFull-par1
290+
test ! -e results/eprintln-Runs2-helloworld-Check-IncrUnchanged-par1
291+
test -f results/eprintln-Runs2-helloworld-Check-IncrPatched0-par1
276292

277293
kill $PING_LOOP_PID
278294
exit 0

collector/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ The following options alter the behaviour of the `bench_local` subcommand.
160160
`IncrUnchanged`, `IncrPatched`, and `All`. The default is `All`. Note that
161161
`IncrFull` is always run if either of `IncrUnchanged` or `IncrPatched` are
162162
run (even if not requested).
163+
- `--parallels <PARALLELS>`: the parallel frontend options to be benchmarked.
164+
Comma-separated list of thread numbers (arguments for -Zthreads=N). The default is `1,4`.
163165
- `--backends <BACKENDS>`: the codegen backends to be benchmarked. The possible
164166
choices are one or more (comma-separated) of `Llvm`, `Cranelift`. The default
165167
is `Llvm`.
@@ -489,6 +491,7 @@ The following options alter the behaviour of the `profile_local` subcommand.
489491
diff files will also be produced.
490492
- `--rustdoc <RUSTDOC>` as for `bench_local`.
491493
- `--scenarios <SCENARIOS>`: as for `bench_local`.
494+
- `--parallels <PARALLELS>`: as for `bench_local`.
492495
- `--backends <BACKENDS>`: as for `bench_local`.
493496
- `--jobs <JOB-COUNT>`: execute `<JOB-COUNT>` benchmarks in parallel. This is only allowed for certain
494497
profilers whose results are not affected by system noise (e.g. `callgrind` or `eprintln`).

0 commit comments

Comments
 (0)