Skip to content

Commit

Permalink
Fix ulTotalRunTime and ulTaskSwitchedInTime (#80)
Browse files Browse the repository at this point in the history
* SMP has multiple ulTotalRunTime and ulTaskSwitchedInTime
  • Loading branch information
chinglee-iot authored Apr 25, 2023
1 parent 37ebbd8 commit 87c9c23
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4539,9 +4539,9 @@ BaseType_t xTaskIncrementTick( void )
#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[ 0 ] );
#else
ulTotalRunTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE();
ulTotalRunTime[ 0 ] = portGET_RUN_TIME_COUNTER_VALUE();
#endif

/* Add the amount of time the task has been running to the
Expand All @@ -4551,16 +4551,16 @@ BaseType_t xTaskIncrementTick( void )
* 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[ 0 ] > ulTaskSwitchedInTime[ 0 ] )
{
pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime );
pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime[ 0 ] - ulTaskSwitchedInTime[ 0 ] );
}
else
{
mtCOVERAGE_TEST_MARKER();
}

ulTaskSwitchedInTime = ulTotalRunTime;
ulTaskSwitchedInTime[ 0 ] = ulTotalRunTime[ 0 ];
}
#endif /* configGENERATE_RUN_TIME_STATS */

Expand Down

0 comments on commit 87c9c23

Please sign in to comment.