Skip to content
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

Enhance the doc of timing report with graphs #11798

Merged
merged 8 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Binary file added src/doc/src/images/build-timing.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/doc/src/images/build-unit-timing.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 22 additions & 7 deletions src/doc/src/reference/timings.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ filename, if you want to look at older runs.

#### Reading the graphs

There are two graphs in the output. The "unit" graph shows the duration of
each unit over time. A "unit" is a single compiler invocation. There are lines
that show which additional units are "unlocked" when a unit finishes. That is,
it shows the new units that are now allowed to run because their dependencies
are all finished. Hover the mouse over a unit to highlight the lines. This can
help visualize the critical path of dependencies. This may change between runs
because the units may finish in different orders.
There are two tables and two graphs in the output.

The first table displays the build information of the project, including the
number of units built, the maximum number of concurrency, build time, and the
version information of the currently used compiler.

![build-timing](../images/build-timing.PNG)
heisen-li marked this conversation as resolved.
Show resolved Hide resolved

The "unit" graph shows the duration of each unit over time. A "unit" is a single
compiler invocation. There are lines that show which additional units are
"unlocked" when a unit finishes. That is, it shows the new units that are now
allowed to run because their dependencies are all finished. Hover the mouse over
a unit to highlight the lines. This can help visualize the critical path of
dependencies. This may change between runs because the units may finish in
different orders.

The "codegen" times are highlighted in a lavender color. In some cases, build
pipelining allows units to start when their dependencies are performing code
Expand All @@ -28,6 +36,8 @@ units do not show when code generation starts).
The "custom build" units are `build.rs` scripts, which when run are
highlighted in orange.

![build-unit-timing](../images/build-unit-timing.PNG)

The second graph shows Cargo's concurrency over time. The background
indicates CPU usage. The three lines are:
- "Waiting" (red) --- This is the number of units waiting for a CPU slot to
Expand All @@ -36,6 +46,8 @@ indicates CPU usage. The three lines are:
dependencies to finish.
- "Active" (green) --- This is the number of units currently running.

![cargo-concurrency-over-time](../images/cargo-concurrency-over-time.PNG)

Note: This does not show the concurrency in the compiler itself. `rustc`
coordinates with Cargo via the "job server" to stay within the concurrency
limit. This currently mostly applies to the code generation phase.
Expand All @@ -49,3 +61,6 @@ Tips for addressing compile times:
- Split large crates into smaller pieces.
- If there are a large number of crates bottlenecked on a single crate, focus
your attention on improving that one crate to improve parallelism.

The last table lists the total time spent on "unit", "Codegen" time, and the
features that unit has.
heisen-li marked this conversation as resolved.
Show resolved Hide resolved