gcc Introduction


Code coverage is a measure used to how often each source code statement and branch is executed. This measure is usually required when running a test suite to ensure that as much of the code as possible is tested by the test suite. It can also be used during profiling to determine code hot-spots and thus where optimization efforts may have the most effect.

In GCC code coverage is provided by the gcov utility. gcov works only with code compiled with gcc with particular flags. There are very few other compilers with which gcov works at all.