Fix getting stats on the current running task running time via vTaskGetInfo. This is especially important if the current task is stuck

This commit is contained in:
Ehud Machluf 2024-09-09 11:27:55 +03:00
parent 93e8199078
commit 7d8ab35485

10
tasks.c
View file

@ -6171,6 +6171,16 @@ static void prvCheckTasksWaitingTermination( void )
#if ( configGENERATE_RUN_TIME_STATS == 1 )
{
pxTaskStatus->ulRunTimeCounter = pxTCB->ulRunTimeCounter;
if( pxTCB == pxCurrentTCB )
{
uint32_t ulCurrentTotalRunTime;
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
portALT_GET_RUN_TIME_COUNTER_VALUE( ulCurrentTotalRunTime );
#else
ulCurrentTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
#endif
pxTaskStatus->ulRunTimeCounter += ( ulCurrentTotalRunTime - ulTaskSwitchedInTime );
}
}
#else
{