Easy Navigation
Loading...
Searching...
No Matches
RtMonitor Class Reference

Detects real-time cycles that start late. More...

#include <RtMonitor.hpp>

Public Types

using Clock = std::chrono::steady_clock
enum class  Status : uint8_t { OK = 0 , LATE = 1 , ERROR = 2 }

Public Member Functions

void configure (double period, double max_period_factor, int max_late_cycles)
 Sets the expected period (s) and the thresholds, and starts over.
int consecutive_late_cycles () const
 Late cycles in a row, up to now.
Status cycle_started (Clock::time_point now)
 A cycle starts at now.
double last_period () const
 Time (s) between the last two cycle starts, 0 if none yet.
uint64_t late_cycles () const
 Late cycles since the last reset().
void reset ()
 Starts over (e.g. on activation): the next cycle has no previous one to be late from.
Status status () const

Detailed Description

Detects real-time cycles that start late.

A cycle is late if it starts more than max_period_factor periods after the previous one. The status is LATE after a late cycle, ERROR after max_late_cycles late cycles in a row, and OK again after a cycle on time.

Member Typedef Documentation

◆ Clock

using Clock = std::chrono::steady_clock

Member Enumeration Documentation

◆ Status

enum class Status : uint8_t
strong
Enumerator
OK 
LATE 
ERROR 

Member Function Documentation

◆ configure()

void configure ( double period,
double max_period_factor,
int max_late_cycles )

Sets the expected period (s) and the thresholds, and starts over.

◆ consecutive_late_cycles()

int consecutive_late_cycles ( ) const
nodiscard

Late cycles in a row, up to now.

◆ cycle_started()

RtMonitor::Status cycle_started ( Clock::time_point now)

A cycle starts at now.

Returns
The status after it.

◆ last_period()

double last_period ( ) const
nodiscard

Time (s) between the last two cycle starts, 0 if none yet.

◆ late_cycles()

uint64_t late_cycles ( ) const
nodiscard

Late cycles since the last reset().

◆ reset()

void reset ( )

Starts over (e.g. on activation): the next cycle has no previous one to be late from.

◆ status()

Status status ( ) const
nodiscard

The documentation for this class was generated from the following files: