[Feature Request]: Add CPU usage to host Metrics
Platform
Cross-Platform
Description
I realise there can be a slight performance penalty for this which is why I think it should be more like an opt in toggle for debugging, however I'm interested to know how for example a high site node is performing and whether cpu is a bottleneck, in particular on the single core low power devices.
Would it be possible to get this added in somewhere?
It's my understanding this could potentially be implemented by leveraging FreeRTOS's run-time statistics capabilities (detailed at https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/08-Run-time-statistics), which involves enabling configGENERATE_RUN_TIME_STATS and configuring the associated timer macros.
Thanks.
I would expect the arduino loop() polling to eat up 100% CPU all the time and therefore doesn't let the FreeRTOS idle task run to count its idle time. A solution would require to measure the runtime of a single loop walkthrough and to calculate according expected runtime (based on actual CPU and frequency) an estimated "idle" time / percentage value.
I would expect the arduino loop() polling to eat up 100% CPU all the time and therefore doesn't let the FreeRTOS idle task run to count its idle time.
The loop() function is called by the idle task when using FreeRTOS under Arduino.
This is implemented in forked version by instrumenting loop() and RadioLibInterface::onNotify to measure time it spent doing actual work (excluding mainDelay.delay(...)).
It does not include time spent handling interrupts, but those should be minimal anyway.