Add mem command to NSH

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@843 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-08-29 16:15:00 +00:00
parent 4b57c3bad4
commit b0bbd8c7c2
7 changed files with 29 additions and 2 deletions

View File

@ -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

View File

@ -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>

View File

@ -41,6 +41,7 @@
#include <sys/types.h>
#include <nuttx/arch.h>
#include <nuttx/fs.h>
#include <debug.h>
#include "up_internal.h"
/****************************************************************************

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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