module kinds_mod, only: i8k, i_kVariables:
integer (kind=i8k), public, parameter :: TIMING_MOD_NO_PAPI = -400000 logical, public :: TIMING_MOD_HAS_PAPI integer (kind=i_k), public, parameter :: TIMING_MOD_GETTIMEOFDAY = 1 integer (kind=i_k), public, parameter :: TIMING_MOD_RUSAGE_UTIME = 2 integer (kind=i_k), public, parameter :: TIMING_MOD_PAPI_VIRT = 3 character (len=14), public, parameter, dimension (1:3) :: TIMING_MOD_TIMERS = (/ 'gettimeofday ', 'rusage:utime ', 'papi:virt_usec' /) logical, private :: timing_initialized = .false.Interfaces:
public interface gettime_ofday public interface gettime_rusageSubroutines and functions:
public subroutine gettime_init () public subroutine gettime_papi (t) public subroutine gettime (t, timer)
The subroutines return the time in microseconds as 64 bit integer. The following timers are used:
Author: Matthias Lieber
public interface gettime_ofday subroutine gettimec (t) integer (kind=i8k), intent(out) :: t end subroutine gettimec end interface gettime_ofdayGet the number of microseconds since the Epoch as returned by gettimeofday.
This is actually a C routine located in gettimec.c. It calls gettimeofday to retrieve the number of microseconds since the Epoch (00:00:00 UTC, January 1, 1970).
public interface gettime_rusage subroutine gettimec_rusage (t) integer (kind=i8k), intent(out) :: t end subroutine gettimec_rusage end interface gettime_rusageGet the user-time of the process as returned by ru_utime of getrusage.
This is actually a C routine located in gettimec.c that calls getrusage. Caution: the resolution of this timer may be very bad.
public subroutine gettime_init () end subroutine gettime_initInitialize the timing module.
This subroutine calls PAPIF_library_init if compiled with PAPI support and if it is necessary before calling PAPIF_get_virt_usec.
public subroutine gettime_papi (t) integer (kind=i8k), intent(out) :: t end subroutine gettime_papiGet the virtual user time of the process as returned by PAPI.
Uses the PAPI function PAPIF_get_virt_cyc to get the the time the process was running in user-mode since some arbitrary starting point.
Returns TIMING_MOD_NO_PAPI if FD4 is compiled without PAPI. Returns a negative value when PAPI failed, which may happen if PAPI is not initialized. (In this case, you need to call gettime_init.)
public subroutine gettime (t, timer) integer (kind=i8k), intent(out) :: t integer (kind=i_k), optional, intent(in) :: timer end subroutine gettimeGet timing using a specified timer.
Calls gettime_ofday, gettime_rusage, or gettime_papi when timer is TIMING_MOD_GETTIMEOFDAY, TIMING_MOD_RUSAGE_UTIME, or TIMING_MOD_PAPI_VIRT, respectively. If no or no valid timer is specified, gettime_ofday is called.