lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::TimerBase< T > Class Template Reference

Simple timer class to evaluate the performance of the software. More...

#include <Timer.h>

Public Member Functions

 TimerBase ()
 Construct a new TimerBase object.
 
void start ()
 Start the timer.
 
void pause ()
 Pause the timer.
 
void resume ()
 Resume the timer.
 
bool is_running () const
 Check whether the timer is running.
 
duration elapsed () const
 Get read-only access to the duration of elapsed time of the timer.
 
std::chrono::duration< double >::rep seconds () const
 Get read-only access to the number elapsed seconds of the timer.
 

Protected Member Functions

time_point now () const
 Get read-only access to the current instant of the timer.
 

Private Attributes

bool running_ {false}
 Whether the timer is running or not.
 
time_point last_start_ {}
 Last time_point when the timer is started or resumed.
 
duration elapsed_ {}
 Elapsed time so far. This doesn't include the current fragment if it is running.
 

Detailed Description

template<typename T>
class lucid::TimerBase< T >

Simple timer class to evaluate the performance of the software.

The timer can be started, paused, and resumed. The elapsed time is returned in seconds or as a duration.

Member Function Documentation

◆ elapsed()

template<class T>
TimerBase< T >::duration lucid::TimerBase< T >::elapsed ( ) const
nodiscard

Get read-only access to the duration of elapsed time of the timer.

Returns
duration of elapsed time of the timer

◆ is_running()

template<class T>
bool lucid::TimerBase< T >::is_running ( ) const
nodiscard

Check whether the timer is running.

Returns
true if the timer is running
false if the timer is not running

◆ now()

template<typename T>
time_point lucid::TimerBase< T >::now ( ) const
inlinenodiscardprotected

Get read-only access to the current instant of the timer.

Returns
current instant of the timer

◆ pause()

template<class T>
void lucid::TimerBase< T >::pause ( )

Pause the timer.

If the timer is not running, this function does nothing.

◆ resume()

template<class T>
void lucid::TimerBase< T >::resume ( )

Resume the timer.

If the timer is not running, this function does nothing.

◆ seconds()

template<class T>
std::chrono::duration< double >::rep lucid::TimerBase< T >::seconds ( ) const
nodiscard

Get read-only access to the number elapsed seconds of the timer.

Returns
number elapsed seconds of the timer

◆ start()

template<class T>
void lucid::TimerBase< T >::start ( )

Start the timer.

The timer is reset to zero.


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