Next: EOSHIFT, Previous: DREAL, Up: Intrinsic Procedures
DTIME — Execution time subroutine (or function)DTIME(TARRAY, RESULT) initially returns the number of seconds of runtime
since the start of the process's execution in RESULT. TARRAY
returns the user and system components of this time in TARRAY(1) and
TARRAY(2) respectively. RESULT is equal to TARRAY(1) +
TARRAY(2).
Subsequent invocations of DTIME return values accumulated since the
previous invocation.
On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.
If DTIME is invoked as a function, it can not be invoked as a
subroutine, and vice versa.
TARRAY and RESULT are INTENT(OUT) and provide the following:
TARRAY(1): | User time in seconds.
| |
TARRAY(2): | System time in seconds.
| |
RESULT: | Run time since start in seconds.
|
CALL DTIME(TARRAY, RESULT).
|
RESULT = DTIME(TARRAY), (not recommended).
|
| TARRAY | The type shall be REAL, DIMENSION(2).
|
| RESULT | The type shall be REAL.
|
program test_dtime
integer(8) :: i, j
real, dimension(2) :: tarray
real :: result
call dtime(tarray, result)
print *, result
print *, tarray(1)
print *, tarray(2)
do i=1,100000000 ! Just a delay
j = i * i - i
end do
call dtime(tarray, result)
print *, result
print *, tarray(1)
print *, tarray(2)
end program test_dtime