Skip to content

Commit

Permalink
Auto merge of #11798 - QiangHeisenberg:master, r=weihanglo
Browse files Browse the repository at this point in the history
Enhance the doc of timing report with graphs

### What does this PR try to resolve?

close #11708
  • Loading branch information
bors committed Mar 6, 2023
2 parents 234d9f6 + b90fa29 commit eb5baa9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
Binary file added src/doc/src/images/build-info.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-time.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-info](../images/build-info.png)

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-time](../images/build-unit-time.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 and "codegen" time spent on each unit,
as well as the features that were enabled during each unit's compilation.

0 comments on commit eb5baa9

Please sign in to comment.