TIMERS: Print error messages to error unit.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2019-02-08 10:10:01 -02:00
parent dc8c1aaaa7
commit 1273c3d0fd

View File

@ -153,6 +153,10 @@ module timers
!
subroutine set_timer(string, timer)
! include external procedures
!
use iso_fortran_env, only : error_unit
! local variables are not implicit by default
!
implicit none
@ -161,6 +165,10 @@ module timers
!
character(len=*), intent(in) :: string
integer , intent(out) :: timer
! local parameters
!
character(len=*), parameter :: loc = 'TIMERS::set_timer()'
!
!-------------------------------------------------------------------------------
!
@ -184,6 +192,12 @@ module timers
!
timer = ntimer
else
write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "The maximum number of counters exceeded! " // &
"Increase parameter 'ntimers' in this module and recompile."
end if
!-------------------------------------------------------------------------------
@ -205,6 +219,10 @@ module timers
!
subroutine start_timer(timer)
! include external procedures
!
use iso_fortran_env, only : error_unit
! local variables are not implicit by default
!
implicit none
@ -212,6 +230,10 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! local parameters
!
character(len=*), parameter :: loc = 'TIMERS::start_timer()'
!
!-------------------------------------------------------------------------------
!
@ -219,10 +241,8 @@ module timers
!
if (tlocked(timer)) then
! the timer is already locked
!
write(*,'("start_timer:: The timer -", a, "- is already locked!")') &
trim(description(timer))
write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "Timer '" // trim(description(timer)) // "' already locked!"
else ! unlocked
@ -255,6 +275,10 @@ module timers
!
subroutine stop_timer(timer)
! include external procedures
!
use iso_fortran_env, only : error_unit
! local variables are not implicit by default
!
implicit none
@ -262,6 +286,10 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! local parameters
!
character(len=*), parameter :: loc = 'TIMERS::stop_timer()'
!
!-------------------------------------------------------------------------------
!
@ -287,10 +315,8 @@ module timers
else ! unlocked
! the timer is unlocked, nothing to count
!
write(*,'("stop_timer:: The timer -", a, "- is already unlocked!")') &
trim(description(timer))
write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "Timer '" // trim(description(timer)) // "' already unlocked!"
end if ! unlocked
@ -311,7 +337,7 @@ module timers
!
!===============================================================================
!
function get_timer(timer)
real(kind=8) function get_timer(timer)
! local variables are not implicit by default
!
@ -320,10 +346,6 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! return variable
!
real(kind=8) :: get_timer
!
!-------------------------------------------------------------------------------
!
@ -352,7 +374,7 @@ module timers
!
!===============================================================================
!
function get_count(timer)
integer(kind=4) function get_count(timer)
! local variables are not implicit by default
!
@ -361,10 +383,6 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! return variable
!
integer(kind=4) :: get_count
!
!-------------------------------------------------------------------------------
!
@ -393,7 +411,7 @@ module timers
!
!===============================================================================
!
function timer_enabled(timer)
logical function timer_enabled(timer)
! local variables are not implicit by default
!
@ -402,10 +420,6 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! return variable
!
logical :: timer_enabled
!
!-------------------------------------------------------------------------------
!
@ -434,7 +448,7 @@ module timers
!
!===============================================================================
!
function timer_description(timer)
character(len=32) function timer_description(timer)
! local variables are not implicit by default
!
@ -443,10 +457,6 @@ module timers
! input arguments
!
integer, intent(in) :: timer
! return variable
!
character(len=32) :: timer_description
!
!-------------------------------------------------------------------------------
!
@ -472,16 +482,12 @@ module timers
!
!===============================================================================
!
function get_timer_total()
real(kind=8) function get_timer_total()
! local variables are not implicit by default
!
implicit none
! return value
!
real(kind=8) :: get_timer_total
! local variables
!
integer(kind=8) :: tend