TIMERS: Remove variables related to the timer order.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2015-01-08 19:25:48 -02:00
parent 2980cf2e81
commit f9ee968fb6

View File

@ -39,11 +39,11 @@ module timers
! module variables ! module variables
! !
integer , parameter :: ntimers = 128 integer , parameter :: ntimers = 128
integer , save :: ntimer, norder integer , save :: ntimer
logical , dimension(ntimers), save :: ftimer, forder logical , dimension(ntimers), save :: ftimer
character(len=32), dimension(ntimers), save :: description character(len=32), dimension(ntimers), save :: description
integer(kind=8) , dimension(ntimers), save :: times, tstart, tstop integer(kind=8) , dimension(ntimers), save :: times, tstart, tstop
integer(kind=4) , dimension(ntimers), save :: tcount, torder integer(kind=8) , dimension(ntimers), save :: tcount
integer(kind=8) , save :: ticks, tbegin integer(kind=8) , save :: ticks, tbegin
real (kind=8) , save :: conv = 1.0d+00 real (kind=8) , save :: conv = 1.0d+00
@ -85,28 +85,24 @@ module timers
! !
call system_clock(count=tbegin, count_rate=ticks) call system_clock(count=tbegin, count_rate=ticks)
! initialize flags for enabled timers and timer order ! initialize flags array for indicating which timers are enabled
! !
ftimer(:) = .false. ftimer(:) = .false.
forder(:) = .false.
! initialize flag desciptions ! initialize flag desciptions
! !
description(:) = '' description(:) = ''
! initialize the next available timer and the number of occupied positions ! initialize the next available timer
! in the order array
! !
ntimer = 1 ntimer = 1
norder = 0
! reset timers ! reset timer variables
! !
times(:) = 0 times(:) = 0
tstart(:) = 0 tstart(:) = 0
tstop(:) = 0 tstop(:) = 0
tcount(:) = 0 tcount(:) = 0
torder(:) = 0
! prepare the conversion factor ! prepare the conversion factor
! !
@ -217,24 +213,10 @@ module timers
! !
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
! start accounting the time ! get the system clock to initiate the time counting
! !
call system_clock(tstart(itimer)) call system_clock(tstart(itimer))
! return, if the timer is already allocated in the order array
!
if (forder(itimer)) return
! otherwise, increase the order position
!
norder = norder + 1
! assign the current timer with the order position and switch the flag
! signifying that the timer is already in the order array
!
torder(norder) = itimer
forder(itimer) = .true.
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
end subroutine start_timer end subroutine start_timer
@ -252,7 +234,7 @@ module timers
! !
!=============================================================================== !===============================================================================
! !
subroutine stop_timer(timer) subroutine stop_timer(itimer)
! local variables are not implicit by default ! local variables are not implicit by default
! !
@ -260,21 +242,21 @@ module timers
! input arguments ! input arguments
! !
integer, intent(in) :: timer integer, intent(in) :: itimer
! !
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
! get the system clock ! get the system clock to terminate the time counting
! !
call system_clock(tstop(timer)) call system_clock(tstop(itimer))
! increase the timer count
!
tcount(timer) = tcount(timer) + 1
! add the time increment ! add the time increment
! !
times(timer) = times(timer) + (tstop(timer) - tstart(timer)) times(itimer) = times(itimer) + (tstop(itimer) - tstart(itimer))
! increase the timer count
!
tcount(itimer) = tcount(itimer) + 1
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !