How to Display task usage?

Hello,

I have an equipment that integrate FreeRTOS+Web Server.
I would like a web interface that displays CPU/RAM usage for each task.
For CPU usage, I saw FreeRTOS integrate vTaskGetInfo() function but it is for debugging only (https://www.freertos.org/vTaskGetInfo.html).
=> How can I do ?

It is listed as debugging only because it has a somewhat sizable period when it needs to block the scheduler, but if you application can tolerate that, it is still usable. I just wouldn’t call it regularly at a fast interval.

1 Like

You can also use https://www.freertos.org/uxTaskGetSystemState.html

I thank you, it operates… but CPU usage for interruptions isn’t counted, ins’t it ?.. because I’m surprised that my iddle task is always superior at 85%.
… is it possible to integrate interruptions ?

How easy that would be depends on the chip you are using. If you are using something with a single interrupt entry point then it would be moderately simple, if you are using something that autovectors to lots of different interrupt service routines then it would be harder.

1 Like

FreeRTOS doesn’t provide hooks to measure the time in interrupts. For most systems, that should be pretty short.

It is possible to by using the freertos_tasks_c_additions.h file to implement yourself a tracking of ISR usage (and make ISR time not count to the interrupted task). I have done it, but it isn’t code that I can share as it was done on company time so they maintain proprietary rights. It does require that YOU add code to every ISR to call a function at the start and end of the ISR to do the tracking.

1 Like