Efficient use of vTaskList and vTaskGetRunTimeStats
Posted: Wed Apr 10, 2024 9:16 am
Hello guys!
I want to gather data about my tasks into a JsonDocument with ArduinoJson.
The problem I'm facing is that vTaskList and vTaskGetRunTimeStats does not provide any struct or usable variables to retrive information.
My thiking would be something like this
Or it would be even better if we got an interable list of task infos or something.
This works:
But it is not efficient. I don't want to print it, I want to send it.
Does anyone know how to do that? How does vTaskList and vTaskGetRunTimeStats gets the data?
I want to gather data about my tasks into a JsonDocument with ArduinoJson.
The problem I'm facing is that vTaskList and vTaskGetRunTimeStats does not provide any struct or usable variables to retrive information.
My thiking would be something like this
Code: Select all
//retrive vTaskList into a struct or something
task_list_struct taskInfos = getTaskList();
// Add info to a JsonDocument
JsonDocument taskInfo;
taskInfo["name"] = taskInfos.name;
This works:
Code: Select all
char taskListBuff[2048] = {0};
char taskRunTimeStatsBuff[2048] = {0};
vTaskList(taskListBuff);
vTaskGetRunTimeStats(taskRunTimeStatsBuff);
printf("vTaskList: %s\n", taskListBuff);
printf("vTaskGetRunTimeStats: %s\n", taskRunTimeStatsBuff);
Does anyone know how to do that? How does vTaskList and vTaskGetRunTimeStats gets the data?