Skip to content

Commit 570ade4

Browse files
authored
performance counting: ulTaskSwitchedInTime and ulTotalRunTime must be (#618)
arrays, index is core number
1 parent 0f9e6e5 commit 570ade4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tasks.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
396396

397397
/* Do not move these variables to function scope as doing so prevents the
398398
* code working with debuggers that need to remove the static qualifier. */
399-
PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */
400-
PRIVILEGED_DATA static volatile uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */
399+
PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime[ configNUM_CORES ] = { 0UL }; /*< Holds the value of a timer/counter the last time a task was switched in. */
400+
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. */
401401

402402
#endif
403403

@@ -3877,9 +3877,9 @@ void vTaskSwitchContext( BaseType_t xCoreID )
38773877
#if ( configGENERATE_RUN_TIME_STATS == 1 )
38783878
{
38793879
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
3880-
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );
3880+
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime[ xCoreID ] );
38813881
#else
3882-
ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
3882+
ulTotalRunTime[ xCoreID ] = portGET_RUN_TIME_COUNTER_VALUE();
38833883
#endif
38843884

38853885
/* Add the amount of time the task has been running to the
@@ -3889,16 +3889,16 @@ void vTaskSwitchContext( BaseType_t xCoreID )
38893889
* overflows. The guard against negative values is to protect
38903890
* against suspect run time stat counter implementations - which
38913891
* are provided by the application, not the kernel. */
3892-
if( ulTotalRunTime > ulTaskSwitchedInTime )
3892+
if( ulTotalRunTime[ xCoreID ] > ulTaskSwitchedInTime[ xCoreID ] )
38933893
{
3894-
pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime );
3894+
pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime[ xCoreID ] - ulTaskSwitchedInTime[ xCoreID ] );
38953895
}
38963896
else
38973897
{
38983898
mtCOVERAGE_TEST_MARKER();
38993899
}
39003900

3901-
ulTaskSwitchedInTime = ulTotalRunTime;
3901+
ulTaskSwitchedInTime[ xCoreID ] = ulTotalRunTime[ xCoreID ];
39023902
}
39033903
#endif /* configGENERATE_RUN_TIME_STATS */
39043904

0 commit comments

Comments
 (0)