Chapter 2. API Reference
// format the raw data as human readable ASCII data
for( x = 0; x < uxArraySize; x++ )
{
/ ulTotalRunTime;
→
pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x
→
ulStatsAsPercentage );
→
pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
→
}
}
// The array is no longer needed, free the memory it consumes.
vPortFree( pxTaskStatusArray );
}
}
Return The number of TaskStatus_t structures that were populated by uxTaskGetSystemState(). This should
equal the number returned by the uxTaskGetNumberOfTasks() API function, but will be zero if the value
passed in the uxArraySize parameter was too small.
Parameters
• pxTaskStatusArray: A pointer to an array of TaskStatus_t structures. The array must contain
at least one TaskStatus_t structure for each task that is under the control of the RTOS. The number
of tasks under the control of the RTOS can be determined using the uxTaskGetNumberOfTasks()
API function.
• uxArraySize: The size of the array pointed to by the pxTaskStatusArray parameter. The size is
specified as the number of indexes in the array, or the number of TaskStatus_t structures contained
in the array, not by the number of bytes in the array.
• pulTotalRunTime: If configGENERATE_RUN_TIME_STATS is set to 1 in FreeRTOSCon-
fig.h then *pulTotalRunTime is set by uxTaskGetSystemState() to the total run time (as defined by
the run time stats clock, see https://www.FreeRTOS.org/rtos-run-time-stats.html) since the target
booted. pulTotalRunTime can be set to NULL to omit the total run time information.
void vTaskList(char *pcWriteBuffer)
List all the current tasks.
configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must both be de-
fined as 1 for this function to be available. See the configuration section of the FreeRTOS.org website for more
information.
NOTE 1: This function will disable interrupts for its duration. It is not intended for normal application runtime
use but as a debug aid.
Lists all the current tasks, along with their current state and stack usage high water mark.
Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or suspended ('S').
Espressif Systems
// What percentage of the total run time has the task used?
// This will always be rounded down to the nearest integer.
// ulTotalRunTimeDiv100 has already been divided by 100.
ulStatsAsPercentage = pxTaskStatusArray[ x
if( ulStatsAsPercentage > 0UL )
{
sprintf( pcWriteBuffer,
}
else
{
// If the percentage is zero here then the task has
// consumed less than 1% of the total run time.
sprintf( pcWriteBuffer,
}
pcWriteBuffer += strlen( ( char * ) pcWriteBuffer );
870
Submit Document Feedback
(continued from previous page)
].ulRunTimeCounter␣
"%s\t\t%lu\t\t%lu%%\r\n",␣
].ulRunTimeCounter,␣
"%s\t\t%lu\t\t<1%%\r\n",␣
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?