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.
One of the performance indicators is your application timing. The following considerations apply to timing your application:
Run program timings when other users are not active. Your timing results can be affected by one or more CPU-intensive processes also running while doing your timings.
Try to run the program under the same conditions each time to provide the most accurate results, especially when comparing execution times of a previous version of the same program. Use the same system (processor model, amount of memory, version of the operating system, and so on) if possible.
If you do need to change systems, you should measure the time using the same version of the program on both systems, so you know each system's effect on your timings.
For programs that run for less than a few seconds, run several timings to ensure that the results are not misleading. Certain overhead functions like loading libraries might influence short timings considerably.
If your program displays a lot of text, consider redirecting the output from the program. Redirecting output from the program will change the times reported because of reduced screen I/O.
Timings that show a large amount of system time may indicate a lot of time spent doing I/O, which might be worth investigating.
For programs that run for less than a few seconds, run several timings to ensure that the results are not misleading. Overhead functions like loading shared libraries might influence short timings considerably.
Use the time command and specify the name of the executable program to provide the following:
The elapsed, real, or "wall clock" time, which will be greater than the total charged actual CPU time.
Charged actual CPU time, shown for both system and user execution. The total actual CPU time is the sum of the actual user CPU time and actual system CPU time.
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.
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 ', & |
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 |
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 |
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.