Using PROFILE, PREP, and PLIST
Feature Only in Professional and Enterprise Editions Profiling is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .
Profiling requires three separate programs: PREP, PROFILE, and PLIST. When you choose a standard option (other than Custom) from the Profile dialog box, the development environment executes these programs for you automatically, passing arguments to the PREP program.
If you want maximum profiling flexibility, including the ability to format your output and to specify function and line-count profiling, you must write your own batch files that invoke PREP, PROFILE, and PLIST. You can run these batch files from either the Profile dialog box or from the command prompt. If you run the batch file from the dialog box, the PLIST output will, by default, be routed to the output window. Command-line batch output can also be routed to a file.
The following figure illustrates the profiler batch processing flow.
Profiler Batch Processing Flow
Notice that the PREP program is called twice. Phase I is before the actual profiling and Phase II is after the profiling. The command-line arguments govern PREP’s behavior.
The .PBI, .PBO, and .PBT files are intermediate files that are used to transfer information between profiling steps. The broken lines indicate connections that depend on the PREP (Phase I) command-line options.
A typical profiler batch file might look like this:
PREP /OM /FT /EXC nafxcwd.lib %1
if errorlevel == 1 goto done
PROFILE %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel == 1 goto done
PREP /M %1
if errorlevel == 1 goto done
PLIST /SC %1 >%1.lst
:done
Note When you run a profiler batch file from the Profile dialog box using the Custom option, the PLIST standard output is routed to the Profile tab in the Output window. In the preceding batch file, the PLIST output is redirected to a file, as it would usually be in a batch file run from the command line.
When the batch file is run using the Custom option in the Profile dialog box, the development environment substitutes the project’s program name for the %1 parameter. You can specify your program’s command-line arguments on the Debug tab in the Project Settings dialog box.
If the preceding batch file was named FTIME.BAT, and you wanted to profile the program TEST from the Profile dialog box, you would select the Custom option, and then specify FTIME.BAT in the Custom Settings box. If you wanted to profile the TEST program from the command prompt, you would type:
FTIME TEST
Note If you are running a profiler batch file from the development environment, you can edit your batch file. Remember to save your batch files after editing, because the development environment does not save them automatically.