TIMERS: Rewrite slightly.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
ad15dec7cd
commit
e2c80a5552
@ -68,9 +68,10 @@ program amun
|
||||
use random , only : initialize_random, finalize_random
|
||||
use refinement , only : initialize_refinement
|
||||
use schemes , only : initialize_schemes, finalize_schemes
|
||||
use timers , only : initialize_timers, start_timer, stop_timer &
|
||||
, set_timer, get_timer, get_timer_total &
|
||||
, timer_enabled, timer_description, ntimers
|
||||
use timers , only : initialize_timers, finalize_timers
|
||||
use timers , only : start_timer, stop_timer, set_timer, get_timer
|
||||
use timers , only : get_timer_total, timer_enabled, timer_description
|
||||
use timers , only : ntimers
|
||||
|
||||
! module variables are not implicit by default
|
||||
!
|
||||
@ -145,7 +146,7 @@ program amun
|
||||
!
|
||||
iterm = 0
|
||||
|
||||
! initialize module TIMES
|
||||
! initialize module TIMERS
|
||||
!
|
||||
call initialize_timers()
|
||||
|
||||
@ -769,6 +770,10 @@ program amun
|
||||
!
|
||||
call finalize_mpitools()
|
||||
|
||||
! finalize module TIMERS
|
||||
!
|
||||
call finalize_timers()
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
end program
|
||||
|
@ -23,8 +23,10 @@
|
||||
!!
|
||||
!! module: TIMERS
|
||||
!!
|
||||
!! This module handles the execution time counting for different parts of the
|
||||
!! program.
|
||||
!! This module handles the execution time counting. Its general
|
||||
!! implementation allows to insert up to 128 counters which will measure
|
||||
!! time spent on the execution of the bounded code block. Each timer
|
||||
!! can be described.
|
||||
!!
|
||||
!!******************************************************************************
|
||||
!
|
||||
@ -50,8 +52,9 @@ module timers
|
||||
|
||||
! declare public subroutines and variables
|
||||
!
|
||||
public :: initialize_timers, set_timer, start_timer, stop_timer, get_timer &
|
||||
, get_timer_total, ntimers, timer_enabled, timer_description
|
||||
public :: initialize_timers, finalize_timers
|
||||
public :: set_timer, start_timer, stop_timer, get_timer, get_timer_total
|
||||
public :: ntimers, timer_enabled, timer_description
|
||||
|
||||
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
!
|
||||
@ -65,6 +68,7 @@ module timers
|
||||
! Subroutine initializes module TIMERS and allocates memory to store
|
||||
! execution times.
|
||||
!
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine initialize_timers()
|
||||
@ -99,7 +103,7 @@ module timers
|
||||
|
||||
! prepare the conversion factor
|
||||
!
|
||||
conv = 1.0d0 / ticks
|
||||
conv = 1.0d+00 / max(1, ticks)
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -107,6 +111,29 @@ module timers
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
! subroutine FINALIZE_TIMERS:
|
||||
! --------------------------
|
||||
!
|
||||
! Subroutine finalizes module.
|
||||
!
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine finalize_timers()
|
||||
|
||||
! local variables are not implicit by default
|
||||
!
|
||||
implicit none
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
end subroutine finalize_timers
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
! subroutine SET_TIMER:
|
||||
! --------------------
|
||||
!
|
||||
@ -138,7 +165,7 @@ module timers
|
||||
|
||||
! check if the timer didn't exceed the number of avalaible timers
|
||||
!
|
||||
if (ntimer .le. ntimers) then
|
||||
if (ntimer <= ntimers) then
|
||||
|
||||
! set the timer description
|
||||
!
|
||||
@ -216,7 +243,7 @@ module timers
|
||||
!
|
||||
call system_clock(tstop(timer))
|
||||
|
||||
times(timer) = times(timer) + tstop(timer) - tstart(timer)
|
||||
times(timer) = times(timer) + (tstop(timer) - tstart(timer))
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -352,6 +379,7 @@ module timers
|
||||
!
|
||||
! Function returns the total execution time.
|
||||
!
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
function get_timer_total()
|
||||
@ -376,7 +404,7 @@ module timers
|
||||
|
||||
! estimate the total execution time
|
||||
!
|
||||
get_timer_total = conv * max(1, tend - tbegin)
|
||||
get_timer_total = conv * max(0, tend - tbegin)
|
||||
|
||||
! return the value
|
||||
!
|
||||
|
Loading…
x
Reference in New Issue
Block a user