HIBF 1.0.0-rc.1
|
A timer. More...
#include <hibf/misc/timer.hpp>
Public Member Functions | |
Constructors, destructor and assignment | |
serial_timer ()=default | |
Defaulted. | |
serial_timer (serial_timer const &)=default | |
Defaulted. | |
serial_timer & | operator= (serial_timer const &)=default |
Defaulted. | |
serial_timer (serial_timer &&)=default | |
Defaulted. | |
serial_timer & | operator= (serial_timer &&)=default |
Defaulted. | |
~serial_timer ()=default | |
Defaulted. | |
Modification | |
void | start () |
Starts the timer. | |
void | stop () |
Stops the timer. | |
template<typename timer_t > requires (std::same_as<timer_t, serial_timer> || std::same_as<timer_t, concurrent_timer>) | |
void | operator+= (timer_t const &other) |
Adds another timer. | |
Access | |
double | in_seconds () const |
Returns the measured time in seconds. | |
double | max_in_seconds () const |
Returns the maximum measured time interval in seconds. | |
double | avg_in_seconds () const |
Returns the average measured time interval in seconds. | |
Comparison | |
constexpr bool | operator== (serial_timer const &) const |
Two timer are always equal. | |
constexpr bool | operator== (concurrent_timer const &) const |
Two timer are always equal. | |
Friends | |
class | concurrent_timer |
A timer.
|
inline |
Stops the timer.
In Debug mode, an assertion checks that start()
has been called before.
|
inline |
Returns the maximum measured time interval in seconds.
A time interval may be:
start()
and stop()
.operator+=()
.
|
inline |
Returns the average measured time interval in seconds.
A time interval may be:
start()
and stop()
.operator+=()
.The count used for averaging is the number of calls to stop()
and operator+=()
.
stop()
or operator+=()
have been used is undefined behaviour.