Class Timer¶
Defined in File timer.hpp
Class Documentation¶
-
class Timer¶
Public Functions
-
explicit Timer(TimePoint time)¶
Construct a new Timer object.
- Parameters
time – set the start time to this value
-
explicit Timer(bool start = false)¶
Construct a new Timer object.
- Parameters
start – start the timer on construction
-
void start()¶
Add or replace the label “start” with the current time.
-
void stop()¶
Add or replace the label “stop” with the current time.
-
void add(const std::string &label)¶
Add or replace the given label with the current time.
- Parameters
label – label to assign to the current timestamp
-
void add(const std::string &label, TimePoint time)¶
Add or replace the given label with the given time.
- Parameters
label – label to assign to the timestamp
time – the timestamp
-
void clear()¶
Clear all the saved timestamps.
-
template<typename U = std::ratio<1, 1>, typename T = double>
inline T count(const std::string &start = "start", const std::string &stop = "stop")¶ Return the duration between two labeled timestamps.
- Template Parameters
U – the ratio to convert the time e.g. std::micro for microseconds
T – the type to return the time as
- Parameters
start – the label for the start time
stop – the label for the stop time
- Returns
T the duration between the start and stop time in the right units
-
explicit Timer(TimePoint time)¶