|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
On-demand aggregate CPU-load read-out from FreeRTOS run-time stats. More...
#include <CpuStats.h>
Static Public Member Functions | |
| static bool | sample (uint64_t &idleUs, uint64_t &wallUs) |
| Snapshot cumulative idle CPU time and the wall-clock reference. | |
| static uint8_t | loadOverWindow (uint32_t windowMs=250) |
| Measure aggregate CPU load over a blocking window. | |
On-demand aggregate CPU-load read-out from FreeRTOS run-time stats.
Requires CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS. Load is derived from the idle-task run-time counters versus wall-clock time across all cores. Nothing is sampled in the background; a caller measures only when it asks.
Definition at line 14 of file CpuStats.h.
|
static |
Measure aggregate CPU load over a blocking window.
| windowMs | Measurement window in milliseconds. |
Definition at line 40 of file CpuStats.cpp.
References sample().
Referenced by cdc::ui::buildHardwareInfoText(), and cdc::serial::cmdCpu().
|
static |
Snapshot cumulative idle CPU time and the wall-clock reference.
| idleUs | Out: summed run-time of every core's idle task, in run-time counter units (microseconds with the esp_timer source). |
| wallUs | Out: current wall clock from esp_timer, in microseconds. |
Definition at line 12 of file CpuStats.cpp.
References cdc::core::psramAlloc().
Referenced by host_cpu_load(), and loadOverWindow().