All CHPC Software
Built-in timing routines routines can measure wall-clock time, CPU time and system time. Subroutines exist so that C or Fortran routines can access wall-clock and CPU timing information. Both are discussed in this document.
Routines for getting the wall-clock, CPU time and system time exist both in the AIX operating system and the "csh" program. For instance, here is an example of the usage of the Unix timing command:'>' time a.out
More information on this command is available with the command "man time".
The timing command in the csh outputs the following:'>' time a.out
0.7u 0.0s 1:00 70% 150+58k 0+0io 0pf+0w
More information on the csh timing routine is available using "man csh".
Timing routines can also be called from inside Fortran of C programs. Here are several timing routines you might consider adding to your files:
A C program to get the real time:#include <sys/time.h>
int elapsed(double *sec)
extern int gettimeofday();
struct timeval t;
struct timezone tz;
stat = gettimeofday(&t, &tz);
*sec = (double)(t.tv_sec + t.tv_usec/1000000.0);
A Fortran program that calls elapsed to get the CPU time:program main
integer i, info
double precision dummy, begin, finish
info = elapsed( begin )
do i = 1, 1000000
dummy = dummy * 1000 + 2
info = elapsed( finish )
print *, finish - begin
A Fortran program to get CPU time in seconds.double precision function dsecnd( )
t = mclock( )
dsecnd = dble( t ) * 0.01D0
Fortran and C timing routines can be easily interchanged using interlanguage calls.
Last Modified: October 06, 2008 @ 21:07:47
Documentation has been moved: https://www.chpc.utah.edu/documentation/software/index.php
This includes a searchable database found: https://www.chpc.utah.edu/software/chpc/