-
Notifications
You must be signed in to change notification settings - Fork 547
Document bootstrap
integration with rustc-perf
#2005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jieyouxu
merged 3 commits into
rust-lang:master
from
Kobzol:bootstrap-rustc-perf-integration
Oct 7, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Profiling with rustc-perf | ||
|
||
The [Rust benchmark suite][rustc-perf] provides a comprehensive way of profiling and benchmarking | ||
the Rust compiler. You can find instructions on how to use the suite in its [manual][rustc-perf-readme]. | ||
|
||
However, using the suite manually can be a bit cumbersome. To make this easier for `rustc` contributors, | ||
the compiler build system (`bootstrap`) also provides built-in integration with the benchmarking suite, | ||
which will download and build the suite for you, build a local compiler toolchain and let you profile it using a simplified command-line interface. | ||
|
||
You can use the `./x perf -- <command> [options]` command to use this integration. | ||
|
||
> Note that you need to specify arguments after `--` in the `x perf` command! You will not be able to pass arguments without the double dashes. | ||
|
||
You can use normal bootstrap flags for this command, such as `--stage 1` or `--stage 2`, for example to modify the stage of the created sysroot. It might also be useful to configure `config.toml` to better support profiling, e.g. set `rust.debuginfo-level = 1` to add source line information to the built compiler. | ||
|
||
`x perf` currently supports the following commands: | ||
- `benchmark <id>`: Benchmark the compiler and store the results under the passed `id`. | ||
- `compare <baseline> <modified>`: Compare the benchmark results of two compilers with the two passed `id`s. | ||
- `eprintln`: Just run the compiler and capture its `stderr` output. Note that the compiler normally does not print | ||
anything to `stderr`, you might want to add some `eprintln!` calls to get any output. | ||
- `samply`: Profile the compiler using the [samply][samply] sampling profiler. | ||
- `cachegrind`: Use [Cachegrind][cachegrind] to generate a detailed simulated trace of the compiler's execution. | ||
|
||
> You can find a more detailed description of the profilers in the [`rustc-perf` manual][rustc-perf-readme-profilers]. | ||
|
||
You can use the following options for the `x perf` command, which mirror the corresponding options of the | ||
`profile_local` and `bench_local` commands that you can use in the suite: | ||
|
||
- `--include`: Select benchmarks which should be profiled/benchmarked. | ||
- `--profiles`: Select profiles (`Check`, `Debug`, `Opt`, `Doc`) which should be profiled/benchmarked. | ||
- `--scenarios`: Select scenarios (`Full`, `IncrFull`, `IncrPatched`, `IncrUnchanged`) which should be profiled/benchmarked. | ||
|
||
[samply]: https://github.com/mstange/samply | ||
[cachegrind]: https://www.cs.cmu.edu/afs/cs.cmu.edu/project/cmt-40/Nice/RuleRefinement/bin/valgrind-3.2.0/docs/html/cg-manual.html | ||
[rustc-perf]: https://github.com/rust-lang/rustc-perf | ||
[rustc-perf-readme]: https://github.com/rust-lang/rustc-perf/blob/master/collector/README.md | ||
[rustc-perf-readme-profilers]: https://github.com/rust-lang/rustc-perf/blob/master/collector/README.md#profiling-local-builds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.