\r
PRIVILEGED_DATA static char pcStatsString[ 50 ] ;\r
PRIVILEGED_DATA static unsigned long ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */\r
- static void prvGenerateRunTimeStatsForTasksInList( const signed char *pcWriteBuffer, xList *pxList, unsigned long ulTotalRunTime ) PRIVILEGED_FUNCTION;\r
+ PRIVILEGED_DATA static unsigned long ulTotalRunTime; /*< Holds the total amount of execution time as defined by the run time counter clock. */\r
+ static void prvGenerateRunTimeStatsForTasksInList( const signed char *pcWriteBuffer, xList *pxList, unsigned long ulTotalRunTimeDiv100 ) PRIVILEGED_FUNCTION;\r
\r
#endif\r
\r
void vTaskGetRunTimeStats( signed char *pcWriteBuffer )\r
{\r
unsigned portBASE_TYPE uxQueue;\r
- unsigned long ulTotalRunTime;\r
+ unsigned long ulTotalRunTimeDiv100;\r
\r
/* This is a VERY costly function that should be used for debug only.\r
It leaves interrupts disabled for a LONG time. */\r
\r
/* Divide ulTotalRunTime by 100 to make the percentage caluclations\r
simpler in the prvGenerateRunTimeStatsForTasksInList() function. */\r
- ulTotalRunTime /= 100UL;\r
+ ulTotalRunTimeDiv100 = ulTotalRunTime / 100UL;\r
\r
/* Run through all the lists that could potentially contain a TCB,\r
generating a table of run timer percentages in the provided\r
\r
if( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxQueue ] ) ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) &( pxReadyTasksLists[ uxQueue ] ), ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) &( pxReadyTasksLists[ uxQueue ] ), ulTotalRunTimeDiv100 );\r
}\r
}while( uxQueue > ( unsigned short ) tskIDLE_PRIORITY );\r
\r
if( listLIST_IS_EMPTY( pxDelayedTaskList ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) pxDelayedTaskList, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) pxDelayedTaskList, ulTotalRunTimeDiv100 );\r
}\r
\r
if( listLIST_IS_EMPTY( pxOverflowDelayedTaskList ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) pxOverflowDelayedTaskList, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) pxOverflowDelayedTaskList, ulTotalRunTimeDiv100 );\r
}\r
\r
#if ( INCLUDE_vTaskDelete == 1 )\r
{\r
if( listLIST_IS_EMPTY( &xTasksWaitingTermination ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xTasksWaitingTermination, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xTasksWaitingTermination, ulTotalRunTimeDiv100 );\r
}\r
}\r
#endif\r
{\r
if( listLIST_IS_EMPTY( &xSuspendedTaskList ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xSuspendedTaskList, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xSuspendedTaskList, ulTotalRunTimeDiv100 );\r
}\r
}\r
#endif\r
\r
#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
{\r
- unsigned long ulTempCounter;\r
-\r
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE\r
- portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );\r
+ portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );\r
#else\r
- ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();\r
+ ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();\r
#endif\r
\r
/* Add the amount of time the task has been running to the accumulated\r
ulTaskSwitchedInTime. Note that there is no overflow protection here\r
so count values are only valid until the timer overflows. Generally\r
this will be about 1 hour assuming a 1uS timer increment. */\r
- pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );\r
- ulTaskSwitchedInTime = ulTempCounter;\r
+ pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime );\r
+ ulTaskSwitchedInTime = ulTotalRunTime;\r
}\r
#endif\r
\r
\r
#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
\r
- static void prvGenerateRunTimeStatsForTasksInList( const signed char *pcWriteBuffer, xList *pxList, unsigned long ulTotalRunTime )\r
+ static void prvGenerateRunTimeStatsForTasksInList( const signed char *pcWriteBuffer, xList *pxList, unsigned long ulTotalRunTimeDiv100 )\r
{\r
volatile tskTCB *pxNextTCB, *pxFirstTCB;\r
unsigned long ulStatsAsPercentage;\r
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );\r
\r
/* Divide by zero check. */\r
- if( ulTotalRunTime > 0UL )\r
+ if( ulTotalRunTimeDiv100 > 0UL )\r
{\r
/* Has the task run at all? */\r
if( pxNextTCB->ulRunTimeCounter == 0UL )\r
{\r
/* What percentage of the total run time has the task used?\r
This will always be rounded down to the nearest integer.\r
- ulTotalRunTime has already been divided by 100. */\r
- ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime;\r
+ ulTotalRunTimeDiv100 has already been divided by 100. */\r
+ ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTimeDiv100;\r
\r
if( ulStatsAsPercentage > 0UL )\r
{\r