LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
CpuCheckTimer Class Reference

A timer that periodically checks CPU load and logs a warning if it exceeds a configured threshold. More...

#include <CpuCheckTimer.h>

Inherits Timer.

Public Member Functions

 CpuCheckTimer (ActiveTimers *timers, uint8_t threshold)
 Constructor. More...
 
long long timeout () override
 Called by the OpenMRN timer scheduler at regular intervals. More...
 

Private Attributes

uint8_t threshold_
 CPU load threshold percentage to trigger a warning.
 

Detailed Description

A timer that periodically checks CPU load and logs a warning if it exceeds a configured threshold.

This class is intended for monitoring system performance during runtime. It uses OpenMRN's Timer infrastructure and samples CPU load every 33 ms. When the 1-second averaged CPU load exceeds the configured threshold, it logs a warning message.

The actual CPU load is retrieved from CpuLoad::instance().

Definition at line 54 of file CpuCheckTimer.h.

Constructor & Destructor Documentation

◆ CpuCheckTimer()

CpuCheckTimer::CpuCheckTimer ( ActiveTimers *  timers,
uint8_t  threshold 
)
inline

Constructor.

Parameters
timersThe OpenMRN ActiveTimers registry this timer will be attached to.
thresholdThe CPU usage percentage threshold (0–100) that will trigger a warning log.

Definition at line 63 of file CpuCheckTimer.h.

Member Function Documentation

◆ timeout()

long long CpuCheckTimer::timeout ( )
inlineoverride

Called by the OpenMRN timer scheduler at regular intervals.

This method checks the current CPU load. If it exceeds the configured threshold, a warning is logged.

Returns
Time in nanoseconds until the next timer event (33 ms).

Definition at line 77 of file CpuCheckTimer.h.


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