From f79f8c1c8099e803a80e094a116b32adf3f6b8be Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Mon, 23 Oct 2023 13:57:15 +0800 Subject: [PATCH] vTaskListTasks prints core affinity mask This commit updates vTaskListTasks so that it prints uxCoreAffinityMask if core affinity is enabled in configuration. --- tasks.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tasks.c b/tasks.c index e941907cf9c..58aaecc0e05 100644 --- a/tasks.c +++ b/tasks.c @@ -7225,13 +7225,24 @@ static void prvResetNextTaskUnblockTime( void ) if( uxConsumedBufferLength < ( uxBufferLength - 1 ) ) { /* Write the rest of the string. */ - iSnprintfReturnValue = snprintf( pcWriteBuffer, - uxBufferLength - uxConsumedBufferLength, - "\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 ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */ + #if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) + iSnprintfReturnValue = snprintf( pcWriteBuffer, + uxBufferLength - uxConsumedBufferLength, + "\t%c\t%u\t%u\t%u\t%x\r\n", + cStatus, + ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, + ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, + ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber, + ( unsigned int ) pxTaskStatusArray[ x ].uxCoreAffinityMask ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */ + #else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ + iSnprintfReturnValue = snprintf( pcWriteBuffer, + uxBufferLength - uxConsumedBufferLength, + "\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 ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */ + #endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ uxCharsWrittenBySnprintf = prvSnprintfReturnValueToCharsWritten( iSnprintfReturnValue, uxBufferLength - uxConsumedBufferLength ); uxConsumedBufferLength += uxCharsWrittenBySnprintf;