Timing Your Application

The following considerations apply to timing your application:

Methods of Timing Your Application

To perform application timings, use a version of the TIME command in a .BAT file (or the function timing profiling option). You might consider modifying the program to call routines within the program to measure execution time (possibly using conditionally compiled lines). For example:

Visual Fortran programs created in a Windows 98, Windows Me, or Windows 95 development environment can be run and analyzed on Windows NT 4 or Windows 2000 systems. Whenever possible, perform detailed performance analysis on a system that closely resembles the system(s) that will used for actual application use.

Sample Command Procedure that Uses TIME and Performance Monitor

The following example shows a .BAT command procedure that uses the TIME command and the Performance Monitor (perfmon) tool available on Windows NT 4 and Windows 2000 systems. The kill command that stops the perfmon tool is included on the Windows NT Resource kit; if the kill tool is not available on your system, manually end the perfmon task by using the task manager.

This .BAT procedure assumes that the program to be timed is myprog.exe.

Before using this batch file, start the performance monitor to setup logging of the statistics that you are interested in:

  1. At the DOS prompt type: Perfmon
  2. In the View menu, select Log
  3. In the Edit menu, select Add to Log and select some statistics
  4. In the Options menu, select Log. In the dialog box:
  5. In the File menu, select Save Workspace to save the setup information. The following .BAT procedure assumes you have saved the workspace as my_perfmon_setup.pmw.

The command procedure follows:

  echo off
  rem  Sample batch file to record performance statistics for later analysis.
  rem  This .bat file assumes that you have the utility "kill" available, which
  rem  is distributed with the NT resource kit.

  rem Delete previous logs, then start up the Performance Monitor.
  rem We use start so that control returns instantly to this batch file.
  del myprog.log
  start perfmon my_perfmon_setup.pmw

  rem print the time we started
  time <nul | findstr current

  rem start the program we are interested in, this time using
  rem cmd /c so that the batch file waits for the program to finish.
  echo on
  cmd /c myprog.exe
  echo off

  rem print the time we stopped
  time <nul | findstr current

  rem all done logging statistics
  kill perfmon
  rem if kill is not available, end the perfmon task manually

After the run, analyze your data by using Performance Monitor:

  1. If it is not currently running, start Performance Monitor.
  2. In the View menu, select Chart.
  3. In the Options menu, select Data From and specify the name of the logfile.
  4. In the Edit menu, select Add To Chart to display the counters.

For more information: