]> git.sur5r.net Git - freertos/commitdiff
Modify vTaskGetRunTimeStats() to ensure the current run time total is obtained from...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 23 Dec 2010 10:40:13 +0000 (10:40 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 23 Dec 2010 10:40:13 +0000 (10:40 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1181 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/tasks.c

index 3274cbcc752e5094f51b788f032a567794b43f67..7fa375d0f3c8e91e6b11ca2860e72b5289c2afa3 100644 (file)
@@ -1282,8 +1282,17 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
        void vTaskGetRunTimeStats( signed char *pcWriteBuffer )\r
        {\r
        unsigned portBASE_TYPE uxQueue;\r
-       unsigned long ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();\r
+       unsigned long ulTotalRunTime;\r
 \r
+               /* A critical section is used because portGET_RUN_TIME_COUNTER_VALUE()\r
+               is implemented differently on different ports, so its not known if a\r
+               critical section is needed or not. */\r
+               taskENTER_CRITICAL();\r
+               {\r
+                       ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();\r
+               }\r
+               taskEXIT_CRITICAL();\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