Profiler Batch Processing

Profiling requires three separate programs: PREP, PROFILE, and PLIST. The visual development environment executes all three of these programs for you automatically. To execute them efficiently from the command line, and to customize the output format or specify function and line count profiling, you must write batch files to invoke PREP, PROFILE, and PLIST. You can redirect the output of the batch file to a designated file by using the redirection character (>).

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 that the PREP program is called twice - once before the actual profiling and again afterward. The command-line arguments govern PREP's behavior. Intermediate files with extensions .PBI, .PBO, and .PBT are used to transfer information between profiling steps. The first call to PREP generates a .PBI file which is passed to PROFILER. PROFILER generates a .PBO file which is passed in the second call to PREP. The second call to PREP generates a .PBT file which is passed to PLIST. The profiler data flow is shown in the following figure:

Profiler Data Flow

If the preceding batch file was named FTIME.BAT, and you wanted to profile the program TEST from the command prompt, you would type:

 FTIME C:\Program Files\DF98\MYDIR\TEST.EXE