|
sas
Modularised monitoring, logging, and control of robots.
|
Public Types | |
| enum class | TimeType { Computational , EffectiveSampling , Idle } |
Public Member Functions | |
| Clock (const int &)=delete | |
| Clock (const double &sampling_time_in_seconds, const bool &enable_statistics=true) | |
| Construct a Clock. | |
| void | init () |
| Initialize the clock internal state and timers. | |
| void | update_and_sleep () |
| Update internal timing measurements and sleep to respect target sampling time. | |
| double | get_elapsed_time_sec () const |
| Get elapsed time since last update in seconds. | |
| std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > | get_initial_time () const |
| Get the initial time point recorded by the clock. | |
| std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > | get_last_update_time () const |
| Get the time point of the last update. | |
| void | safe_sleep_seconds (const double &seconds, std::atomic_bool *break_loop) |
| Sleep for the specified duration while allowing early exit via break_loop. | |
| void | blocking_sleep_seconds (const double &seconds) |
| Block the calling thread for the specified duration (no early exit) | |
| double | get_desired_thread_sampling_time_sec () const |
| Return the desired sampling time for the thread in seconds. | |
| long | get_overrun_count () const |
| Return the number of times the sampling has overrun the target period. | |
| double | get_time (const TimeType &time_type) const |
| Get a time value for the provided TimeType. | |
| double | get_statistics (const Statistics &statistics, const TimeType &time_type) const |
| Get a statistic value for the given statistic type and TimeType. | |
| double | get_computation_time () const |
| Deprecated. | |
| double | get_sleep_time () const |
| double | get_effective_thread_sampling_time_sec () const |
|
explicit |
Construct a Clock.
| sampling_time_in_seconds | Desired sampling time in seconds |
| enable_statistics | Whether to enable internal statistics collection (default: true) |
| void sas::Clock::blocking_sleep_seconds | ( | const double & | seconds | ) |
Block the calling thread for the specified duration (no early exit)
| seconds | Sleep duration in seconds |
| double sas::Clock::get_desired_thread_sampling_time_sec | ( | ) | const |
Return the desired sampling time for the thread in seconds.
| double sas::Clock::get_elapsed_time_sec | ( | ) | const |
Get elapsed time since last update in seconds.
| std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > sas::Clock::get_initial_time | ( | ) | const |
Get the initial time point recorded by the clock.
| std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > sas::Clock::get_last_update_time | ( | ) | const |
Get the time point of the last update.
| long sas::Clock::get_overrun_count | ( | ) | const |
Return the number of times the sampling has overrun the target period.
| double sas::Clock::get_statistics | ( | const Statistics & | statistics, |
| const TimeType & | time_type | ||
| ) | const |
Get a statistic value for the given statistic type and TimeType.
| statistics | The statistic to query (see sas::Statistics) |
| time_type | The TimeType to which the statistic applies |
| double sas::Clock::get_time | ( | const TimeType & | time_type | ) | const |
Get a time value for the provided TimeType.
| time_type | The TimeType (Computational, EffectiveSampling, Idle) |
| void sas::Clock::safe_sleep_seconds | ( | const double & | seconds, |
| std::atomic_bool * | break_loop | ||
| ) |
Sleep for the specified duration while allowing early exit via break_loop.
| seconds | Sleep duration in seconds |
| break_loop | Pointer to an atomic boolean that will interrupt the sleep if set |