www.cemf.ir
Timer Class Reference
+ Inheritance diagram for Timer:
+ Collaboration diagram for Timer:

Public Member Functions

 TypeInfo ("Timer")
 
 Timer ()=default
 
 Timer (const word &name)
 
 Timer (const word &name, Timers *parrent)
 
const wordname () const
 
virtual ~Timer ()
 
virtual void removeParrent ()
 
virtual int32 level () const
 
virtual bool master () const
 
Timersparrent () const
 
void start ()
 
void pause ()
 
void resume ()
 
void end ()
 
bool timerActive () const
 
real lastTime () const
 
real totalTime () const
 
real averageTime () const
 
virtual real accTimersTotal () const
 
virtual bool write (iOstream &os, bool subTree) const
 
virtual bool read (iIstream &is)
 

Protected Member Functions

real averageTimeMax () const
 
real accTimersTotalMax () const
 

Private Types

using timer = std::chrono::high_resolution_clock
 

Private Attributes

timer::time_point start_
 start time More...
 
int32 numIteration_ = 0
 number of times start() and end() are called More...
 
real accTime_ = 0.0
 sum of time duratios (in seconds) between all start() and end() calls More...
 
real lastTime_ = 0.0
 last time duration More...
 
real stepAccTime_ = 0.0
 Accumulative duration for multiple steps between start() and end() More...
 
word name_ = "noNameTimer"
 name for the timer More...
 
Timersparrent_ = nullptr
 parrent of timer More...
 

Detailed Description

Definition at line 33 of file Timer.hpp.

Member Typedef Documentation

◆ timer

using timer = std::chrono::high_resolution_clock
private

Definition at line 37 of file Timer.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/3]

Timer ( )
default

◆ Timer() [2/3]

Timer ( const word name)
inlineexplicit

Definition at line 73 of file Timer.hpp.

◆ Timer() [3/3]

Timer ( const word name,
Timers parrent 
)

Definition at line 35 of file Timer.cpp.

References Timers::addToList(), and Timer::parrent_.

+ Here is the call graph for this function:

◆ ~Timer()

~Timer ( )
virtual

Definition at line 43 of file Timer.cpp.

Member Function Documentation

◆ averageTimeMax()

pFlow::real averageTimeMax ( ) const
protected

Definition at line 25 of file Timer.cpp.

Referenced by MPITimer::averageTimeMax().

+ Here is the caller graph for this function:

◆ accTimersTotalMax()

pFlow::real accTimersTotalMax ( ) const
protected

Definition at line 30 of file Timer.cpp.

Referenced by MPITimer::totalTimeMax().

+ Here is the caller graph for this function:

◆ TypeInfo()

TypeInfo ( "Timer"  )

◆ name()

const word& name ( ) const
inline

Definition at line 80 of file Timer.hpp.

References Timer::name_.

Referenced by Timers::addTimer().

+ Here is the caller graph for this function:

◆ removeParrent()

virtual void removeParrent ( )
inlinevirtual

Definition at line 87 of file Timer.hpp.

References Timer::parrent_.

◆ level()

pFlow::int32 level ( ) const
virtual

Reimplemented in Timers.

Definition at line 51 of file Timer.cpp.

◆ master()

virtual bool master ( ) const
inlinevirtual

Reimplemented in Timers.

Definition at line 94 of file Timer.hpp.

◆ parrent()

Timers* parrent ( ) const
inline

Definition at line 99 of file Timer.hpp.

References Timer::parrent_.

Referenced by Timers::Timers().

+ Here is the caller graph for this function:

◆ start()

◆ pause()

void pause ( )
inline

Definition at line 112 of file Timer.hpp.

References pFlow::count(), Timer::end(), Timer::start_, and Timer::stepAccTime_.

Referenced by Timer::end().

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

◆ resume()

void resume ( )
inline

Definition at line 123 of file Timer.hpp.

References Timer::start_.

◆ end()

◆ timerActive()

bool timerActive ( ) const
inline

Definition at line 139 of file Timer.hpp.

References Timer::numIteration_.

Referenced by Timers::accTimersTotal().

+ Here is the caller graph for this function:

◆ lastTime()

real lastTime ( ) const
inline

Definition at line 145 of file Timer.hpp.

References Timer::lastTime_.

◆ totalTime()

real totalTime ( ) const
inline

Definition at line 151 of file Timer.hpp.

References Timer::accTime_.

Referenced by Timers::accTimersTotal(), and Timer::accTimersTotal().

+ Here is the caller graph for this function:

◆ averageTime()

real averageTime ( ) const
inline

Definition at line 157 of file Timer.hpp.

References Timer::accTime_, pFlow::max(), and Timer::numIteration_.

+ Here is the call graph for this function:

◆ accTimersTotal()

virtual real accTimersTotal ( ) const
inlinevirtual

Reimplemented in Timers.

Definition at line 163 of file Timer.hpp.

References Timer::totalTime().

+ Here is the call graph for this function:

◆ write()

bool write ( iOstream os,
bool  subTree 
) const
virtual

Reimplemented in Timers.

Definition at line 59 of file Timer.cpp.

References pFlow::abs(), boldChar, defaultColor, greenColor, pFlow::smallValue, and yellowColor.

Referenced by pFlow::operator<<(), and Timers::write().

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

◆ read()

virtual bool read ( iIstream is)
inlinevirtual

Reimplemented in Timers.

Definition at line 172 of file Timer.hpp.

Member Data Documentation

◆ start_

timer::time_point start_
private

start time

Definition at line 40 of file Timer.hpp.

Referenced by Timer::pause(), Timer::resume(), and Timer::start().

◆ numIteration_

int32 numIteration_ = 0
private

number of times start() and end() are called

Definition at line 43 of file Timer.hpp.

Referenced by Timer::averageTime(), Timer::end(), and Timer::timerActive().

◆ accTime_

real accTime_ = 0.0
private

sum of time duratios (in seconds) between all start() and end() calls

Definition at line 46 of file Timer.hpp.

Referenced by Timer::averageTime(), Timer::end(), and Timer::totalTime().

◆ lastTime_

real lastTime_ = 0.0
private

last time duration

Definition at line 49 of file Timer.hpp.

Referenced by Timer::end(), and Timer::lastTime().

◆ stepAccTime_

real stepAccTime_ = 0.0
private

Accumulative duration for multiple steps between start() and end()

Definition at line 53 of file Timer.hpp.

Referenced by Timer::end(), Timer::pause(), and Timer::start().

◆ name_

word name_ = "noNameTimer"
private

name for the timer

Definition at line 56 of file Timer.hpp.

Referenced by Timer::name().

◆ parrent_

Timers* parrent_ = nullptr
private

parrent of timer

Definition at line 59 of file Timer.hpp.

Referenced by Timer::parrent(), Timer::removeParrent(), and Timer::Timer().


The documentation for this class was generated from the following files: