Skip to content

Commit b9a939a

Browse files
committed
docs(contrib): Document chrome tracing, rather than bespoke profiling
1 parent d188808 commit b9a939a

File tree

2 files changed

+13
-98
lines changed

2 files changed

+13
-98
lines changed

src/cargo/util/profile.rs

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/doc/contrib/src/tests/profiling.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
## Internal profiler
44

5-
Cargo has a basic, hierarchical profiler built-in. The environment variable
6-
`CARGO_PROFILE` can be set to an integer which specifies how deep in the
7-
profile stack to print results for.
5+
Cargo leverages [tracing](https://crates.io/crates/tracing)
6+
as a basic, hierarchical built-in profiler.
87

9-
```sh
10-
# Output first three levels of profiling info
11-
CARGO_PROFILE=3 cargo generate-lockfile
8+
Environment variables:
9+
- `__CARGO_LOG_PROFILE=<true|1>`: log tracing events to a file in the current working directory
10+
- `__CARGO_LOG_PROFILE_CAPTURE_ARGS=<true|1>`: include arguments in the events
11+
12+
At process exit, your trace will be in a file like `trace-1668480819035032.json`.
13+
Open that file with [ui.perfetto.dev](https://ui.perfetto.dev) (or chrome://tracing) to browse your trace.
14+
15+
Example:
16+
```console
17+
$ # Output first three levels of profiling info
18+
$ __CARGO_LOG_PROFILE=true cargo generate-lockfile
1219
```
1320

1421
## Benchmarking

0 commit comments

Comments
 (0)