Skip to content

Commit cb2a61f

Browse files
tim-blackbirdjames7132
authored andcommitted
Cargo --timings option has been stabilized. Update profiling.md. (bevyengine#4850)
As of rust-lang/cargo#10245 `--timings` has been stabilized. Update profiling.md to reflect this. Co-authored-by: devil-ira <[email protected]>
1 parent 8cb4d89 commit cb2a61f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/profiling.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,18 @@ This approach requires no extra instrumentation and shows finer-grained flame gr
4444

4545
Install [cargo-flamegraph](https://github.com/killercup/cargo-flamegraph), [enable debug symbols in your release build](https://github.com/killercup/cargo-flamegraph#improving-output-when-running-with---release), then run your app using one of the following commands. Note that `cargo-flamegraph` forwards arguments to cargo. You should treat the `cargo-flamegraph` command as a replacement for `cargo run --release`. The commands below include `--example EXAMPLE_NAME` to illustrate, but you can remove those arguments in favor of whatever you use to run your app:
4646

47-
* Graph-Like Flame Graph: ```RUSTFLAGS='-C force-frame-pointers=y' cargo flamegraph -c "record -g" --example EXAMPLE_NAME```
48-
* Flat-ish Flame Graph: ```RUSTFLAGS='-C force-frame-pointers=y' cargo flamegraph --example EXAMPLE_NAME```
47+
* Graph-Like Flame Graph: `RUSTFLAGS='-C force-frame-pointers=y' cargo flamegraph -c "record -g" --example EXAMPLE_NAME`
48+
* Flat-ish Flame Graph: `RUSTFLAGS='-C force-frame-pointers=y' cargo flamegraph --example EXAMPLE_NAME`
4949

5050
After closing your app, an interactive `svg` file will be produced:
5151
![image](https://user-images.githubusercontent.com/2694663/141657609-0089675d-fb6a-4dc4-9a59-871e95e31c8a.png)
5252

5353
## Project Compile Times
5454

55-
This requires nightly rust (`rustup default nightly`). Append ```-Ztimings``` to your app's cargo command (ex: `cargo build -Ztimings`). If you want a "full" profile, make sure you run `cargo clean` first. Open the produced `cargo-timing.html` file in your browser of choice. This will show how much time each crate in your app's dependency tree took to build.
55+
Append `--timings` to your app's cargo command (ex: `cargo build --timings`).
56+
If you want a "full" profile, make sure you run `cargo clean` first (note: this will clear previously generated reports).
57+
The command will tell you where it saved the report, which will be in your target directory under `cargo-timings/`.
58+
The report is a `.html` file and can be opened and viewed in your browser.
59+
This will show how much time each crate in your app's dependency tree took to build.
5660

5761
![image](https://user-images.githubusercontent.com/2694663/141657811-f4e15e3b-c9fc-491b-9313-236fd8c01288.png)

0 commit comments

Comments
 (0)