Skip to content

Commit 7037e0d

Browse files
authored
Merge pull request #2696 from Mattias-Petersson/fix-1692
Fix #1692: Add example for profiling diff locally
2 parents 545f281 + 7e4b5d7 commit 7037e0d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/profiling/with_rustc_perf.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,25 @@ You can use the following options for the `x perf` command, which mirror the cor
2828
- `--profiles`: Select profiles (`Check`, `Debug`, `Opt`, `Doc`) which should be profiled/benchmarked.
2929
- `--scenarios`: Select scenarios (`Full`, `IncrFull`, `IncrPatched`, `IncrUnchanged`) which should be profiled/benchmarked.
3030

31+
## Example profiling diff for external crates
32+
It can be of interest to generate a local diff for two commits of the compiler for external crates.
33+
To start, in the `rustc-perf` repo, build the collector, which runs the Rust compiler benchmarks as follows.
34+
```
35+
cargo build --release -p collector
36+
```
37+
The collector can then be run using cargo, specifying the collector binary. It expects the following arguments:
38+
- `<PROFILE>`: Profiler selection for how performance should be measured. For this example we will use Cachegrind.
39+
- `<RUSTC>`: The Rust compiler revision to benchmark, specified as a commit SHA from `rust-lang/rust`.
40+
Optional arguments allow running profiles and scenarios as described above. More information regarding the mandatory and
41+
optional arguments can be found in the [rustc-perf-readme-profilers].
42+
43+
Then, for the case of generating a profile diff for the crate `serve_derive-1.0.136`, for two commits `<SHA1>` and `<SHA2>` from the `rust-lang/rust` repository,
44+
run the following in the `rustc-perf` repo:
45+
```
46+
cargo run --release --bin collector profile_local cachegrind +<SHA1> --rustc2 +<SHA2> --exact-match serde_derive-1.0.136 --profiles Check --scenarios IncrUnchanged
47+
```
48+
49+
3150
[samply]: https://github.com/mstange/samply
3251
[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
3352
[rustc-perf]: https://github.com/rust-lang/rustc-perf

0 commit comments

Comments
 (0)