netxsimdg
Loading...
Searching...
No Matches
Nextsim::Timer Class Reference

A class for a hierarchical timer functions. More...

#include <Timer.hpp>

Collaboration diagram for Nextsim::Timer:
Collaboration graph

Public Types

typedef std::string Key
 
typedef Chrono::WallTimePoint WallTimePoint
 
typedef Chrono::WallTimeDuration WallTimeDuration
 
typedef Chrono::CpuTimePoint CpuTimePoint
 
typedef Chrono::CpuTimeDuration CpuTimeDuration
 
typedef std::forward_list< Key > TimerPath
 

Public Member Functions

 Timer ()
 Creates a Timer with an unnamed root node.
 
 Timer (const Key &rootKey)
 Creates a Timer with a named root node.
 
void tick (const Key &timerName)
 Starts a named timer.
 
void tock (const Key &timerName)
 Stops a named timer.
 
void tock ()
 Stop the last timer to be started.
 
double lap (const Key &timerName) const
 Returns the elapsed time without stopping the timer.
 
double elapsed (const Key &timerName) const
 Returns the elapsed time.
 
std::ostream & report (const Key &timerName, std::ostream &os) const
 Prints the status of a named timer to an ostream.
 
std::ostream & report (std::ostream &os) const
 Prints the status of all the timers to an ostream.
 
std::ostream & report (const TimerPath &, std::ostream &os) const
 Prints the status of a timer specified by a path to an ostream.
 
void additionalTime (const TimerPath &path, WallTimeDuration additionalWall, CpuTimeDuration additionalCpu, int additionalTicks)
 Adds an additional time increment to a timer.
 
TimerPath currentTimerNodePath () const
 Returns the timer path to the currently running timer.
 
void reset ()
 Deletes all timers except the root, which is reset.
 

Static Public Attributes

static Timer main
 Static timer for general use.
 

Detailed Description

A class for a hierarchical timer functions.

Definition at line 23 of file Timer.hpp.

Member Typedef Documentation

◆ CpuTimeDuration

Chrono::CpuTimeDuration Nextsim::Timer::CpuTimeDuration

Definition at line 30 of file Timer.hpp.

◆ CpuTimePoint

Chrono::CpuTimePoint Nextsim::Timer::CpuTimePoint

Definition at line 29 of file Timer.hpp.

◆ Key

std::string Nextsim::Timer::Key

Definition at line 25 of file Timer.hpp.

◆ TimerPath

std::forward_list<Key> Nextsim::Timer::TimerPath

Definition at line 32 of file Timer.hpp.

◆ WallTimeDuration

Chrono::WallTimeDuration Nextsim::Timer::WallTimeDuration

Definition at line 28 of file Timer.hpp.

◆ WallTimePoint

Chrono::WallTimePoint Nextsim::Timer::WallTimePoint

Definition at line 27 of file Timer.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/2]

Nextsim::Timer::Timer ( )

Creates a Timer with an unnamed root node.

Definition at line 22 of file Timer.cpp.

◆ Timer() [2/2]

Nextsim::Timer::Timer ( const Key & rootKey)

Creates a Timer with a named root node.

Parameters
rootKeyName of the root node.

Definition at line 27 of file Timer.cpp.

Member Function Documentation

◆ additionalTime()

void Nextsim::Timer::additionalTime ( const TimerPath & path,
WallTimeDuration additionalWall,
CpuTimeDuration additionalCpu,
int additionalTicks )

Adds an additional time increment to a timer.

Parameters
pathPath to the timer to be incremented.
additionalWallWall clock duration to be added.
additionalCpuCPU clock duration to be added.
additionalTicksActivation ticks to be added.

Definition at line 65 of file Timer.cpp.

Here is the call graph for this function:

◆ currentTimerNodePath()

Timer::TimerPath Nextsim::Timer::currentTimerNodePath ( ) const

Returns the timer path to the currently running timer.

Definition at line 78 of file Timer.cpp.

◆ elapsed()

double Nextsim::Timer::elapsed ( const Key & timerName) const

Returns the elapsed time.

Parameters
timerNamethe name of the timer to interrogate.

Definition at line 63 of file Timer.cpp.

◆ lap()

double Nextsim::Timer::lap ( const Key & timerName) const

Returns the elapsed time without stopping the timer.

Parameters
timerNamethe name of the timer to interrogate.

Definition at line 62 of file Timer.cpp.

◆ report() [1/3]

std::ostream & Nextsim::Timer::report ( const Key & timerName,
std::ostream & os ) const

Prints the status of a named timer to an ostream.

Parameters
timerNameThe timer to be printed.
osThe ostream to print to.

Definition at line 94 of file Timer.cpp.

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

◆ report() [2/3]

std::ostream & Nextsim::Timer::report ( const TimerPath & path,
std::ostream & os ) const

Prints the status of a timer specified by a path to an ostream.

Parameters
pathThe path to the timer to be printed.
osThe ostream to print to.

Definition at line 101 of file Timer.cpp.

◆ report() [3/3]

std::ostream & Nextsim::Timer::report ( std::ostream & os) const

Prints the status of all the timers to an ostream.

Parameters
osThe ostream to print to.

Definition at line 99 of file Timer.cpp.

◆ reset()

void Nextsim::Timer::reset ( )

Deletes all timers except the root, which is reset.

Definition at line 110 of file Timer.cpp.

Here is the call graph for this function:

◆ tick()

void Nextsim::Timer::tick ( const Key & timerName)

Starts a named timer.

Parameters
timerNameName of the timer to be started.

Definition at line 35 of file Timer.cpp.

◆ tock() [1/2]

void Nextsim::Timer::tock ( )

Stop the last timer to be started.

Definition at line 50 of file Timer.cpp.

Here is the caller graph for this function:

◆ tock() [2/2]

void Nextsim::Timer::tock ( const Key & timerName)

Stops a named timer.

Parameters
timerNameName of the timer to be stopped.

Definition at line 48 of file Timer.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ main

Timer Nextsim::Timer::main
static

Static timer for general use.

Definition at line 109 of file Timer.hpp.


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