mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Make the generation of run time stats percentages more efficient.
This commit is contained in:
parent
411364dab6
commit
fb18eeb96c
|
@ -1295,6 +1295,10 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
|||
ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#endif
|
||||
|
||||
/* Divide ulTotalRunTime by 100 to make the percentage caluclations
|
||||
simpler in the prvGenerateRunTimeStatsForTasksInList() function. */
|
||||
ulTotalRunTime /= 100UL;
|
||||
|
||||
/* Run through all the lists that could potentially contain a TCB,
|
||||
generating a table of run timer percentages in the provided
|
||||
buffer. */
|
||||
|
@ -2125,9 +2129,10 @@ tskTCB *pxNewTCB;
|
|||
}
|
||||
else
|
||||
{
|
||||
/* What percentage of the total run time as the task used?
|
||||
This will always be rounded down to the nearest integer. */
|
||||
ulStatsAsPercentage = ( 100UL * pxNextTCB->ulRunTimeCounter ) / ulTotalRunTime;
|
||||
/* What percentage of the total run time has the task used?
|
||||
This will always be rounded down to the nearest integer.
|
||||
ulTotalRunTime has already been divided by 100. */
|
||||
ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime;
|
||||
|
||||
if( ulStatsAsPercentage > 0UL )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue