CPU load abnormal

Freertos CPU load occasionally reaches 100%, but there are only some simple tasks; Calculation formula: (Total time - Idle task running time)/Total time. Will Tickless model affect CPU load calculation?

Depending on how tickless idle is working, it might not carry CPU load measurements correctly over it, and not count that idle time.


As Richard mentioned, tickless idle sleep mode may effect idle time count. To ensure accurate time counting, we can check the following:

  • Examine the implementations of portALT_GET_RUN_TIME_COUNTER_VALUE and portGET_RUN_TIME_COUNTER_VALUE. These two port run time macros are responsible for obtaining the run time counter time base. If the counter is halted during the tickless idle sleep, the time elapsed during sleep may not be accounted for.
  • Some ports utilize xTickCount to implement these two port macros. Please verify if vTaskStepTick is called within your portSUPPRESS_TICKS_AND_SLEEP implementation. The vTaskStepTick function is used to correct xTickCount and account for the time that passed during the sleep period.