SyDEVS  v0.7
Simulation-based analysis of complex systems involving people, devices, physical elements, and dynamic environments.
sydevs::timer Class Reference

A class for measuring and accumulating intervals of wallclock time. More...

#include <timer.h>

Public Member Functions

 timer ()
 Constructs a timer that has not yet accumuated any interval measurements. More...
 
 timer (duration cumulative_dt)
 Constructs a timer that initially has a cumulative duration of cumulative_dt. More...
 
 timer (const timer &)=delete
 Copy constructor. More...
 
timeroperator= (const timer &)=delete
 Copy assignment. More...
 
 timer (timer &&)=default
 Move constructor. More...
 
timeroperator= (timer &&)=default
 Move assignment. More...
 
 ~timer ()=default
 Destructor. More...
 
bool timing () const
 Returns true if the timer has been started but not yet stopped. More...
 
duration cumulative_duration () const
 Returns the cumulative duration of measured time. More...
 
void start ()
 Starts the timer. More...
 
duration stop ()
 Stops the timer and returns the measured interval of wallclock time. More...
 

Detailed Description

A class for measuring and accumulating intervals of wallclock time.

A timer object measures the interval of wallclock time that elapses between the point at which it is started and the point at which it is stopped. It also accumulates these time intervals. It can be used to measure how much is spent executing a block of code. All wallclock time durations are measured and reported in microseconds.

Constructor & Destructor Documentation

◆ timer() [1/4]

sydevs::timer::timer ( )
inline

Constructs a timer that has not yet accumuated any interval measurements.

◆ timer() [2/4]

sydevs::timer::timer ( duration  cumulative_dt)
inlineexplicit

Constructs a timer that initially has a cumulative duration of cumulative_dt.

◆ timer() [3/4]

sydevs::timer::timer ( const timer )
delete

Copy constructor.

◆ timer() [4/4]

sydevs::timer::timer ( timer &&  )
default

Move constructor.

◆ ~timer()

sydevs::timer::~timer ( )
default

Destructor.

Member Function Documentation

◆ cumulative_duration()

duration sydevs::timer::cumulative_duration ( ) const
inline

Returns the cumulative duration of measured time.

◆ operator=() [1/2]

timer& sydevs::timer::operator= ( const timer )
delete

Copy assignment.

◆ operator=() [2/2]

timer& sydevs::timer::operator= ( timer &&  )
default

Move assignment.

◆ start()

void sydevs::timer::start ( )
inline

Starts the timer.

◆ stop()

duration sydevs::timer::stop ( )
inline

Stops the timer and returns the measured interval of wallclock time.

◆ timing()

bool sydevs::timer::timing ( ) const
inline

Returns true if the timer has been started but not yet stopped.


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