]> git.sur5r.net Git - freertos/commitdiff
Make changes necessary to allow the latest StateViewer Eclipse plug-in obtain the...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 31 Dec 2012 11:09:14 +0000 (11:09 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 31 Dec 2012 11:09:14 +0000 (11:09 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1813 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/tasks.c

index 7bddc1ea5f91b43241c96c1b6e77d7306f23540a..56fc50507584e586d63f1e6b32414bc659a37b18 100644 (file)
@@ -191,7 +191,8 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime                           = ( portTic
 \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
@@ -1553,7 +1554,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
        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
@@ -1568,7 +1569,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
 \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
@@ -1585,25 +1586,25 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
 \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
@@ -1612,7 +1613,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
                        {\r
                                if( listLIST_IS_EMPTY( &xSuspendedTaskList ) == pdFALSE )\r
                                {\r
-                                       prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xSuspendedTaskList, ulTotalRunTime );\r
+                                       prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xSuspendedTaskList, ulTotalRunTimeDiv100 );\r
                                }\r
                        }\r
                        #endif\r
@@ -1830,12 +1831,10 @@ void vTaskSwitchContext( void )
 \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
@@ -1843,8 +1842,8 @@ void vTaskSwitchContext( void )
                                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
@@ -2459,7 +2458,7 @@ tskTCB *pxNewTCB;
 \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
@@ -2472,7 +2471,7 @@ tskTCB *pxNewTCB;
                        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
@@ -2484,8 +2483,8 @@ tskTCB *pxNewTCB;
                                {\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