Fix API for NULL task parameter (#741)

* Fix API for NULL task parameter

* Fix uncrustify

---------

Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
pull/739/head
kar-rahul-aws 2 years ago committed by GitHub
parent 4689d8ff86
commit 05d93e0990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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();
@ -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
{

Loading…
Cancel
Save