Profiling and Performance Tools

To generate profiling information, you use the compiler, linker, and the profiler from either the visual development environment or the command line.

Select those parts of your application that make the most sense to profile. For example, routines that perform user interaction may not be worth profiling. Consider profiling routines that perform a series of complex calculations or call multiple user-written subprograms.

Profiling identifies areas of code where significant program execution time is spent. It can also show areas of code that are not executed. Visual Fortran programs created in a Windows ia32 development environment can be run and analyzed on a Windows NT 4, Windows 2000, Windows 98, Windows Me, or Windows 95 system. Whenever possible, perform detailed performance analysis on a system that closely resembles the system(s) that will be used to run the actual application.

For detailed information about profiling from the command line, see Profiling Code from the Command Line.

There are two main types of profiling: function profiling and line profiling.

Function Profiling

Function profiling helps you locate areas of inefficient code. It can show:

Function profiling does not require debug information (it obtains addresses from a .MAP file). Since function profiling (except function attribution) uses the stack, routines that modify the stack cannot be profiled. Exclude object files for routines that modify the stack.

To perform function profiling:

  1. In the Project menu, select Settings.
  2. Click the Link tab.
  3. In the General category, click the Enable profiling checkbox (this turns off incremental linking).
  4. In the General category, click the Generate mapfile checkbox.
  5. Click OK to accept the current project settings.
  6. Build your application.
  7. After building your application, profile your project.

Line Profiling

Line profiling collects more information than function profiling. It shows how many times a line is executed and whether certain lines are not executed. Line profiling requires debug information.

To perform line profiling:

  1. In the Project menu, select Settings.
  2. Click the Link tab.
  3. In the General category, click the Enable profiling checkbox (this turns off incremental linking).
  4. In the General category, click the Generate debug information checkbox.
  5. Click on the Fortran tab.
  6. In the category drop-down list, select Debug.
  7. In the Debugging level drop-down list, select Full.
  8. In the Debugging level drop-down list, click the Use Program Database for Debug Information checkbox.
  9. Click OK to accept the current project settings.
  10. Build your application
  11. After building your application, profile your project.

Performance Tools

Tools that you can use to analyze performance include:

You can also purchase separate products to perform performance analysis and profiling.

Efficient Source Code

Once you have determined those sections of code where most of the program execution time is spent, examine these sections for coding efficiency. Suggested guidelines for improving source code efficiency are provided in the following sections:

For information about timing your application and for an example command procedure that uses the Windows NT Performance Monitor, see Timing Your Application.