summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-29 16:15:00 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-29 16:15:00 +0000
commit51709d08eeb785927100614e09cc2f7e1331bb87 (patch)
treebc71dd12c39ba648e81343ab678187432944a5a6
parent850061ca09fa4555c7cac952c4455430c8f9dbd7 (diff)
downloadpx4-nuttx-51709d08eeb785927100614e09cc2f7e1331bb87.tar.gz
px4-nuttx-51709d08eeb785927100614e09cc2f7e1331bb87.tar.bz2
px4-nuttx-51709d08eeb785927100614e09cc2f7e1331bb87.zip
Add mem command to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@843 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/Documentation/NuttX.html3
-rw-r--r--nuttx/arch/sim/src/up_initialize.c1
-rw-r--r--nuttx/examples/README.txt1
-rw-r--r--nuttx/examples/nsh/nsh.h1
-rw-r--r--nuttx/examples/nsh/nsh_dbgcmds.c21
-rw-r--r--nuttx/examples/nsh/nsh_main.c1
7 files changed, 29 insertions, 2 deletions
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 &lt;spudmonkey@racsa.co.cr&gt;
* 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 &lt;spudmonkey@racsa.co.cr&gt;
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 <sys/types.h>
#include <nuttx/arch.h>
#include <nuttx/fs.h>
+#include <debug.h>
#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] <dir-path>" },
#endif
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
+ { "mem", cmd_mem, 1, 1, NULL },
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
#ifdef CONFIG_FS_FAT