I am using FreeRTOS component in my SDK application, and I want to measure CPU load. What logic should I write in my application code to calculate CPU usage in RTOS environment and how?
FreeRTOS already has that built-in.
See Better FreeRTOS Debugging in Eclipse | MCU on Eclipse , section "Runtime Information".
If you don't want to use Eclipse to visualize the data, then have a look at Tutorial: Using Runtime Statistics with Amazon FreeRTOS V10 | MCU on Eclipse where I'm using a UART connection to the target with a shell to see how much load is used by each task.
I hope this helps,
Retrieving data ...