Skip to content

Commit

Permalink
Fix API for NULL task parameter (#741)
Browse files Browse the repository at this point in the history
* Fix API for NULL task parameter

* Fix uncrustify

---------

Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
  • Loading branch information
kar-rahul-aws and chinglee-iot authored Aug 7, 2023
1 parent 4689d8f commit 05d93e0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -7430,16 +7430,21 @@ TickType_t uxTaskResetEventItemValue( void )

configRUN_TIME_COUNTER_TYPE ulTaskGetRunTimeCounter( const TaskHandle_t xTask )
{
return xTask->ulRunTimeCounter;
TCB_t * pxTCB;

pxTCB = prvGetTCBFromHandle( xTask );

return pxTCB->ulRunTimeCounter;
}

#endif
#endif /* if ( configGENERATE_RUN_TIME_STATS == 1 ) */
/*-----------------------------------------------------------*/

#if ( configGENERATE_RUN_TIME_STATS == 1 )

configRUN_TIME_COUNTER_TYPE ulTaskGetRunTimePercent( const TaskHandle_t xTask )
{
TCB_t * pxTCB;
configRUN_TIME_COUNTER_TYPE ulTotalTime, ulReturn;

ulTotalTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE();
Expand All @@ -7450,7 +7455,8 @@ TickType_t uxTaskResetEventItemValue( void )
/* Avoid divide by zero errors. */
if( ulTotalTime > ( configRUN_TIME_COUNTER_TYPE ) 0 )
{
ulReturn = xTask->ulRunTimeCounter / ulTotalTime;
pxTCB = prvGetTCBFromHandle( xTask );
ulReturn = pxTCB->ulRunTimeCounter / ulTotalTime;
}
else
{
Expand Down

0 comments on commit 05d93e0

Please sign in to comment.