10.4 Sampling Code

To use the Profiler functions, you must first install VPROD.386, a virtual device driver. Your application can call the ProfSetup function to set the size of the output buffer (up to 1064K).

Profiler sampling uses memory that is otherwise available to Windows. Therefore, using Profiler may decrease the performance of the application you are analyzing. By specifying a small output buffer for Profiler, you can reduce the amount of memory used. However, a small output buffer may cause sample loss.

Profiler can write samples to disk only when Windows indicates it is safe to do so. When the sampling buffer is full, Profiler ignores additional samples until the buffer is flushed to disk. To minimize sample loss, either increase the buffer size or periodically call the ProfFlush function.

To profile applications, do the following:

1.Install the VPROD.386 driver by adding the following setting to the [386enh] section of your SYSTEM.INI file:

device=vprod.386

2.Run Windows in 386 enhanced mode.

3.Run the application you want to profile.

4.When you have finished profiling your application, remove the SYSTEM.INI file setting you added in step 1.