@@ -460,8 +460,8 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
460
460
461
461
/* Do not move these variables to function scope as doing so prevents the
462
462
* code working with debuggers that need to remove the static qualifier. */
463
- PRIVILEGED_DATA static configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime [ configNUM_CORES ] = { 0UL }; /**< Holds the value of a timer/counter the last time a task was switched in. */
464
- PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime [ configNUM_CORES ] = { 0UL }; /**< Holds the total amount of execution time as defined by the run time counter clock. */
463
+ PRIVILEGED_DATA static configRUN_TIME_COUNTER_TYPE ulTaskSwitchedInTime [ configNUMBER_OF_CORES ] = { 0UL }; /**< Holds the value of a timer/counter the last time a task was switched in. */
464
+ PRIVILEGED_DATA static volatile configRUN_TIME_COUNTER_TYPE ulTotalRunTime [ configNUMBER_OF_CORES ] = { 0UL }; /**< Holds the total amount of execution time as defined by the run time counter clock. */
465
465
466
466
#endif
467
467
@@ -7388,40 +7388,27 @@ TickType_t uxTaskResetEventItemValue( void )
7388
7388
7389
7389
configRUN_TIME_COUNTER_TYPE ulTaskGetRunTimeCounter ( const TaskHandle_t xTask )
7390
7390
{
7391
- configRUN_TIME_COUNTER_TYPE ulReturn = 0 ;
7392
-
7393
- for ( BaseType_t i = 0 ; i < configNUMBER_OF_CORES ; i ++ )
7394
- {
7395
- ulReturn += xIdleTaskHandles [ i ]-> ulRunTimeCounter ;
7396
- }
7397
-
7398
- return ulReturn ;
7391
+ return xTask -> ulRunTimeCounter ;
7399
7392
}
7400
7393
7401
- #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
7394
+ #endif
7402
7395
/*-----------------------------------------------------------*/
7403
7396
7404
7397
#if ( configGENERATE_RUN_TIME_STATS == 1 )
7405
7398
7406
7399
configRUN_TIME_COUNTER_TYPE ulTaskGetRunTimePercent ( const TaskHandle_t xTask )
7407
7400
{
7408
7401
configRUN_TIME_COUNTER_TYPE ulTotalTime , ulReturn ;
7409
- configRUN_TIME_COUNTER_TYPE ulRunTimeCounter = 0 ;
7410
7402
7411
- ulTotalTime = ( configRUN_TIME_COUNTER_TYPE ) ( portGET_RUN_TIME_COUNTER_VALUE () * configNUMBER_OF_CORES );
7403
+ ulTotalTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE ();
7412
7404
7413
7405
/* For percentage calculations. */
7414
7406
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100 ;
7415
7407
7416
7408
/* Avoid divide by zero errors. */
7417
7409
if ( ulTotalTime > ( configRUN_TIME_COUNTER_TYPE ) 0 )
7418
7410
{
7419
- for ( BaseType_t i = 0 ; i < configNUMBER_OF_CORES ; i ++ )
7420
- {
7421
- ulRunTimeCounter += xIdleTaskHandles [ i ]-> ulRunTimeCounter ;
7422
- }
7423
-
7424
- ulReturn = ulRunTimeCounter / ulTotalTime ;
7411
+ ulReturn = xTask -> ulRunTimeCounter / ulTotalTime ;
7425
7412
}
7426
7413
else
7427
7414
{
@@ -7434,24 +7421,54 @@ TickType_t uxTaskResetEventItemValue( void )
7434
7421
#endif /* if ( configGENERATE_RUN_TIME_STATS == 1 ) */
7435
7422
/*-----------------------------------------------------------*/
7436
7423
7437
- #if ( configGENERATE_RUN_TIME_STATS == 1 )
7424
+ #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
7438
7425
7439
7426
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounter ( void )
7440
7427
{
7441
- return ulTaskGetRunTimeCounter ( xIdleTaskHandle );
7428
+ configRUN_TIME_COUNTER_TYPE ulReturn = 0 ;
7429
+
7430
+ for ( BaseType_t i = 0 ; i < configNUMBER_OF_CORES ; i ++ )
7431
+ {
7432
+ ulReturn += xIdleTaskHandles [ i ]-> ulRunTimeCounter ;
7433
+ }
7434
+
7435
+ return ulReturn ;
7442
7436
}
7443
7437
7444
- #endif
7438
+ #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
7445
7439
/*-----------------------------------------------------------*/
7446
7440
7447
- #if ( configGENERATE_RUN_TIME_STATS == 1 )
7441
+ #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
7448
7442
7449
7443
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimePercent ( void )
7450
7444
{
7451
- return ulTaskGetRunTimePercent ( xIdleTaskHandle );
7445
+ configRUN_TIME_COUNTER_TYPE ulTotalTime , ulReturn ;
7446
+ configRUN_TIME_COUNTER_TYPE ulRunTimeCounter = 0 ;
7447
+
7448
+ ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE () * configNUMBER_OF_CORES ;
7449
+
7450
+ /* For percentage calculations. */
7451
+ ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100 ;
7452
+
7453
+ /* Avoid divide by zero errors. */
7454
+ if ( ulTotalTime > ( configRUN_TIME_COUNTER_TYPE ) 0 )
7455
+ {
7456
+ for ( BaseType_t i = 0 ; i < configNUMBER_OF_CORES ; i ++ )
7457
+ {
7458
+ ulRunTimeCounter += xIdleTaskHandles [ i ]-> ulRunTimeCounter ;
7459
+ }
7460
+
7461
+ ulReturn = ulRunTimeCounter / ulTotalTime ;
7462
+ }
7463
+ else
7464
+ {
7465
+ ulReturn = 0 ;
7466
+ }
7467
+
7468
+ return ulReturn ;
7452
7469
}
7453
7470
7454
- #endif
7471
+ #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
7455
7472
/*-----------------------------------------------------------*/
7456
7473
7457
7474
static void prvAddCurrentTaskToDelayedList ( TickType_t xTicksToWait ,
0 commit comments