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,
Erich