diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ef687d659..82f3fdc09 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -423,6 +423,7 @@ * NSH: Add cd and pwd commands and current working directory to all NSH commands that refer to paths. * Fix errors and warnings introduced into Linux sim build because of recent - Cygwin-related changes + Cygwin-based sim changes + * NSH: Add mem command to display heap usage diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index f01dbd6e2..ade916957 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -1057,7 +1057,8 @@ nuttx-0.3.13 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * NSH: Add cd and pwd commands and current working directory to all NSH commands that refer to paths. * Fix errors and warnings introduced into Linux sim build because of recent - Cygwin-related changes + Cygwin-based sim changes + * NSH: Add mem command to display heap usage pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/arch/sim/src/up_initialize.c b/nuttx/arch/sim/src/up_initialize.c index fcfe9d24b..7eb49cb1f 100644 --- a/nuttx/arch/sim/src/up_initialize.c +++ b/nuttx/arch/sim/src/up_initialize.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "up_internal.h" /**************************************************************************** diff --git a/nuttx/examples/README.txt b/nuttx/examples/README.txt index 6012d2087..82055e397 100644 --- a/nuttx/examples/README.txt +++ b/nuttx/examples/README.txt @@ -47,6 +47,7 @@ examples/nsh ifconfig CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0 ls CONFIG_NFILE_DESCRIPTORS > 0 mb,mh,mw --- + mem --- mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT mkfifo !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index 7ee0d7192..0484f4f21 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -239,6 +239,7 @@ extern int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +extern int cmd_mem(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #if CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/nuttx/examples/nsh/nsh_dbgcmds.c b/nuttx/examples/nsh/nsh_dbgcmds.c index 5ae5d658e..7e6cc7294 100644 --- a/nuttx/examples/nsh/nsh_dbgcmds.c +++ b/nuttx/examples/nsh/nsh_dbgcmds.c @@ -277,3 +277,24 @@ int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } +/**************************************************************************** + * Name: cmd_mem + ****************************************************************************/ + +int cmd_mem(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + struct mallinfo mem; + +#ifdef CONFIG_CAN_PASS_STRUCTS + mem = mallinfo(); +#else + (void)mallinfo(&mem); +#endif + + nsh_output(vtbl, " arena: %8x\n", mem.arena); + nsh_output(vtbl, " ordblks: %8d\n", mem.ordblks); + nsh_output(vtbl, " mxordblk: %8x\n", mem.mxordblk); + nsh_output(vtbl, " uordblks: %8x\n", mem.uordblks); + nsh_output(vtbl, " fordblks: %8x\n", mem.fordblks); + return OK; +} \ No newline at end of file diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index cfa280eda..0d233016b 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -111,6 +111,7 @@ static const struct cmdmap_s g_cmdmap[] = { "ls", cmd_ls, 1, 5, "[-lRs] " }, #endif { "mb", cmd_mb, 2, 3, "[=][ ]" }, + { "mem", cmd_mem, 1, 1, NULL }, #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 { "mkdir", cmd_mkdir, 2, 2, "" }, #ifdef CONFIG_FS_FAT