]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/compiler-flags/profile.md
66d14fd09978fb631ec7a8efecc143a38db0497c
[rust.git] / src / doc / unstable-book / src / compiler-flags / profile.md
1 # `profile`
2
3 The tracking issue for this feature is: [#42524](https://github.com/rust-lang/rust/issues/42524).
4
5 ------------------------
6
7 This feature allows the generation of code coverage reports.
8
9 Set the `-Zprofile` compiler flag in order to enable gcov profiling.
10
11 For example:
12 ```Bash
13 cargo new testgcov --bin
14 cd testgcov
15 export RUSTFLAGS="-Zprofile"
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).