]> git.sur5r.net Git - freertos/commitdiff
Add xTaskGetIdleRunTimeCounter() API function to return the run time stats counter...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 21 Jan 2019 23:39:48 +0000 (23:39 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 21 Jan 2019 23:39:48 +0000 (23:39 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2625 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c
FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml
FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo
FreeRTOS/Demo/WIN32-MingW/main_full.c
FreeRTOS/Source/include/mpu_prototypes.h
FreeRTOS/Source/include/mpu_wrappers.h
FreeRTOS/Source/include/task.h
FreeRTOS/Source/portable/Common/mpu_wrappers.c
FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/port.c
FreeRTOS/Source/portable/GCC/RISC-V-RV32/port.c

index 85705cfdbf8e56f68c3c17821b0999c9b32ebd5c..8721f4fd0dce7f8724d1ebd828808ca6c36cea37 100644 (file)
           <Type>0</Type>
           <LineNumber>614</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>23132</Address>
+          <Address>23164</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
 
   <Group>
     <GroupName>System</GroupName>
-    <tvExp>1</tvExp>
+    <tvExp>0</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
 
   <Group>
     <GroupName>application_and_config</GroupName>
-    <tvExp>1</tvExp>
+    <tvExp>0</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
 
   <Group>
     <GroupName>FreeRTOS_Source</GroupName>
-    <tvExp>1</tvExp>
+    <tvExp>0</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
index a1e4ac6d5f4df88101501d47aad45965dac9e2da..bc2ac8b23f47455a97f1dfe5241daf2d27cfe37a 100644 (file)
@@ -776,6 +776,9 @@ static void prvTaskToDelete( void *pvParameters )
        /* For code coverage test purposes it is deleted by the Idle task. */\r
        configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 );\r
        configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 );\r
+       /* Run time stats are not being gathered - this is just to exercise\r
+       API. */\r
+       configASSERT( xTaskGetIdleRunTimeCounter() == 0 ); \r
        vTaskSuspend( NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
index 7ac15d6a2aaa4626fc6cd31dc724fc9aa93547d2..8ae7de9840d751b273e7f9cffe7ef66c50afbea1 100644 (file)
@@ -5,7 +5,7 @@
                        <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>\r
                        <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>\r
                        <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
-                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1688908204914985791" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">\r
+                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-838616105515603833" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">\r
                                <language-scope id="org.eclipse.cdt.core.gcc"/>\r
                                <language-scope id="org.eclipse.cdt.core.g++"/>\r
                        </provider>\r
@@ -16,7 +16,7 @@
                        <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>\r
                        <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>\r
                        <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
-                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1692822637120195189" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">\r
+                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-834701673310394435" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">\r
                                <language-scope id="org.eclipse.cdt.core.gcc"/>\r
                                <language-scope id="org.eclipse.cdt.core.g++"/>\r
                        </provider>\r
index 976c93a877d32a153d063b6fe2e182e1dcb79c5a..7f5848df53f7fad54b9402d24e9b1955ffc3aab4 100644 (file)
Binary files a/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo and b/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo differ
index 3b27f908ec6784dada7a8758bbd63ab22497a1d6..abd9bf503904138c153d3d108517d9cde6caa412 100644 (file)
@@ -617,6 +617,8 @@ static portBASE_TYPE xPerformedOneShotTests = pdFALSE;
 TaskHandle_t xTestTask;\r
 TaskStatus_t xTaskInfo;\r
 extern StackType_t uxTimerTaskStack[];\r
+static TickType_t xLastIdleExecutionTime = 0;\r
+TickType_t xIdleExecutionTime;\r
 \r
        /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and\r
        xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
@@ -715,6 +717,13 @@ extern StackType_t uxTimerTaskStack[];
                        }\r
                }\r
        }\r
+\r
+       xIdleExecutionTime = xTaskGetIdleRunTimeCounter();\r
+       if( xIdleExecutionTime == xLastIdleExecutionTime )\r
+       {\r
+               pcStatusMessage = "Error: Total amount of Idle task execution time did not change";\r
+       }\r
+       xLastIdleExecutionTime = xIdleExecutionTime;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
index b4cc346124619873543bdeb24aa7a661eb53f6a4..a8fe655743570ee072768584fad2cbf71449f52e 100644 (file)
@@ -69,6 +69,7 @@ void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseTy
 BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );\r
 TaskHandle_t MPU_xTaskGetIdleTaskHandle( void );\r
 UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );\r
+TickType_t MPU_xTaskGetIdleRunTimeCounter( void );\r
 void MPU_vTaskList( char * pcWriteBuffer );\r
 void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer );\r
 BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue );\r
index 66e9a9fd125ca69f7f2fdfffdcf449a12a0628b2..220949c0cf905f520c258141f5dd7b9817d861dd 100644 (file)
@@ -77,6 +77,7 @@ only for ports that are using the MPU. */
                #define uxTaskGetSystemState                                    MPU_uxTaskGetSystemState\r
                #define vTaskList                                                               MPU_vTaskList\r
                #define vTaskGetRunTimeStats                                    MPU_vTaskGetRunTimeStats\r
+               #define xTaskGetIdleRunTimeCounter                              MPU_xTaskGetIdleRunTimeCounter\r
                #define xTaskGenericNotify                                              MPU_xTaskGenericNotify\r
                #define xTaskNotifyWait                                                 MPU_xTaskNotifyWait\r
                #define ulTaskNotifyTake                                                MPU_ulTaskNotifyTake\r
index b9c605b54fc6a31762a670ebb095fbbaa67c2004..43fcbee98bd73bf221e7f34b0d818e0fa4ee538a 100644 (file)
@@ -1728,6 +1728,36 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unquali
  */\r
 void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 \r
+/**\r
+* task. h\r
+* <PRE>TickType_t xTaskGetIdleRunTimeCounter( void );</PRE>\r
+*\r
+* configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS\r
+* must both be defined as 1 for this function to be available.  The application\r
+* must also then provide definitions for\r
+* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE()\r
+* to configure a peripheral timer/counter and return the timers current count\r
+* value respectively.  The counter should be at least 10 times the frequency of\r
+* the tick count.\r
+*\r
+* Setting configGENERATE_RUN_TIME_STATS to 1 will result in a total\r
+* accumulated execution time being stored for each task.  The resolution\r
+* of the accumulated time value depends on the frequency of the timer\r
+* configured by the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro.\r
+* While uxTaskGetSystemState() and vTaskGetRunTimeStats() writes the total\r
+* execution time of each task into a buffer, xTaskGetIdleRunTimeCounter()\r
+* returns the total execution time of just the idle task.\r
+*\r
+* @return The total run time of the idle task.  This is the amount of time the\r
+* idle task has actually been executing.  The unit of time is dependent on the\r
+* frequency configured using the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and\r
+* portGET_RUN_TIME_COUNTER_VALUE() macros.\r
+*\r
+* \defgroup xTaskGetIdleRunTimeCounter xTaskGetIdleRunTimeCounter\r
+* \ingroup TaskUtils\r
+*/\r
+TickType_t xTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION;\r
+\r
 /**\r
  * task. h\r
  * <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>\r
@@ -2346,7 +2376,7 @@ void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) PRIVIL
 void vTaskStepTick( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
- * Only avilable when configUSE_TICKLESS_IDLE is set to 1.\r
+ * Only available when configUSE_TICKLESS_IDLE is set to 1.\r
  * Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port\r
  * specific sleep function to determine if it is ok to proceed with the sleep,\r
  * and if it is ok to proceed, if it is ok to sleep indefinitely.\r
@@ -2367,10 +2397,6 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;
  */\r
 TaskHandle_t pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;\r
 \r
-#if( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )\r
-       TickType_t xTaskGetIdleRunTimeCounter( void );\r
-#endif\r
-\r
 /*\r
  * For internal use only.  Same as vTaskSetTimeOutState(), but without a critial\r
  * section.\r
index 0cb79c4c7246a7e21baf984f85b7c0bdc7aadcfe..d5aa0e930f88b9fad90c78dfb5b98d8f6b3633ef 100644 (file)
@@ -333,6 +333,19 @@ BaseType_t xRunningPrivileged = xPortRaisePrivilege();
 #endif\r
 /*-----------------------------------------------------------*/\r
 \r
+#if( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )\r
+       TickType_t MPU_xTaskGetIdleRunTimeCounter( void )\r
+       {\r
+       TickType_t xReturn;\r
+       BaseType_t xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+               xReturn = xTaskGetIdleRunTimeCounter();\r
+               vPortResetPrivilege( xRunningPrivileged );\r
+               return xReturn;\r
+       }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
 #if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
        void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxTagValue )\r
        {\r
index 8f7eee5550424e4b2158241e22f1d0e35d6e233a..6f61eee15e8b67a37d0a2eff1540c6a2fb142ea8 100644 (file)
@@ -573,7 +573,7 @@ extern uint32_t __privileged_data_end__[];
                                                                                ( prvGetMPURegionSizeSetting( ( uint32_t ) __FLASH_segment_end__ - ( uint32_t ) __FLASH_segment_start__ ) ) |\r
                                                                                ( portMPU_REGION_ENABLE );\r
 \r
-               /* Setup the first 16K for privileged only access (even though less\r
+               /* Setup the first nK for privileged only access (even though less\r
                than 10K is actually being used).  This is where the kernel code is\r
                placed. */\r
                portMPU_REGION_BASE_ADDRESS_REG =       ( ( uint32_t ) __FLASH_segment_start__ ) | /* Base address. */\r
index a8b49289875f7daf26a1953f717ff601572729cf..8793ee6fc54ad723b498d7137ddc1e2041f6513e 100644 (file)
 #include "task.h"\r
 #include "portmacro.h"\r
 \r
+#ifndef configCLINT_BASE_ADDRESS\r
+       #warning configCLINT_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a Core Local Interrupter (CLINT) then set configCLINT_BASE_ADDRESS to the CLINT's base address.  Otherwise set configCLINT_BASE_ADDRESS to 0.\r
+#endif\r
+\r
 /* Let the user override the pre-loading of the initial LR with the address of\r
 prvTaskExitError() in case it messes up unwinding of the stack in the\r
 debugger. */\r