Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: display xCoreID in vTaskList #2064

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions components/freertos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ config FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
FreeRTOS. This will allow the usage of stats formatting functions such
as vTaskList().

config FREERTOS_VTASKLIST_INCLUDE_COREID
bool "Enable display of xCoreID in vTaskList"
depends on FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
default n
help
If enabled, this will include an extra column when vTaskList is called
to display the CoreID the task is pinned to (0,1) or -1 if not pinned.

config FREERTOS_GENERATE_RUN_TIME_STATS
bool "Enable FreeRTOS to collect run time stats"
default n
Expand Down
1 change: 1 addition & 0 deletions components/freertos/include/freertos/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ typedef struct xTASK_STATUS
uint32_t ulRunTimeCounter; /*!< The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
StackType_t *pxStackBase; /*!< Points to the lowest address of the task's stack area. */
uint32_t usStackHighWaterMark; /*!< The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
BaseType_t xCoreID; /*!< Core this task is pinned to */
} TaskStatus_t;

/**
Expand Down
5 changes: 5 additions & 0 deletions components/freertos/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3784,6 +3784,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber;
pxTaskStatusArray[ uxTask ].eCurrentState = eState;
pxTaskStatusArray[ uxTask ].uxCurrentPriority = pxNextTCB->uxPriority;
pxTaskStatusArray[ uxTask ].xCoreID = pxNextTCB->xCoreID;

#if ( INCLUDE_vTaskSuspend == 1 )
{
Expand Down Expand Up @@ -4449,7 +4450,11 @@ For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and port
pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );

/* Write the rest of the string. */
#ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\t%hd\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber, ( int ) pxTaskStatusArray[ x ].xCoreID );
#else
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
#endif
pcWriteBuffer += strlen( pcWriteBuffer );
}

Expand Down