Profiling Code from the Command Line

The profiler is an analysis tool you can use to examine the run-time behavior of your programs. By profiling, you can find out which sections of your code are working efficiently and which need to be tuned. The profiler can also show areas of code that are not being executed.

Because profiling is a tuning process, you should use the profiler to make your programs run better, not to find bugs. Once your program is fairly stable, you should start profiling to find out where to optimize your code. Use the profiler to determine whether an algorithm is effective, a function is being called frequently (if at all), or if a piece of code is being covered by software testing procedures.

In the Microsoft visual development environment, you can use the Profiler to generate reports that characterize how your program executes. If you work from the command line, you can create a batch command file to run PREP, PROFILE and PLIST, the programs that generate execution profile reports.

If you work from the command line, specify the /profile option to the LINK command to enable profiling. Similarly, when using the visual development environment, you need to enable profiling in the Link tab in the Project Settings dialog box.

For information on using the Profiler from the Microsoft visual development environment and timing your application, see Analyze Program Performance.

This section describes how to use the components of the profiler from the command line. The following topics are covered: