GCOV
Linux Profiling Project
Jiun-Hung Ding
System Software LAB
May 6, 2005
Introduction
GCOV is a tool you can use in conjunction with
GCC to test code coverage in your programs.
Function : Test Coverage Program
Application :
Optimize code
Performance statistics
How often each line of code executes
What lines of code are actually executed
Usage : Test Case + Target Program
How to use GCOV
1. Compile program with GCOV option (GCC)
2. Execution program
3. Using GCOV to extract information
4. View result
1
2
3
4
GCOV Flow Chart
Source File
GCC
Modified
Object Code
.bb
Execution
.da
GCOV
.gcov
.bbg
-fprofile-arcs
-ftest-coverage
1
2
3
4
Three Data Files
gcov uses three files for doing profiling .
The .bb and .bbg files are generated when th
e source file is compiled with the GCC -ftest-
coverage option.
The .da file is generated when a program con
taining object files built with the GCC -fprofil
e-arcs option is executed.