Skip to content

Commit 9a9d1a8

Browse files
Merge pull request #1177 from nnethercote/use-profiles-scenarios-consistently
Use "profiles" and "scenarios" terminology consistently.
2 parents 17f3168 + 376fd86 commit 9a9d1a8

File tree

9 files changed

+278
-319
lines changed

9 files changed

+278
-319
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
"--exclude webrender-wrench,style-servo,cargo",
6868
"--include webrender-wrench,style-servo,cargo",
6969
]
70-
PROFILE_KINDS: [
70+
PROFILES: [
7171
"Check,Doc,Debug",
7272
"Opt",
7373
]
@@ -102,7 +102,7 @@ jobs:
102102
env:
103103
JEMALLOC_OVERRIDE: /usr/lib/x86_64-linux-gnu/libjemalloc.so
104104
BENCH_INCLUDE_EXCLUDE_OPTS: ${{ matrix.BENCH_INCLUDE_EXCLUDE_OPTS }}
105-
PROFILE_KINDS: ${{ matrix.PROFILE_KINDS }}
105+
PROFILES: ${{ matrix.PROFILES }}
106106
SHELL: "/bin/bash"
107107

108108
test_profiling:

ci/check-benchmarks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ RUST_BACKTRACE=1 \
1818
cargo run -p collector --bin collector -- \
1919
bench_local $bindir/rustc \
2020
--id Test \
21-
--builds $PROFILE_KINDS \
21+
--profiles $PROFILES \
2222
--cargo $bindir/cargo \
23-
--runs All \
23+
--scenarios All \
2424
--rustdoc $bindir/rustdoc \
2525
$BENCH_INCLUDE_EXCLUDE_OPTS
2626

ci/check-profiling.sh

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
2424
cargo run -p collector --bin collector -- \
2525
profile_local time-passes $bindir/rustc \
2626
--id Test \
27-
--builds Check \
27+
--profiles Check \
2828
--cargo $bindir/cargo \
2929
--include helloworld \
30-
--runs Full
30+
--scenarios Full
3131
test -f results/Ztp-Test-helloworld-Check-Full
3232
grep -q "time:.*total" results/Ztp-Test-helloworld-Check-Full
3333

@@ -38,10 +38,10 @@ grep -q "time:.*total" results/Ztp-Test-helloworld-Check-Full
3838
# cargo run -p collector --bin collector -- \
3939
# profile_local perf-record $bindir/rustc \
4040
# --id Test \
41-
# --builds Check \
41+
# --profiles Check \
4242
# --cargo $bindir/cargo \
4343
# --include helloworld \
44-
# --runs Full
44+
# --scenarios Full
4545
#test -f results/perf-Test-helloworld-Check-Full
4646
#grep -q "PERFILE" results/perf-Test-helloworld-Check-Full
4747

@@ -53,10 +53,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
5353
cargo run -p collector --bin collector -- \
5454
profile_local cachegrind $bindir/rustc \
5555
--id Test \
56-
--builds Check \
56+
--profiles Check \
5757
--cargo $bindir/cargo \
5858
--include helloworld \
59-
--runs Full
59+
--scenarios Full
6060
test -f results/cgout-Test-helloworld-Check-Full
6161
grep -q "events: Ir" results/cgout-Test-helloworld-Check-Full
6262
test -f results/cgann-Test-helloworld-Check-Full
@@ -67,10 +67,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
6767
cargo run -p collector --bin collector -- \
6868
profile_local callgrind $bindir/rustc \
6969
--id Test \
70-
--builds Check \
70+
--profiles Check \
7171
--cargo $bindir/cargo \
7272
--include helloworld \
73-
--runs Full
73+
--scenarios Full
7474
test -f results/clgout-Test-helloworld-Check-Full
7575
grep -q "creator: callgrind" results/clgout-Test-helloworld-Check-Full
7676
test -f results/clgann-Test-helloworld-Check-Full
@@ -81,10 +81,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
8181
cargo run -p collector --bin collector -- \
8282
profile_local dhat $bindir/rustc \
8383
--id Test \
84-
--builds Check \
84+
--profiles Check \
8585
--cargo $bindir/cargo \
8686
--include helloworld \
87-
--runs Full
87+
--scenarios Full
8888
test -f results/dhout-Test-helloworld-Check-Full
8989
grep -q "dhatFileVersion" results/dhout-Test-helloworld-Check-Full
9090

@@ -93,10 +93,10 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
9393
cargo run -p collector --bin collector -- \
9494
profile_local massif $bindir/rustc \
9595
--id Test \
96-
--builds Check \
96+
--profiles Check \
9797
--cargo $bindir/cargo \
9898
--include helloworld \
99-
--runs Full
99+
--scenarios Full
100100
test -f results/msout-Test-helloworld-Check-Full
101101
grep -q "snapshot=0" results/msout-Test-helloworld-Check-Full
102102

@@ -106,25 +106,25 @@ RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=
106106
cargo run -p collector --bin collector -- \
107107
profile_local eprintln $bindir/rustc \
108108
--id Test \
109-
--builds Check \
109+
--profiles Check \
110110
--cargo $bindir/cargo \
111111
--include helloworld \
112-
--runs Full
112+
--scenarios Full
113113
test -f results/eprintln-Test-helloworld-Check-Full
114114
test ! -s results/eprintln-Test-helloworld-Check-Full
115115

116-
# llvm-lines. `Debug` not `Check` because it doesn't support `Check` builds.
116+
# llvm-lines. `Debug` not `Check` because it doesn't support `Check` profiles.
117117
# Including both `helloworld` and `futures` benchmarks, as they exercise the
118118
# zero dependency and the greater than zero dependency cases, respectively, the
119119
# latter of which has broken before.
120120
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
121121
cargo run -p collector --bin collector -- \
122122
profile_local llvm-lines $bindir/rustc \
123123
--id Test \
124-
--builds Debug \
124+
--profiles Debug \
125125
--cargo $bindir/cargo \
126126
--include helloworld,futures \
127-
--runs Full
127+
--scenarios Full
128128
test -f results/ll-Test-helloworld-Debug-Full
129129
grep -q "Lines.*Copies.*Function name" results/ll-Test-helloworld-Debug-Full
130130
test -f results/ll-Test-futures-Debug-Full
@@ -135,8 +135,8 @@ grep -q "Lines.*Copies.*Function name" results/ll-Test-futures-Debug-Full
135135
# Test option handling
136136
#----------------------------------------------------------------------------
137137

138-
# With `--builds` unspecified, `Check`/`Debug`/`Opt` files must be present, and
139-
# `Doc` files must not be present.
138+
# With `--profiles` unspecified, `Check`/`Debug`/`Opt` files must be present,
139+
# and `Doc` files must not be present.
140140
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
141141
cargo run -p collector --bin collector -- \
142142
profile_local eprintln $bindir/rustc \
@@ -160,13 +160,13 @@ test ! -e results/eprintln-Builds1-helloworld-Doc-IncrFull
160160
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrPatched0
161161
test ! -e results/eprintln-Builds1-helloworld-Doc-IncrUnchanged
162162

163-
# With `--builds Doc` specified, `Check`/`Debug`/`Opt` files must not be
163+
# With `--profiles Doc` specified, `Check`/`Debug`/`Opt` files must not be
164164
# present, and `Doc` files must be present (but not for incremental runs).
165165
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
166166
cargo run -p collector --bin collector -- \
167167
profile_local eprintln $bindir/rustc \
168168
--id Builds2 \
169-
--builds Doc \
169+
--profiles Doc \
170170
--cargo $bindir/cargo \
171171
--include helloworld
172172
test ! -e results/eprintln-Builds2-helloworld-Check-Full
@@ -186,31 +186,31 @@ test ! -f results/eprintln-Builds2-helloworld-Doc-IncrFull
186186
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrPatched0
187187
test ! -f results/eprintln-Builds2-helloworld-Doc-IncrUnchanged
188188

189-
# With `--runs IncrUnchanged` specified, `IncrFull` and `IncrUnchanged` files
190-
# must be present.
189+
# With `--scenarios IncrUnchanged` specified, `IncrFull` and `IncrUnchanged`
190+
# files must be present.
191191
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
192192
cargo run -p collector --bin collector -- \
193193
profile_local eprintln $bindir/rustc \
194194
--id Runs1 \
195-
--builds Check \
195+
--profiles Check \
196196
--cargo $bindir/cargo \
197197
--include helloworld \
198-
--runs IncrUnchanged
198+
--scenarios IncrUnchanged
199199
test ! -e results/eprintln-Runs1-helloworld-Check-Full
200200
test -f results/eprintln-Runs1-helloworld-Check-IncrFull
201201
test -f results/eprintln-Runs1-helloworld-Check-IncrUnchanged
202202
test ! -e results/eprintln-Runs1-helloworld-Check-IncrPatched0
203203

204-
# With `--runs IncrPatched` specified, `IncrFull` and `IncrPatched0` files must
205-
# be present.
204+
# With `--scenarios IncrPatched` specified, `IncrFull` and `IncrPatched0` files
205+
# must be present.
206206
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
207207
cargo run -p collector --bin collector -- \
208208
profile_local eprintln $bindir/rustc \
209209
--id Runs2 \
210-
--builds Check \
210+
--profiles Check \
211211
--cargo $bindir/cargo \
212212
--include helloworld \
213-
--runs IncrPatched
213+
--scenarios IncrPatched
214214
test ! -e results/eprintln-Runs2-helloworld-Check-Full
215215
test -f results/eprintln-Runs2-helloworld-Check-IncrFull
216216
test ! -e results/eprintln-Runs2-helloworld-Check-IncrUnchanged

collector/README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The following command runs the benchmark suite using a local rustc:
6969
It will benchmark the entire suite and put the results in a SQLite database
7070
file called `results.db`. The full benchmark suite takes hours to run, but the
7171
time can be reduced greatly by using the options below to reduce the number of
72-
benchmarks, runs, or builds. Progress output is printed to stderr.
72+
benchmarks, profiles, or scenarios. Progress output is printed to stderr.
7373

7474
The following arguments are mandatory.
7575

@@ -95,18 +95,15 @@ The following options alter the behaviour of the `bench_local` subcommand.
9595
- `--bench-rustc`: there is a special `rustc` benchmark that involves
9696
downloading a recent Rust compiler and measuring the time taken to compile
9797
it. This benchmark works very differently to all the other benchmarks. For
98-
example, `--runs` and `--builds` don't affect it, and the given `ID` is used
99-
as the `rust-lang/rust` ref (falling back to `HEAD` if the `ID` is not a
100-
valid ref). It is for advanced and CI use only. This option enables it.
101-
- `--builds <BUILDS>`: the build kinds to be benchmarked. The possible choices
102-
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `Opt`, and
103-
`All`. The default is `Check,Debug,Opt`.
98+
example, `--profiles` and `--scenarios` don't affect it, and the given `ID`
99+
is used as the `rust-lang/rust` ref (falling back to `HEAD` if the `ID` is
100+
not a valid ref). It is for advanced and CI use only. This option enables it.
104101
- `--cargo <CARGO>`: a path (relative or absolute) to a Cargo executable that
105102
will be used to build the benchmarks. By default, the nightly Cargo installed
106103
by `rustup` will be used. This is usually fine, though in rare cases it may
107104
cause local results to not exactly match production results, because Cargo
108105
sometimes begins passing (or stops passing) various flags to rustc.
109-
- `--db $DATABASE`: a path (relative or absolute) to a sqlite database file in
106+
- `--db <DATABASE>`: a path (relative or absolute) to a sqlite database file in
110107
which the timing data will be placed. It will be created if it does not
111108
already exist. The default is `results.db`. Alternatively, the collector
112109
supports postgres as a backend and the URL can be specified (beginning with
@@ -121,16 +118,19 @@ The following options alter the behaviour of the `bench_local` subcommand.
121118
comma-separated list of benchmark names. When this option is specified, a
122119
benchmark is included in the run only if its name matches one or more of the
123120
given names.
124-
- `--runs $RUNS`: the run kinds to be benchmarked. The possible choices are one
125-
or more (comma-separated) of `Full`, `IncrFull`, `IncrUnchanged`,
126-
`IncrPatched`, and `All`. The default is `All`. Note that `IncrFull` is
127-
always run (even if not requested) if either of `IncrUnchanged` or
128-
`IncrPatched` are run.
121+
- `--profiles <PROFILES>`: the profiles to be benchmarked. The possible choices
122+
are one or more (comma-separated) of `Check`, `Debug`, `Doc`, `Opt`, and
123+
`All`. The default is `Check,Debug,Opt`.
129124
- `--rustdoc <RUSTDOC>`: a path (relative or absolute) to a rustdoc
130-
executable that will be benchmarked (but only if a `Doc` build is requested
131-
with `--builds`). If a `Doc` build is requested, by default the tool will
125+
executable that will be benchmarked (but only if a `Doc` profile is requested
126+
with `--profiles`). If a `Doc` profile is requested, by default the tool will
132127
look for a rustdoc executable next to the rustc specified via the `<RUSTC>`
133128
argument.
129+
- `--scenarios <SCENARIOS>`: the scenarios to be benchmarked. The possible
130+
choices are one or more (comma-separated) of `Full`, `IncrFull`,
131+
`IncrUnchanged`, `IncrPatched`, and `All`. The default is `All`. Note that
132+
`IncrFull` is always run if either of `IncrUnchanged` or `IncrPatched` are
133+
run (even if not requested).
134134
- `--self-profile`: use rustc's `-Zself-profile` option to produce
135135
query/function tables in the output. The `measureme` tool must be installed
136136
for this to work.
@@ -189,14 +189,14 @@ Finally, while most of the options you can pass to the collector are supported,
189189
the profilers used in the `profile_local` command are not. In Windows, the only currently supported
190190
profiler is the `self-profiler`.
191191

192-
As a complete example, let's run just the `regex` benchmark in the `Debug` build with
193-
self-profiling results available:
192+
As a complete example, let's run just the `regex` benchmark in the `Debug`
193+
profile with self-profiling results available:
194194

195195
```pwsh
196196
$env:XPERF="C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\xperf.exe"
197197
$env:TRACELOG="C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\tracelog.exe"
198-
.\target\release\collector.exe bench_local $env:RUST_ORIGINAL --id Original --builds Debug --include regex --self-profile
199-
.\target\release\collector.exe bench_local $env:RUST_MODIFIED --id Modified --builds Debug --include regex --self-profile
198+
.\target\release\collector.exe bench_local $env:RUST_ORIGINAL --id Original --profiles Debug --include regex --self-profile
199+
.\target\release\collector.exe bench_local $env:RUST_MODIFIED --id Modified --profiles Debug --include regex --self-profile
200200
.\target\release\site.exe .\results.db
201201
```
202202

@@ -368,8 +368,8 @@ The mandatory `<PROFILER>` argument must be one of the following.
368368
a tool for finding code bloat.
369369
- **Slowdown**. It Is likely to run faster than normal compilation.
370370
- **Output**. Human-readable output is written to files with an `ll` prefix.
371-
- **Notes**. Does not work with the `Check` build kind. Also does not work
372-
with the `IncrFull`, `IncrUnchanged`, and `IncrPatched` run kinds.
371+
- **Notes**. Does not work with the `Check` profile. Also does not work
372+
with the `IncrFull`, `IncrUnchanged`, and `IncrPatched` scenarios.
373373
- `llvm-ir`: Dump rustc-generated LLVM IR (before any LLVM passes)
374374
- Purpose. This command provides access to the raw LLVM IR rustc produces,
375375
which can be used for targeted improvements to functions (e.g., those
@@ -383,14 +383,14 @@ The mandatory `<PROFILER>` argument must be one of the following.
383383
- **Purpose**. This is useful to investigate changes in CGU partionining.
384384
- **Slowdown**. Equivalent to normal compilation.
385385
- **Output**. File per CGU, currently, placed in a directory inside results.
386-
- **Notes**. Will likely work best with `Full` builds, on either Debug or Opt
387-
profiles.
386+
- **Notes**. Will likely work best with the `Full` scenario, on either
387+
`Debug` or `Opt` profiles.
388388
- `dep-graph`: Dump the incremental dependency graph (as produced by
389389
-Zdump-dep-graph).
390390
- **Purpose**. This is useful when debugging changes to incremental behavior.
391391
- **Slowdown**. Equivalent to normal compilation.
392392
- **Output**. .dot and .txt file (.txt likely is what you want to see first).
393-
- **Notes**. Works primarily with incremental compilation kinds.
393+
- **Notes**. Works primarily with incremental compilation scenarios.
394394

395395
The mandatory `<RUSTC>` argument is a path to a rustc executable or a
396396
`+`-prefixed toolchain specifier, the same as for `bench_local`.
@@ -401,21 +401,21 @@ fashion to the one chosen for `bench_local`.
401401
### Profiling options
402402

403403
The following options alter the behaviour of the `profile_local` subcommand.
404-
- `--builds <BUILDS>`: as for `bench_local`.
405404
- `--cargo <CARGO>`: as for `bench_local`.
406405
- `--exclude <EXCLUDE>`: as for `bench_local`.
407406
- `--id <ID>`: an identifer that will form part of the output filenames.
408407
- `--include <INCLUDE>`: as for `bench_local`.
409408
- `--out-dir <OUT_DIR>`: a path (relative or absolute) to a directory in
410409
which the output will be placed. If the directory doesn't exist, it will be
411410
created. The default is `results/`.
412-
- `--runs <RUNS>`: as for `bench_local`.
411+
- `--profiles <PROFILES>`: as for `bench_local`.
413412
- `--rustc2 <RUSTC>`: if given, profiles a second Rust compiler for comparison
414413
against the first. If a non-toolchain identifier is being used, a `1` will be
415414
appended to the identifier for the first run and a `2` will be appended to
416415
the identifier for the second run. If the profiler being used is Cachegrind,
417416
diff files will also be produced.
418417
- `--rustdoc <RUSTDOC>` as for `bench_local`.
418+
- `--scenarios <SCENARIOS>`: as for `bench_local`.
419419

420420
`RUST_LOG=debug` can be specified to enable verbose logging, which is useful
421421
for debugging `collector` itself.

0 commit comments

Comments
 (0)