Timing Your Application

One of the performance indicators is your application timing. Use the time command to provide information about program performance. The following considerations apply to timing your application:

Using the form of the time command that specifies the name of the executable program provides the following:

Example

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

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:

$ 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:

% 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:

[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 show a large amount of system time may indicate a lot of time spent doing I/O, which might be 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.