Timing Your Application

You can start collecting information about your application performance with simply timing your application. More sophisticated and helpful data can be collected by using performance analyzing tools.

Considerations on Timing Your Application

One of the performance indicators is your application timing. The following considerations apply to timing your application:

Methods of Timing Your Application

To perform application timings, use the VTune™ Performance Analyzer or 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:

 Whenever possible, perform detailed performance analysis on a system that closely resembles the system(s) that will be used for actual application use.

Sample Timing

The following program can be run by a .BAT file that executes the TIME command both before and after execution, to provide an approximate wall-clock time for the execution of the entire program. The Fortran intrinsic CPU_TIME can be used at selected points in the program to collect the CPU time between the start and end of the task to be timed.

Example

REAL time_begin, time_end

  ...

  CALL CPU_TIME ( time_begin )

  !

  !task to be timed

  !

  CALL CPU_TIME ( time_end )

  PRINT *, 'Time of operation was ', &
time_end - time_begin, ' seconds'

Considerations for Linux*

In the following example timings, the sample program being timed displays the following line:

Bourne* shell example

Average of all the numbers is:    4368488960.000000

Using the Bourne* shell, the following program timing reports that the program uses 1.19 seconds of total actual CPU time (0.61 seconds in actual CPU time for user program use and 0.58 seconds of actual CPU time for system use) and 2.46 seconds of elapsed time:

Bourne* shell example

$ time a.out

Average of all the numbers is:
4368488960.000000

real    0m2.46s
user    0m0.61s
sys     0m0.58s

Using the C shell, the following program timing reports 1.19 seconds of total actual CPU time (0.61 seconds in actual CPU time for user program use and 0.58 seconds of actual CPU time for system use),  about 4 seconds (0:04) of elapsed time, the use of 28% of available CPU time, and other information:

C shell l example

% time a.out
 

Average of all the numbers is:   4368488960.000000
 

0.61u 0.58s 0:04 28% 78+424k 9+5io 0pf+0w

Using the bash shell, the following program timing reports that the program uses 1.19 seconds of total actual CPU time (0.61 seconds in actual CPU time for user program use and 0.58 seconds of actual CPU time for system use) and 2.46 seconds of elapsed time:

bash shell l example

[user@system user]$ time ./a.out

Average of all the numbers is:   4368488960.000000

elapsed  0m2.46s
user     0m0.61s
sys      0m0.58s

Timings that indicate a large amount of system time is being used may suggest excessive I/O,  a condition worth investigating.

If your program displays a lot of text, you can redirect the output from the program on the time command line. Redirecting output from the program will change the times reported because of reduced screen I/O.

For more information, see time(1).

In addition to the time command, you might consider modifying the program to call routines within the program to measure execution time. For example, use the Intel Fortran intrinsic procedures, such as SECNDS, DCLOCK, CPU_TIME, SYSTEM_CLOCK, TIME, and DATE_AND_TIME. See "Intrinsic Procedures" in the Intel® Fortran Language Reference.