Currently, the existing method to gather task runtime statistics involves traversing all tasks in the system and outputting the data using a fixed format to pcWriteBuffer. However, this approach relies on snprintf(), which can be too resource-intensive for embedded systems.
I propose introducing a more efficient API that allows users to query the runtime statistics for a specific task using its TaskID. The API would return a dedicated structure, which would be more practical and reduce system overhead.
The function uxTaskGetSystemState() - FreeRTOS™ allows users to retrieve runtime information for all tasks. However, users are required to prepare an array to store this information, which can consume significant stack space.
Additionally, if the user is only interested in a few specific tasks rather than all of them, they must manually search for those tasks in the returned array. This process can be inefficient. Therefore, using an API to retrieve the runtime statistics for specific tasks could be a more flexible and efficient solution.
Just my two cends.