task utilization

tlafleur wrote on Tuesday, January 15, 2008:

Is there a function that one can call to determine the approximate % utilization of the target processor and application in FreeRTOS??

if not this would be a great debug tool to add in the future…


woops_ wrote on Tuesday, January 15, 2008:

Not directly but there are possibilities.

Use an idle hook to toggle a pin continuously. Then you can see on a scope the amount of time the idle task is running.

Use a tick hook to see if the current task is the idle task and keep a count of the frequence.

Use an idle hook to perform some other form of measurement.

adarkar9 wrote on Wednesday, January 16, 2008:

If you are fortunate enough to have a spare DAC on board, you can send the current task number to the DAC on a context switch.  Not only do you get % utilization, but you also get a very handy real time execution graph on your scope.  Granted this increases the length of a context switch (by ten instructions for me), the visibility you gain into your system usually makes it worth the cost.

P.S.  I modify the "tskTCB" structure so that "uxTCBNumber" is directly after "pxTopOfStack".  That way my context switch code can easily grab the task number after reading the stack pointer.