Bayes Filters Library
|
This template class provides methods to keep track of time. More...
#include <utils.h>
Public Member Functions | |
void | start () |
Start the timer. More... | |
void | stop () |
Stop the timer. More... | |
double | elapsed () |
Get the time passed between a start() and stop() call. More... | |
double | now () |
Get the absolute time from epoch. More... | |
bool | is_running () |
Check if the timer is running or not. More... | |
Private Attributes | |
std::chrono::steady_clock::time_point | start_time_ = std::chrono::steady_clock::now() |
The start time. More... | |
std::chrono::steady_clock::time_point | stop_time_ = start_time_ |
The stop time. More... | |
bool | running_ = false |
Running status flag. More... | |
This template class provides methods to keep track of time.
The default time unit is milliseconds, but can be changed during object creation using a different std::chrono::duration type. See https://en.cppreference.com/w/cpp/chrono/duration for reference. The timer starts and stops using, respectively, start() and stop() method. The get the time elapsed between a start() and stop() call, use the elapsed() method. The elapsed() method can be used to get the elapsed time from the start() call, before calling stop(). To get the absolute time from epoch use the now() method.
|
inline |
Get the time passed between a start() and stop() call.
If used between a start() and stop() call, returns the time elapsed from the start() call.
Definition at line 494 of file utils.h.
References bfl::utils::CpuTimer< timetype >::running_, bfl::utils::CpuTimer< timetype >::start_time_, and bfl::utils::CpuTimer< timetype >::stop_time_.
Referenced by bfl::TimeDecreasingDynamics::setProperty().
|
inline |
Check if the timer is running or not.
Definition at line 523 of file utils.h.
References bfl::utils::CpuTimer< timetype >::running_.
Referenced by bfl::TimeDecreasingDynamics::setProperty().
|
inline |
|
inline |
Start the timer.
Definition at line 469 of file utils.h.
References bfl::utils::CpuTimer< timetype >::running_, and bfl::utils::CpuTimer< timetype >::start_time_.
Referenced by bfl::TimeDecreasingDynamics::setProperty().
|
inline |
Stop the timer.
Definition at line 480 of file utils.h.
References bfl::utils::CpuTimer< timetype >::running_, and bfl::utils::CpuTimer< timetype >::stop_time_.
Referenced by bfl::TimeDecreasingDynamics::setProperty().
|
private |
Running status flag.
Definition at line 544 of file utils.h.
Referenced by bfl::utils::CpuTimer< timetype >::elapsed(), bfl::utils::CpuTimer< timetype >::is_running(), bfl::utils::CpuTimer< timetype >::start(), and bfl::utils::CpuTimer< timetype >::stop().
|
private |
The start time.
Definition at line 532 of file utils.h.
Referenced by bfl::utils::CpuTimer< timetype >::elapsed(), and bfl::utils::CpuTimer< timetype >::start().
|
private |
The stop time.
Definition at line 538 of file utils.h.
Referenced by bfl::utils::CpuTimer< timetype >::elapsed(), and bfl::utils::CpuTimer< timetype >::stop().