Zero-heap multi-service heartbeat tracker for safety-critical execution. Thread-safe for concurrent heartbeat signals and supervisory health checks.
More...
#include <HeartbeatMonitor.hpp>
|
| 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.
|
| |
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
-
| MaxServices | Maximum number of monitored services (default: 16). |
◆ HeartbeatMonitor()
template<std::size_t MaxServices = 16>
◆ beat()
template<std::size_t MaxServices = 16>
Record a heartbeat for a given service.
- Parameters
-
| serviceId | Unique service identifier. |
| nowNs | Current timestamp in nanoseconds. |
◆ 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
-
| nowNs | Current timestamp in nanoseconds. |
| outTimedOutServiceId | Populated with the ID of the first failing service if unhealthy. |
| outLastHeartbeatNs | Populated with the timestamp of the last received heartbeat if unhealthy. |
| outTimeoutBudgetNs | Populated with the allowed timeout budget if unhealthy. |
- Returns
- true if all services are within their heartbeat SLA; false otherwise.
◆ maxServices()
template<std::size_t MaxServices = 16>
Get maximum capacity of monitored services.
◆ registerService()
template<std::size_t MaxServices = 16>
Register a service for heartbeat monitoring with a specified timeout.
- Parameters
-
| serviceId | Unique numeric identifier for the service. |
| timeoutNs | Maximum allowed duration between heartbeats in nanoseconds. |
| initialTimestampNs | Initial timestamp to baseline the service. |
- Returns
- true if successfully registered, false if capacity exceeded.
◆ unregisterService()
template<std::size_t MaxServices = 16>
Unregister a service from active monitoring.
The documentation for this class was generated from the following file: