The AHA Model  Revision: 12809
Reference implementation 04 (HEDG02_04)
commondata::timer_cpu Type Reference

CPU timer container object for debugging and speed/performance control. Arbitrary timers can be instantiated for different parts of the code and also global. Using a specific timer (stopwatch) is like this: More...

Collaboration diagram for commondata::timer_cpu:

Stopwatch Timer class

Used for execution timing of certain parts of the code.

real(srpcpu_time_start
 All object data components private, we should never use them directly. More...
 
character(len=long_label_lengthcpu_time_title
 Optional title for the stopwatch. Useful if we use many timers and for logger. More...
 
procedure, public start => timer_cpu_start
 Start the timer object, stopwatch is now ON. See commondata::timer_cpu_start() More...
 
procedure, public elapsed => timer_cpu_elapsed
 Calculate the time elapsed since the stopwatch subroutine was called for this instance of the timer container object. Can be called several times showing elapsed time since the grand start. See commondata::timer_cpu_elapsed() More...
 
procedure, public title => timer_cpu_title
 Return the title of the current timer object. See commondata::timer_cpu_title() More...
 
procedure, public show => timer_cpu_show
 A ready to use in output function that returns a formatted string for a timer combining its title and the elapsed time. See commondata::timer_cpu_show() More...
 
procedure, public log => timer_cpu_log
 A ready to use shortcut to be used in logger, just adds the TIMER: tag in front of the normal showoutput. See commondata::timer_cpu_log() More...
 

Detailed Description

CPU timer container object for debugging and speed/performance control. Arbitrary timers can be instantiated for different parts of the code and also global. Using a specific timer (stopwatch) is like this:

call stopwatch%start("Output all agents data")

to start the stopwatch with specific title, then the function

... = stopwatch%elapsed()

returns the elapsed time. Then, the function stopwatch%title() outputs the title of this timer. A few other functions build on this simple functionality to provide typical shortcuts: stopwatch%show() and stopwatch%log().

Note
The near-trivial nature of this object makes it ideal for learning how to implement objects in modern Fortran.

Definition at line 1883 of file m_common.f90.

Member Function/Subroutine Documentation

◆ start()

procedure, public commondata::timer_cpu::start

Start the timer object, stopwatch is now ON. See commondata::timer_cpu_start()

Definition at line 1903 of file m_common.f90.

◆ elapsed()

procedure, public commondata::timer_cpu::elapsed

Calculate the time elapsed since the stopwatch subroutine was called for this instance of the timer container object. Can be called several times showing elapsed time since the grand start. See commondata::timer_cpu_elapsed()

Definition at line 1908 of file m_common.f90.

◆ title()

procedure, public commondata::timer_cpu::title

Return the title of the current timer object. See commondata::timer_cpu_title()

Definition at line 1911 of file m_common.f90.

◆ show()

procedure, public commondata::timer_cpu::show

A ready to use in output function that returns a formatted string for a timer combining its title and the elapsed time. See commondata::timer_cpu_show()

Definition at line 1915 of file m_common.f90.

◆ log()

procedure, public commondata::timer_cpu::log

A ready to use shortcut to be used in logger, just adds the TIMER: tag in front of the normal showoutput. See commondata::timer_cpu_log()

Definition at line 1919 of file m_common.f90.

Here is the call graph for this function:

Member Data Documentation

◆ cpu_time_start

real(srp) commondata::timer_cpu::cpu_time_start

All object data components private, we should never use them directly.

Define start time for the stopwatch.

Definition at line 1893 of file m_common.f90.

◆ cpu_time_title

character (len=long_label_length) commondata::timer_cpu::cpu_time_title

Optional title for the stopwatch. Useful if we use many timers and for logger.

Definition at line 1899 of file m_common.f90.


The documentation for this type was generated from the following file: