diff options
author | Hardy Griech <ntbox@gmx.net> | 2023-02-03 01:40:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-03 01:40:27 +0300 |
commit | 570ade4001e50adbf06a074582ea993af562e0e1 (patch) | |
tree | fa4ca4b39813a0034b2e2fd42daf8c7c5ee386f6 | |
parent | 0f9e6e5b521009f585018b47f7e8aa573f010206 (diff) |
performance counting: ulTaskSwitchedInTime and ulTotalRunTime must be (#618)
arrays, index is core number
-rw-r--r-- | tasks.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -396,8 +396,8 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t /* Do not move these variables to function scope as doing so prevents the * code working with debuggers that need to remove the static qualifier. */ - PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */ - PRIVILEGED_DATA static volatile uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */ + PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime[ configNUM_CORES ] = { 0UL }; /*< Holds the value of a timer/counter the last time a task was switched in. */ + PRIVILEGED_DATA static volatile uint32_t ulTotalRunTime[ configNUM_CORES ] = { 0UL }; /*< Holds the total amount of execution time as defined by the run time counter clock. */ #endif @@ -3877,9 +3877,9 @@ void vTaskSwitchContext( BaseType_t xCoreID ) #if ( configGENERATE_RUN_TIME_STATS == 1 ) { #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE - portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime ); + portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime[ xCoreID ] ); #else - ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE(); + ulTotalRunTime[ xCoreID ] = portGET_RUN_TIME_COUNTER_VALUE(); #endif /* Add the amount of time the task has been running to the @@ -3889,16 +3889,16 @@ void vTaskSwitchContext( BaseType_t xCoreID ) * overflows. The guard against negative values is to protect * against suspect run time stat counter implementations - which * are provided by the application, not the kernel. */ - if( ulTotalRunTime > ulTaskSwitchedInTime ) + if( ulTotalRunTime[ xCoreID ] > ulTaskSwitchedInTime[ xCoreID ] ) { - pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime ); + pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime[ xCoreID ] - ulTaskSwitchedInTime[ xCoreID ] ); } else { mtCOVERAGE_TEST_MARKER(); } - ulTaskSwitchedInTime = ulTotalRunTime; + ulTaskSwitchedInTime[ xCoreID ] = ulTotalRunTime[ xCoreID ]; } #endif /* configGENERATE_RUN_TIME_STATS */ |