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

A class providing a timer. More...

#include <Chrono.hpp>

Collaboration diagram for Nextsim::Chrono:
Collaboration graph

Public Types

typedef std::chrono::high_resolution_clock::time_point WallTimePoint
 Type of a point in time for the wall clock.
 
typedef std::chrono::high_resolution_clock::duration WallTimeDuration
 Type of a time duration on the wall clock.
 
typedef std::clock_t CpuTimePoint
 Type of a point in time for the CPU clock.
 
typedef double CpuTimeDuration
 Type of a time duration on the CPU clock.
 

Public Member Functions

 Chrono ()
 Default constructor of a chronometer, zeroing all of the counters.
 
WallTimePoint wallHack () const
 Returns the current time on the wall clock.
 
WallTimeDuration wallTime () const
 Returns the current cumulative wall clock time.
 
void reset ()
 Resets all of the chronometer counters.
 
CpuTimePoint cpuHack () const
 Returns the current time on the CPU clock.
 
CpuTimeDuration cpuTime () const
 Returns the current cumulative CPU clock timer.
 
int ticks () const
 Returns the current number of activation ticks.
 
bool running () const
 Returns whether this chronometer is running.
 
void start ()
 Starts the timer.
 
void stop ()
 Stops the timer.
 
void extraCpuTime (const CpuTimeDuration &extraTime)
 Adds an externally determined increment to the CPU clock.
 
void extraWallTime (const WallTimeDuration &extraTime)
 Adds an externally determined increment to the wall clock.
 
void extraTicks (int extraTicks)
 Adds an externally determined increment to the activation count.
 

Detailed Description

A class providing a timer.

This class records execution wall and CPU time as well as a record of the number of times that the chronometer has been started.

Definition at line 21 of file Chrono.hpp.

Member Typedef Documentation

◆ CpuTimeDuration

Type of a time duration on the CPU clock.

Definition at line 31 of file Chrono.hpp.

◆ CpuTimePoint

Type of a point in time for the CPU clock.

Definition at line 29 of file Chrono.hpp.

◆ WallTimeDuration

std::chrono::high_resolution_clock::duration Nextsim::Chrono::WallTimeDuration

Type of a time duration on the wall clock.

Definition at line 26 of file Chrono.hpp.

◆ WallTimePoint

std::chrono::high_resolution_clock::time_point Nextsim::Chrono::WallTimePoint

Type of a point in time for the wall clock.

Definition at line 24 of file Chrono.hpp.

Constructor & Destructor Documentation

◆ Chrono()

Nextsim::Chrono::Chrono ( )
inline

Default constructor of a chronometer, zeroing all of the counters.

Definition at line 34 of file Chrono.hpp.

Member Function Documentation

◆ cpuHack()

CpuTimePoint Nextsim::Chrono::cpuHack ( ) const
inline

Returns the current time on the CPU clock.

Definition at line 59 of file Chrono.hpp.

◆ cpuTime()

CpuTimeDuration Nextsim::Chrono::cpuTime ( ) const
inline

Returns the current cumulative CPU clock timer.

Definition at line 61 of file Chrono.hpp.

◆ extraCpuTime()

void Nextsim::Chrono::extraCpuTime ( const CpuTimeDuration & extraTime)
inline

Adds an externally determined increment to the CPU clock.

Parameters
extraTimethe additional duration to be added to the CPU clock.

Definition at line 103 of file Chrono.hpp.

Here is the caller graph for this function:

◆ extraTicks()

void Nextsim::Chrono::extraTicks ( int extraTicks)
inline

Adds an externally determined increment to the activation count.

Parameters
extraTicksthe additional ticks to be added to the activation count.

Definition at line 116 of file Chrono.hpp.

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

◆ extraWallTime()

void Nextsim::Chrono::extraWallTime ( const WallTimeDuration & extraTime)
inline

Adds an externally determined increment to the wall clock.

Parameters
extraTimethe additional duration to be added to the wall clock.

Definition at line 109 of file Chrono.hpp.

Here is the caller graph for this function:

◆ reset()

void Nextsim::Chrono::reset ( )
inline

Resets all of the chronometer counters.

Definition at line 50 of file Chrono.hpp.

Here is the caller graph for this function:

◆ running()

bool Nextsim::Chrono::running ( ) const
inline

Returns whether this chronometer is running.

Definition at line 69 of file Chrono.hpp.

◆ start()

void Nextsim::Chrono::start ( )
inline

Starts the timer.

Starts the clock on both the wall and CPU clocks, increments the number of activation ticks and sets the running flag.

Definition at line 77 of file Chrono.hpp.

◆ stop()

void Nextsim::Chrono::stop ( )
inline

Stops the timer.

Stops both the wall and CPU clocks, updates the cumulative time for both clocks and unsets the running flag.

Definition at line 91 of file Chrono.hpp.

◆ ticks()

int Nextsim::Chrono::ticks ( ) const
inline

Returns the current number of activation ticks.

Definition at line 67 of file Chrono.hpp.

◆ wallHack()

WallTimePoint Nextsim::Chrono::wallHack ( ) const
inline

Returns the current time on the wall clock.

Definition at line 42 of file Chrono.hpp.

◆ wallTime()

WallTimeDuration Nextsim::Chrono::wallTime ( ) const
inline

Returns the current cumulative wall clock time.

Definition at line 44 of file Chrono.hpp.


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