vTaskGetRunTimeStats: 1 task > 100% CPU?

tjohansen wrote on Friday, May 31, 2013:


I’m using the vTaskGetRunTimeStats to get runtime information of the tasks.
But 1 task starts out with CPU usage to more than 100 % (A huge number ex: 152354223%)
The value is decreasing over time and ends up where it should be.

The task is straight forward, it waits on a queue with a timeout of 5 sec. The priority is just like the other task

Any idea what could cause this? Event if the task was badly written it should just ending up using 100 % !!


rtel wrote on Friday, May 31, 2013:

I actually noticed something like this myself - while giving a live demonstration of all times for it to happen.  I’m not sure what caused it but suspect it will be either an initialisation timing problem (whereby the first reading is taken before the timer used for the stats is initialised properly), or some kind of calculation rounding or underflow problem.  Please report back if you find the answer - and in the mean time please also add a “bug report” in the FreeRTOS SourceForge bug tracker to ensure the problem is investigated properly.