SUNphi  1.0
SUNphi::Timer Class Reference

#include <Timer.hpp>

Public Types

enum  { UNSTOPPABLE, STOPPABLE }
 Defines whether the timer can be stopped or not.
 

Public Member Functions

Timeroperator[] (const char *subName)
 Gets reference to the mapped sub timer. More...
 
bool hasChildren () const
 Checks if has children.
 
bool hasRunningChildren () const
 Checks if has running children.
 
const Timerfather () const
 Gets a reference to the father.
 
template<typename... Ts>
decltype(auto) father (Ts &&...ts)
 
const bool & isStarted () const
 Returns whether the timer is started.
 
void start ()
 Explicitly starts the stopwatch.
 
Duration currentMeasure () const
 Returns the last measured or the current one.
 
Duration cumulativeMeasure () const
 Returns the total measured time, including current one if is running.
 
Duration averageMeasure () const
 Average measure.
 
void stop ()
 Stop the stopwatch.
 
 Timer (const char *name, Timer *father=nullptr, const bool isStoppableFlag=STOPPABLE)
 Builds the stopwatch. More...
 

Public Attributes

const char * name
 Name of the timer.
 
const bool isStoppable
 Mark whether the stopwatch can be stopped.
 

Static Public Attributes

static constexpr TimerNO_FATHER
 Used to mark that there is no father. More...
 

Private Types

enum  Started { IMPLICITLY, EXPLICITLY }
 Started mode: was it started by a children or explicityly?
 

Private Member Functions

void innerStart (const bool implExpl)
 Common start. More...
 
void childrenStarted ()
 Starts through a children.
 

Private Attributes

int nMeasures
 Number of intervals measured.
 
bool isStartedFlag
 Mark if the stopwatch is started.
 
Instant lastMomentStarted
 Last moment the stopwatch was started.
 
Instant lastMomentStopped {lastMomentStarted}
 Last moment the stopwatch was stopped.
 
Duration _cumulativeMeasure
 Cumulative time for which the timer has been let running.
 
Timer_father
 Father of current timer.
 
int nStartedChildren {0}
 Number of children measuring.
 
MapWithCStrKey< Timerchildren
 Children.
 
bool isExplicitlyStarted
 Determine whether it was explicitly started (or from a children)
 

Detailed Description

Splittable stopwatch

If the stopwatch is created with isStoppable set to true, it cannot be stopped and is automatically started

Definition at line 45 of file Timer.hpp.

Constructor & Destructor Documentation

SUNphi::Timer::Timer ( const char *  name,
Timer father = nullptr,
const bool  isStoppableFlag = STOPPABLE 
)
inline

Builds the stopwatch.

Parameters
nameName of the timer
fatherFather of current timer
isStoppableFlagFlag determining if the stopwatch can be stopped

Definition at line 238 of file Timer.hpp.

Member Function Documentation

template<typename... Ts>
decltype(auto) SUNphi::Timer::father ( Ts &&...  ts)
inline

Overload the father const method passing all args

Parameters
tsArguments

Definition at line 151 of file Timer.hpp.

void SUNphi::Timer::innerStart ( const bool  implExpl)
inlineprivate

Common start.

Store whether the stopwatch was explitly or implicitly started

Definition at line 78 of file Timer.hpp.

Timer& SUNphi::Timer::operator[] ( const char *  subName)
inline

Gets reference to the mapped sub timer.

Finds the sub timer

Definition at line 112 of file Timer.hpp.

Member Data Documentation

constexpr Timer* SUNphi::Timer::NO_FATHER
static
Initial value:
=
nullptr

Used to mark that there is no father.

Definition at line 154 of file Timer.hpp.


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