From 14e00b6a3091ccbda96d2c197663d0fcfe93d46f Mon Sep 17 00:00:00 2001 From: Dave McNaughton Date: Thu, 14 Jun 2018 20:37:52 +1000 Subject: [PATCH 1/2] Added: display xCoreID in vTaskList --- components/freertos/include/freertos/task.h | 1 + components/freertos/tasks.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/freertos/include/freertos/task.h b/components/freertos/include/freertos/task.h index ab605bb30161..f0600ef38751 100644 --- a/components/freertos/include/freertos/task.h +++ b/components/freertos/include/freertos/task.h @@ -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; } TaskStatus_t; /** diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index fe081975dd47..07d99078a59c 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -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 ) { @@ -4449,7 +4450,7 @@ For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and port pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName ); /* Write the rest of the string. */ - 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 ); + 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 ); pcWriteBuffer += strlen( pcWriteBuffer ); } From 67711e4d8ed32bb4cf432caa9cc6936ce5183f0b Mon Sep 17 00:00:00 2001 From: Dave McNaughton Date: Tue, 3 Jul 2018 01:48:24 +1000 Subject: [PATCH 2/2] Added: CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID --- components/freertos/Kconfig | 8 ++++++++ components/freertos/include/freertos/task.h | 2 +- components/freertos/tasks.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 1a037377c8f5..16c7c4bc87e3 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -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 diff --git a/components/freertos/include/freertos/task.h b/components/freertos/include/freertos/task.h index f0600ef38751..c548c945fde2 100644 --- a/components/freertos/include/freertos/task.h +++ b/components/freertos/include/freertos/task.h @@ -181,7 +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; + BaseType_t xCoreID; /*!< Core this task is pinned to */ } TaskStatus_t; /** diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 07d99078a59c..1265583b7ebf 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -4450,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 ); }