0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_timer Module Reference

Timing routines. More...

Functions/Subroutines

subroutine, public timer_check (timer)
 Check a timer.
 
subroutine, public timer_clear (timer)
 Reset a timer.
 
real(sp) function, public timer_get (timer)
 Return a timer.
 
subroutine, public timer_print (timer)
 Print a timer.
 
subroutine, public timer_start (timer)
 Start a timer.
 
subroutine, public timer_stop (timer)
 Stop a timer.
 
subroutine, public timers_init
 Initialise timer module.
 

Variables

integer(i4), parameter, public max_timers = 500
 max number of timers allowed
 
integer(i4), save, public cycles_max
 max value of clock allowed by system
 
real(sp), save, public clock_rate
 clock_rate in seconds for each cycle
 
integer(i4), dimension(max_timers), save, public cycles1
 cycle number at start for each timer
 
integer(i4), dimension(max_timers), save, public cycles2
 cycle number at stop for each timer
 
real(sp), dimension(max_timers), save, public cputime
 accumulated cpu time in each timer
 
character(len=8), dimension(max_timers), save, public status
 timer status string
 

Detailed Description

Timing routines.

This module uses F90 cpu time routines to allowing setting of multiple CPU timers.

Changelog
  • Matthias Cuntz, Aug. 2012
  • Matthias Cuntz, Jan. 2013
    • clear one or all timers
Authors
Matthias Cuntz - from timers.f (c) the Regents of the University of Californi
Date
Dec 2012

Function/Subroutine Documentation

◆ timer_check()

subroutine, public mo_timer::timer_check ( integer(i4), intent(in)  timer)

Check a timer.

This routine checks a given timer. This is primarily used to periodically accumulate time in the timer to prevent timer cycles from wrapping around max_cycles.

Example

Check timer 3

call timer_check(3)
Parameters
[in]integer(i4) :: timertimer number
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 117 of file mo_timer.f90.

References status, timer_start(), and timer_stop().

Here is the call graph for this function:

◆ timer_clear()

subroutine, public mo_timer::timer_clear ( integer(i4), intent(in), optional  timer)

Reset a timer.

This routine resets a given timer or all timers to 0.

Example

! Clear timer 3

call timer_clear(3)

Clear all timers

call timer_clear()
Parameters
[in]integer(i4), optional :: timertimer number if given.
If missing, all timers will be reset.
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 155 of file mo_timer.f90.

References cputime.

◆ timer_get()

real(sp) function, public mo_timer::timer_get ( integer(i4), intent(in)  timer)

Return a timer.

This routine returns the result of a given timer. This can be called instead of timer_print so that the calling routine can print it in desired format.

Example

Return timer 3

call timer_get(3)
Parameters
[in]integer(i4) :: timertimer number
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 189 of file mo_timer.f90.

References cputime, status, timer_get(), timer_start(), and timer_stop().

Referenced by timer_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timer_print()

subroutine, public mo_timer::timer_print ( integer(i4), intent(in)  timer)

Print a timer.

This routine prints the accumulated cpu time in given timer.

Example

Prints timer 3

call timer_print(3)
Parameters
[in]integer(i4) :: timertimer number
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 225 of file mo_timer.f90.

References cputime, status, timer_start(), and timer_stop().

Here is the call graph for this function:

◆ timer_start()

subroutine, public mo_timer::timer_start ( integer(i4), intent(in)  timer)

Start a timer.

This routine starts a given timer.

Example

Start timer 3

call timer_start(3)
Parameters
[in]integer(i4) :: timertimer number
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 266 of file mo_timer.f90.

References cycles1, and status.

Referenced by timer_check(), timer_get(), and timer_print().

Here is the caller graph for this function:

◆ timer_stop()

subroutine, public mo_timer::timer_stop ( integer(i4), intent(in)  timer)

Stop a timer.

This routine stops a given timer. Example

Stop timer 3

call timer_stop(3)
Parameters
[in]integer(i4) :: timertimer number
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 300 of file mo_timer.f90.

References clock_rate, cputime, cycles1, cycles2, cycles_max, and status.

Referenced by timer_check(), timer_get(), and timer_print().

Here is the caller graph for this function:

◆ timers_init()

subroutine, public mo_timer::timers_init

Initialise timer module.

This routine initializes some machine parameters necessary for computing cpu time from F90 intrinsics.

Example

Initialize timers (before running timers)

call timers_init()
Author
Matthias Cuntz
Date
Aug 2012

Definition at line 358 of file mo_timer.f90.

References clock_rate, cputime, cycles1, cycles2, cycles_max, and status.

Variable Documentation

◆ clock_rate

real(sp), save, public mo_timer::clock_rate

clock_rate in seconds for each cycle

Definition at line 82 of file mo_timer.f90.

Referenced by timer_stop(), and timers_init().

◆ cputime

real(sp), dimension(max_timers), save, public mo_timer::cputime

accumulated cpu time in each timer

Definition at line 88 of file mo_timer.f90.

Referenced by timer_clear(), timer_get(), timer_print(), timer_stop(), and timers_init().

◆ cycles1

integer(i4), dimension(max_timers), save, public mo_timer::cycles1

cycle number at start for each timer

Definition at line 84 of file mo_timer.f90.

Referenced by timer_start(), timer_stop(), and timers_init().

◆ cycles2

integer(i4), dimension(max_timers), save, public mo_timer::cycles2

cycle number at stop for each timer

Definition at line 86 of file mo_timer.f90.

Referenced by timer_stop(), and timers_init().

◆ cycles_max

integer(i4), save, public mo_timer::cycles_max

max value of clock allowed by system

Definition at line 80 of file mo_timer.f90.

Referenced by timer_stop(), and timers_init().

◆ max_timers

integer(i4), parameter, public mo_timer::max_timers = 500

max number of timers allowed

Definition at line 78 of file mo_timer.f90.

◆ status

character(len = 8), dimension(max_timers), save, public mo_timer::status

timer status string

Definition at line 90 of file mo_timer.f90.

Referenced by timer_check(), timer_get(), timer_print(), timer_start(), timer_stop(), and timers_init().