The Call Attributed Profiler (CAP) allows you to profile function calls within an application. You use it to see how much time is spent in each function and in the functions called by that function. You can also use it to see how much time is spent in the function itself, ignoring the functions that it calls. This gives a complete picture of how time is spent when the application is running. This tool is available in the Platform SDK.
CAP uses an elapsed time clock to measure time in functions. This has both benefits and liabilities. The benefit is that you see where time is spent during disk or LAN activity. The disadvantage is that if your thread is preempted and a computation-intensive thread is run, it will appear as though the preempted function used the whole amount of time. Therefore, it is important to control the environment when using CAP.
CAP supports the following measurement methods:
CAP creates a call tree of all the functions called in the module being profiled.
By default, CAP collects data only on functions compiled with a Microsoft C/C++ compiler or a compatible product from another vendor. You compile the source module with the -Gh compiler option, and a special call is inserted by the compiler at the start of every function. This invokes a measurement module called CAP.DLL.