diff options
| author | Jonathan Schwender <schwenderjonathan@gmail.com> | 2020-05-26 15:16:57 +0200 |
|---|---|---|
| committer | Jonathan Schwender <schwenderjonathan@gmail.com> | 2020-05-26 15:43:19 +0200 |
| commit | 2b26b8b32bb2246caa0a82b6ea16f11da3686d0e (patch) | |
| tree | c2042564a4d4d04bfba84c438414ed2b8e1b3820 | |
| parent | 62da38d00d8d09dbaaa092c7b5e7ea343fdc2126 (diff) | |
| download | rust-2b26b8b32bb2246caa0a82b6ea16f11da3686d0e.tar.gz rust-2b26b8b32bb2246caa0a82b6ea16f11da3686d0e.zip | |
Fix documentation example for gcov profiling
Incremental compilation needs to be turned off. Also added the other RUSTFLAGS that should/need to be turned on.
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/profile.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/profile.md b/src/doc/unstable-book/src/compiler-flags/profile.md index 452aca51532..b3b3e4eb405 100644 --- a/src/doc/unstable-book/src/compiler-flags/profile.md +++ b/src/doc/unstable-book/src/compiler-flags/profile.md @@ -12,10 +12,15 @@ For example: ```Bash cargo new testgcov --bin cd testgcov -export RUSTFLAGS="-Zprofile" +export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" +export CARGO_INCREMENTAL=0 cargo build cargo run ``` Once you've built and run your program, files with the `gcno` (after build) and `gcda` (after execution) extensions will be created. You can parse them with [llvm-cov gcov](https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-gcov) or [grcov](https://github.com/mozilla/grcov). + +Please note that `RUSTFLAGS` apply to everything that cargo builds and runs during a build, including build scripts! +To avoid this, pass a `RUSTC_WRAPPER` program to cargo that only adds the profiling flags to rustc for the specific +crates you want to profile. |
