basic_timer.h Source File
|
CPP API
|
basic_timer.h
Go to the documentation of this file.
void reset()
Set the elapsed time to 0. Only call while the timer is stopped.
Definition: basic_timer.h:56
void stop()
Stop the timer and update the elapsed time. After calling stop, the timer may be started again.
Definition: basic_timer.h:47
void set_running(bool new_state)
In Debug builds, set whether the timer is running or not.
Definition: basic_timer.cpp:9
static IOResult< BasicTimer > deserialize(IOContext &io)
deserialize an object of this class.
Definition: basic_timer.h:90
bool m_is_running
In Debug builds, tracks whether the timer is running.
Definition: basic_timer.h:110
void should_be_running(bool expected, const std::string_view function) const
In Debug builds, check that the state of m_is_running is as expected. Log an error if not.
Definition: basic_timer.cpp:18
DurationType m_elapsed_time
The total time spent between starts and stops.
Definition: basic_timer.h:107
DurationType get_elapsed_time() const
Get the total time spent between starts and stops. Only call while the timer is stopped.
Definition: basic_timer.h:63
void start()
Start the timer. Must be followed by exactly one stop.
Definition: basic_timer.h:39
TimeType m_start_time
The last time point at which start() was called.
Definition: basic_timer.h:106
void serialize(IOContext &io) const
serialize this.
Definition: basic_timer.h:79
decltype(auto) convert_to_ticks(DurationType duration)
Convert a duration to integer ticks. Useful for serialization.
Definition: definitions.h:49
std::chrono::steady_clock::duration DurationType
Definition: definitions.h:41
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:481
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
Generated by