Flow
Documentation for the Flow C++ Library
|
A simple timer to record timelapses. Uses steady_clock by default. More...
#include <flow_timer.h>
Public Member Functions | |
constexpr | Timer (std::size_t reserveSize=8) |
Constructs a Timer and reserves space for time points. | |
constexpr std::size_t | size () const |
Returns the number of recorded time points. | |
void | reset () |
Clears all recorded time points and resets the starting time. | |
void | record () |
Records the current time point relative to the last reset. | |
std::string | toString () const |
Formats and returns a string showing all recorded durations since reset. |
Private Types | |
using | TimePoint = typename ClockType::time_point |
Private Attributes | |
TimePoint | begin_ {} |
std::vector< TimePoint > | timepoints_ {} |
A simple timer to record timelapses. Uses steady_clock by default.
Definition at line 11 of file flow_timer.h.
|
private |
Definition at line 12 of file flow_timer.h.
|
inlineexplicitconstexpr |
Constructs a Timer and reserves space for time points.
reserveSize | Number of time points to reserve space for. |
Definition at line 19 of file flow_timer.h.
References timepoints_.
|
inline |
Records the current time point relative to the last reset.
Definition at line 36 of file flow_timer.h.
References timepoints_.
|
inline |
Clears all recorded time points and resets the starting time.
Definition at line 30 of file flow_timer.h.
References begin_, and timepoints_.
|
inlineconstexpr |
Returns the number of recorded time points.
Definition at line 25 of file flow_timer.h.
References timepoints_.
|
inline |
Formats and returns a string showing all recorded durations since reset.
Definition at line 42 of file flow_timer.h.
References begin_, and timepoints_.
|
private |
|
private |
Definition at line 14 of file flow_timer.h.
Referenced by record(), reset(), size(), Timer(), and toString().