Corium 1.1.0
High-Performance Zero-Heap C++20 MPSC Application Runtime
Loading...
Searching...
No Matches
corium::safety::HeartbeatMonitor< MaxServices > Class Template Reference

Zero-heap multi-service heartbeat tracker for safety-critical execution. Thread-safe for concurrent heartbeat signals and supervisory health checks. More...

#include <HeartbeatMonitor.hpp>

+ Inheritance diagram for corium::safety::HeartbeatMonitor< MaxServices >:
+ Collaboration diagram for corium::safety::HeartbeatMonitor< MaxServices >:

Classes

struct  ServiceEntry
 

Public Member Functions

void beat (uint32_t serviceId, uint64_t nowNs) noexcept
 Record a heartbeat for a given service.
 
bool checkHealth (uint64_t nowNs, uint32_t &outTimedOutServiceId, uint64_t &outLastHeartbeatNs, uint64_t &outTimeoutBudgetNs) const noexcept
 Check health status of all registered active services.
 
 HeartbeatMonitor ()=default
 
constexpr std::size_t maxServices () const noexcept
 Get maximum capacity of monitored services.
 
bool registerService (uint32_t serviceId, uint64_t timeoutNs, uint64_t initialTimestampNs=0) noexcept
 Register a service for heartbeat monitoring with a specified timeout.
 
void unregisterService (uint32_t serviceId) noexcept
 Unregister a service from active monitoring.
 

Detailed Description

template<std::size_t MaxServices = 16>
class corium::safety::HeartbeatMonitor< MaxServices >

Zero-heap multi-service heartbeat tracker for safety-critical execution. Thread-safe for concurrent heartbeat signals and supervisory health checks.

Template Parameters
MaxServicesMaximum number of monitored services (default: 16).

Constructor & Destructor Documentation

◆ HeartbeatMonitor()

template<std::size_t MaxServices = 16>
corium::safety::HeartbeatMonitor< MaxServices >::HeartbeatMonitor ( )
default

Member Function Documentation

◆ beat()

template<std::size_t MaxServices = 16>
void corium::safety::HeartbeatMonitor< MaxServices >::beat ( uint32_t  serviceId,
uint64_t  nowNs 
)
inlinenoexcept

Record a heartbeat for a given service.

Parameters
serviceIdUnique service identifier.
nowNsCurrent timestamp in nanoseconds.
+ Here is the caller graph for this function:

◆ checkHealth()

template<std::size_t MaxServices = 16>
bool corium::safety::HeartbeatMonitor< MaxServices >::checkHealth ( uint64_t  nowNs,
uint32_t &  outTimedOutServiceId,
uint64_t &  outLastHeartbeatNs,
uint64_t &  outTimeoutBudgetNs 
) const
inlinenoexcept

Check health status of all registered active services.

Parameters
nowNsCurrent timestamp in nanoseconds.
outTimedOutServiceIdPopulated with the ID of the first failing service if unhealthy.
outLastHeartbeatNsPopulated with the timestamp of the last received heartbeat if unhealthy.
outTimeoutBudgetNsPopulated with the allowed timeout budget if unhealthy.
Returns
true if all services are within their heartbeat SLA; false otherwise.
+ Here is the caller graph for this function:

◆ maxServices()

template<std::size_t MaxServices = 16>
constexpr std::size_t corium::safety::HeartbeatMonitor< MaxServices >::maxServices ( ) const
inlineconstexprnoexcept

Get maximum capacity of monitored services.

◆ registerService()

template<std::size_t MaxServices = 16>
bool corium::safety::HeartbeatMonitor< MaxServices >::registerService ( uint32_t  serviceId,
uint64_t  timeoutNs,
uint64_t  initialTimestampNs = 0 
)
inlinenoexcept

Register a service for heartbeat monitoring with a specified timeout.

Parameters
serviceIdUnique numeric identifier for the service.
timeoutNsMaximum allowed duration between heartbeats in nanoseconds.
initialTimestampNsInitial timestamp to baseline the service.
Returns
true if successfully registered, false if capacity exceeded.
+ Here is the caller graph for this function:

◆ unregisterService()

template<std::size_t MaxServices = 16>
void corium::safety::HeartbeatMonitor< MaxServices >::unregisterService ( uint32_t  serviceId)
inlinenoexcept

Unregister a service from active monitoring.


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