Janus Erasmus / Console

Dependents:   Nucleo_blink_led

Revision:
1:ffc6a669f391
Parent:
0:cda1bfa06c7c
Child:
2:4c8b24eb7ad5
diff -r cda1bfa06c7c -r ffc6a669f391 Console.cpp
--- a/Console.cpp	Sat Mar 17 11:13:55 2018 +0000
+++ b/Console.cpp	Sat Mar 17 14:05:07 2018 +0200
@@ -6,9 +6,10 @@
  */
 #include <ctype.h>
 
+#include "mbed_stats.h"
+
 #include "Console.h"
 
-
 void Console::help(int argc,char *argv[])
 {
    printf(GREEN("TermCMD commands:\n"));
@@ -45,18 +46,24 @@
 
 }
 
+void Console::dumpThreadInfo(int argc,char *argv[])
+{
+    mbed_stats_stack_t stacks[10];
+    int cnt = mbed_stats_stack_get_each(stacks, 10);
+    for(int k = 0; k < cnt; k++)
+    {
+        printf("%d - TH[%lu]: max: %lu, res: %lu\r\n", k, stacks[k].thread_id, stacks[k].max_size, stacks[k].reserved_size);
+    }
+}
+
 const Console::cmd_list_t shellCommands[] =
 {
-      {"SYSTEM"    ,0,0,0},
+      {"MBED OS"    ,0,0,0},
       {"h",       "",            "Show this help info", Console::help},
+      {"dt",       "",           "Dump Thread info", Console::dumpThreadInfo},
       {0,0,0}
 };
 
-Console::cmd_list_t *Console::mCmdTable[] =
-{
-        (cmd_list_t*)shellCommands,
-        0
-};
 
 Console *Console ::__instance = 0;