diff options
author | rtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2> | 2015-01-15 21:37:32 +0000 |
---|---|---|
committer | rtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2> | 2015-01-15 21:37:32 +0000 |
commit | df6c8a8a566e9d7e92357f006057441dd3191ed9 (patch) | |
tree | 3399c1e24915a03d2d827ba506e1775cefc95ce3 /FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos | |
parent | e6160c3bb352e48d1cc5b062fa5b87fb3c7cc84c (diff) | |
download | freertos-df6c8a8a566e9d7e92357f006057441dd3191ed9.tar.gz |
Demo app changes:
Add a "query heap" command to the standard sample CLI commands.
Remove casting from configMAX_PRIORITIES setting in Win32 simulator demos as it was preventing a clean build.
Source code changes.
General tidy up and addition of assert points.
git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2323 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos')
-rw-r--r-- | FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c index 074ad3c56..fafef1713 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c @@ -280,7 +280,8 @@ void vRegisterCLICommands( void ) static BaseType_t prvTaskStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
-const char *const pcHeader = "Task State Priority Stack #\r\n************************************************\r\n";
+const char *const pcHeader = " State\tPriority\tStack\t#\r\n************************************************\r\n";
+BaseType_t xSpacePadding;
/* Remove compile time warnings about unused parameters, and check the
write buffer is not NULL. NOTE - for simplicity, this example assumes the
@@ -290,6 +291,22 @@ const char *const pcHeader = "Task State Priority Stack #\r\n******** configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */
+ strcpy( pcWriteBuffer, "Task" );
+ pcWriteBuffer += strlen( pcWriteBuffer );
+
+ /* Pad the string "task" with however many bytes necessary to make it the
+ length of a task name. Minus three for the null terminator and half the
+ number of characters in "Task" so the column lines up with the centre of
+ the heading. */
+ for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
+ {
+ /* Add a space to align columns after the task's name. */
+ *pcWriteBuffer = ' ';
+ pcWriteBuffer++;
+
+ /* Ensure always terminated. */
+ *pcWriteBuffer = 0x00;
+ }
strcpy( pcWriteBuffer, pcHeader );
vTaskList( pcWriteBuffer + strlen( pcHeader ) );
@@ -301,7 +318,8 @@ const char *const pcHeader = "Task State Priority Stack #\r\n******** static BaseType_t prvRunTimeStatsCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString )
{
-const char * const pcHeader = "Task Abs Time % Time\r\n****************************************\r\n";
+const char * const pcHeader = " Abs Time % Time\r\n****************************************\r\n";
+BaseType_t xSpacePadding;
/* Remove compile time warnings about unused parameters, and check the
write buffer is not NULL. NOTE - for simplicity, this example assumes the
@@ -311,6 +329,23 @@ const char * const pcHeader = "Task Abs Time % Time\r\n********* configASSERT( pcWriteBuffer );
/* Generate a table of task stats. */
+ strcpy( pcWriteBuffer, "Task" );
+ pcWriteBuffer += strlen( pcWriteBuffer );
+
+ /* Pad the string "task" with however many bytes necessary to make it the
+ length of a task name. Minus three for the null terminator and half the
+ number of characters in "Task" so the column lines up with the centre of
+ the heading. */
+ for( xSpacePadding = strlen( "Task" ); xSpacePadding < ( configMAX_TASK_NAME_LEN - 3 ); xSpacePadding++ )
+ {
+ /* Add a space to align columns after the task's name. */
+ *pcWriteBuffer = ' ';
+ pcWriteBuffer++;
+
+ /* Ensure always terminated. */
+ *pcWriteBuffer = 0x00;
+ }
+
strcpy( pcWriteBuffer, pcHeader );
vTaskGetRunTimeStats( pcWriteBuffer + strlen( pcHeader ) );
|