From: richardbarry Date: Thu, 13 Jan 2011 19:04:57 +0000 (+0000) Subject: Make the generation of run time stats percentages more efficient. X-Git-Tag: V6.1.1~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e00fa23314377076a7736b2a5d457b4fbbd1ed32;p=freertos Make the generation of run time stats percentages more efficient. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1247 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/tasks.c b/Source/tasks.c index ab4bc9f38..a436a86eb 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -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 ) {