Class | timer_class |
In: |
LatticeClass/timer_class.F90
|
provides timer counter (counts on all nodes) uses CPU_TIME (fortran95 intrinsic) if you want more precise counter, change CPU_TIME.
$Id: timer_class.F90,v 1.20 2011/06/13 14:09:56 ishikawa Exp $
Function : | |
elapse : | real(DP) |
this : | type(timer), intent(inout) |
return elapse time of the timer
function get_elapse_timer(this) result(elapse) ! ! return elapse time of the \timer ! use comlib implicit none type(timer), intent(inout) :: this real(DP) :: elapse call average_timer(this) elapse = this%elapse return end function
Function : | |
interval : | real(DP) |
this : | type(timer), intent(inout) |
return interval time from first tick
function get_interval_timer(this) result(interval) ! ! return interval time from first tick ! use comlib use lattice_class, only : NPU implicit none type(timer), intent(inout) :: this real(DP) :: interval interval = this%interval #ifndef _singlePU if (.not.this%master_only) then if (NPU > 1) then call comlib_sumcast(interval) endif endif #endif return end function
Subroutine : | |
this : | type(timer), intent(inout) |
master_only : | logical, optional, intent(in) |
initialize timer
subroutine new_timer(this,master_only) ! ! initialize \timer ! implicit none type(timer), intent(inout) :: this logical, optional, intent(in) :: master_only this%time0=0.0_DP this%time1=0.0_DP this%elapse=0.0_DP this%interval=0.0_DP this%ticked = 0 this%tocked = 0 if (present(master_only)) then this%master_only = master_only else this%master_only = .false. endif return end subroutine
Subroutine : | |
this : | type(timer), intent(inout) |
tick
ifdef _OPENMP
subroutine tic(this) ! ! tick ! #ifdef _OPENMP use omp_lib #endif implicit none type(timer), intent(inout) :: this real(SP) :: time #ifdef _OPENMP this%time0 = omp_get_wtime() #else call CPU_TIME(time) this%time0 = real(time,kind=KIND(1.0_DP)) #endif this%ticked = 1 this%tocked = 0 return end subroutine
Subroutine : | |
this : | type(timer), intent(inout) |
tock
ifdef _OPENMP
subroutine toc(this) ! ! tock ! #ifdef _OPENMP use omp_lib #endif implicit none type(timer), intent(inout) :: this real(SP) :: time #ifdef _OPENMP this%time1 = omp_get_wtime() #else call CPU_TIME(time) this%time1 = real(time,kind=DP) #endif this%interval = this%time1-this%time0 if (this%ticked == 1) then this%elapse = this%elapse+this%time1-this%time0 endif this%ticked = 0 this%tocked = 1 return end subroutine