Function Profiling
Feature Only in Professional and Enterprise Editions Profiling is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .
The profiler provides four ways to profile by function:
Function timing lists time spent in functions together with “hit count”—the number of times the function was called.
Function counting lists only hit counts, but it is faster than function timing.
Function coverage lists functions that are or are not executed.
Function attribution takes a snapshot of the stack on each function call.
Debugging information is not required for function timing, function counting, or function coverage. The profiler reads the project’s .MAP file to match addresses with function names. It also creates a modified executable module and saves it in a temporary file with an ._XE or ._LL extension. This modified file contains thunks (substitutions for function calls), enabling the profiler to count and time the functions.
Caution With function timing, function counting, or function coverage, the function calls go through thunks for the profiler to record all the relevant information, which requires modification of the stack of the original executable (.EXE) file. As a result, it is not possible to profile functions that modify the stack themselves.
For example, the function AfxDispatchCall in the Microsoft Foundation Class dynamic-link library (.DLL) cannot be profiled, because it modifies the stack. However, the rest of the application or the .DLL can be profiled by excluding the object module that contains this offending function. (PREP automatically excludes the object module that defines AfxDispatchCall, olecall.obj.)
The module that contains the offending function can be identified using the .MAP file (see the Generate Mapfile linker option). For more information on how to exclude modules, see the /EXC option of PREP.