SyDEVS  v0.6.6
Multiscale Simulation and Systems Modeling Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

sydevs::timer::timer ( )
inline

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

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

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

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

Copy constructor.

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

Move constructor.

sydevs::timer::~timer ( )
default

Destructor.

Member Function Documentation

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

Returns the cumulative duration of measured time.

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

Copy assignment.

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

Move assignment.

void sydevs::timer::start ( )
inline

Starts the timer.

duration sydevs::timer::stop ( )
inline

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

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: