|
|
How to Run Code Coverage Analysis
|
|
|
---------------------------------
|
|
|
|
|
|
ICC
|
|
|
---
|
|
|
* Build the code as normal with the `-prof-gen=srcpos` compiler flag.
|
|
|
* Run the test/simulation as normal and this should generate a `.dyn` file, which contains dynamic profile information.
|
|
|
* Use the `profmerge` tool to merge all `.dyn` files into one `.dpi` file. This can merge multiple `.dyn` from successive runs of the application with different runtime parameters (e.g. running `test27cells` with varying number of particles per cell):
|
|
|
|
|
|
```
|
|
|
profmerge -a
|
|
|
```
|
|
|
* Run the code coverage tool:
|
|
|
|
|
|
```
|
|
|
codecov
|
|
|
```
|
|
|
|
|
|
This will generate an `HTML` file called `CODE_COVERAGE.HTML`, which contains the code coverage report and show how much of the application was actually executed, line by line.
|
|
|
|
|
|
* A more detailed guide can be found at https://software.intel.com/en-us/node/522743#VISUALLY
|
|
|
|
|
|
GCC
|
|
|
---
|
|
|
* Build the code as normal with `-Wall -fprofile-arcs -ftest-coverage` compiler flags.
|
|
|
* Run the test/simulation as normal and this should generate a `.gcda` file, which contains dynamic profile information.
|
|
|
* Run the `gcov` tool on the executable source file:
|
|
|
|
|
|
```
|
|
|
gcov test27cells.c
|
|
|
```
|
|
|
This will generate annotated versions of each original source file appended with `.gcov`.
|
|
|
* Each `.gcov` file contains counts of the number of times each line was executed. Lines which were not executed are marked with hashes ‘######’.
|
|
|
* A more detailed guide can be found at http://www.network-theory.co.uk/docs/gccintro/gccintro_81.html. |
|
|
\ No newline at end of file |