Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/profiling/with_rustc_perf.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you show this command instead

cargo run --release --bin collector

this would remove the need to indicate where the exe is located

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ You can use the following options for the `x perf` command, which mirror the cor
- `--profiles`: Select profiles (`Check`, `Debug`, `Opt`, `Doc`) which should be profiled/benchmarked.
- `--scenarios`: Select scenarios (`Full`, `IncrFull`, `IncrPatched`, `IncrUnchanged`) which should be profiled/benchmarked.

## Example profiling diff for external crates
It can be of interest to generate a local diff for two commits of the compiler for external crates.
To start, in the `rustc-perf` repo, build the collector, which runs the Rust compiler benchmarks as follows.
```
cargo build --release -p collector
```
After this the collector can be located in `.\target\release\collector`, can be run locally with `bench_local` and expects the following arguments:
- `<PROFILE>`: Profiler selection for how performance should be measured. For this example we will use Cachegrind.
- `<RUSTC>`: The Rust compiler revision to benchmark, specified as a commit SHA from `rust-lang/rust`.
Optional arguments allow running profiles and scenarios as described above. `--include` in `x perf` is instead `--exact-match`. More information regarding the mandatory and
optional arguments can be found in the [rustc-perf-readme-profilers].

Then, for the case of generating a profile diff for the crate `serve_derive-1.0.136`, for two commits `<SHA1>` and `<SHA2>` in the `rust-lang/rust` repository, run the following
```
./target/release/collector profile_local cachegrind +<SHA1> --rustc2 +<SHA2> --exact-match serde_derive-1.0.136 --profiles Check --scenarios IncrUnchanged
```


[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
Expand Down
Loading