Compiling to Enable Profile DataGenerating profile data begins with the compile/build instrumenting the executable code and creating files to capture the profile results.
To make this happen with the gcov, tcov and gprof data sources, you need to set the appropriate flags when you compile your source code. Normally, the corresponding compile flags you'll use are:
Certain of these compiler flags can not be set if you have set the -g flag. For more information about using the compiler flags, refer to the documentation for your compiler.
For gprof there is a single file (gmon.out) for the entire executable. For gcov and tcov, a different datafile is generated for each source file. tcov datafiles have a .d suffix. Datafiles for earlier versions of gcov have a .da suffix, starting with gcc 3.4.0 the suffix is .gcda.
To generate profiler information under pre-.NET versions of Microsoft Visual C++, you need to build the project with profiling enabled. This can be done by checking the `Enable Profiling' checkbox on the Project Settings dialog / Link tab / General category.
If you wish to generate either of the two line types of profiler information, the executable must also be built with the appropriate debugging enabled. This can be done by checking the `Generate Debug Info' checkbox on the same Project Settings dialog / Link tab / General category, and then selecting `Line Numbers Only' or `Program Database' as the Debug Info type on the Project Settings dialog / C/C++ tab / General category.
Refer to your Microsoft Visual C++ User Guide for further information.