dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
dlinear::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 dlinear::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.

Definition at line 26 of file Timer.h.

Member Function Documentation

◆ elapsed()

template<class T >
TimerBase< T >::duration dlinear::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

Definition at line 50 of file Timer.cpp.

◆ is_running()

template<class T >
bool dlinear::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

Definition at line 45 of file Timer.cpp.

◆ now()

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

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

Returns
current instant of the timer

Definition at line 68 of file Timer.h.

◆ Pause()

template<class T >
void dlinear::TimerBase< T >::Pause ( )

Pause the timer.

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

Definition at line 29 of file Timer.cpp.

◆ Resume()

template<class T >
void dlinear::TimerBase< T >::Resume ( )

Resume the timer.

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

Definition at line 37 of file Timer.cpp.

◆ seconds()

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

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

Returns
number elapsed seconds of the timer

Definition at line 56 of file Timer.cpp.

◆ Start()

template<class T >
void dlinear::TimerBase< T >::Start ( )

Start the timer.

The timer is reset to zero.

Definition at line 21 of file Timer.cpp.


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