MolSim
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Timer Class Reference

Class used to measure runtime performance and log molecule updates per second (MUPS). More...

#include <Timer.h>

Public Member Functions

 Timer ()
 Constructs a new Timer.
 
void reset ()
 Resets the start time.
 
template<typename T >
auto elapsed () const
 Gets the elapsed time since the start.
 
void incrementMoleculeUpdates (long summand)
 Increments the total number of molecule updates by a given amount.
 
void printElapsed () const
 Prints the elapsed time.
 
void printMUPS () const
 Prints the molecule updates per second.
 

Private Attributes

std::chrono::time_point< std::chrono::high_resolution_clock > m_start
 The start time of the timing process.
 
long m_moleculeUpdates {0}
 The total number of molecule updates in the given timeframe.
 

Detailed Description

Class used to measure runtime performance and log molecule updates per second (MUPS).

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )
inline

Constructs a new Timer.

Member Function Documentation

◆ elapsed()

template<typename T >
auto Timer::elapsed ( ) const
inline

Gets the elapsed time since the start.

Template Parameters
TThe unit of measurement to be returned (e.g. milliseconds, seconds...).
Returns
The time passed since the stored start time.

◆ incrementMoleculeUpdates()

void Timer::incrementMoleculeUpdates ( long  summand)
inline

Increments the total number of molecule updates by a given amount.

Parameters
summandThe amount to add to the molecule update counter.

◆ printElapsed()

void Timer::printElapsed ( ) const
inline

Prints the elapsed time.

◆ printMUPS()

void Timer::printMUPS ( ) const
inline

Prints the molecule updates per second.

◆ reset()

void Timer::reset ( )
inline

Resets the start time.

Member Data Documentation

◆ m_moleculeUpdates

long Timer::m_moleculeUpdates {0}
private

The total number of molecule updates in the given timeframe.

◆ m_start

std::chrono::time_point<std::chrono::high_resolution_clock> Timer::m_start
private

The start time of the timing process.


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