Skip to content

Commit 84d1626

Browse files
committed
Add basic documentation for the profile feature
1 parent 26ad8d4 commit 84d1626

File tree

1 file changed

+16
-0
lines changed
  • src/doc/unstable-book/src/compiler-flags

1 file changed

+16
-0
lines changed

src/doc/unstable-book/src/compiler-flags/profile.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,19 @@
33
The tracking issue for this feature is: None
44

55
------------------------
6+
7+
This feature allows the generation of code coverage reports.
8+
9+
Set the compiler flags `-Ccodegen-units=1 -Clink-dead-code -Cpasses=insert-gcov-profiling -Zno-landing-pads` to enable gcov profiling.
10+
11+
For example:
12+
```Bash
13+
cargo new testgcov --bin
14+
cd testgcov
15+
export RUSTFLAGS="-Ccodegen-units=1 -Clink-dead-code -Cpasses=insert-gcov-profiling -Zno-landing-pads"
16+
cargo build
17+
cargo run
18+
```
19+
20+
Once you've built and run your program, files with the `gcno` (after build) and `gcda` (after execution) extensions will be created.
21+
You can parse them with [llvm-cov gcov](http://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-gcov) or [grcov](https://github.com/marco-c/grcov).

0 commit comments

Comments
 (0)