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:
parent
4b57c3bad4
commit
b0bbd8c7c2
@ -423,6 +423,7 @@
|
|||||||
* NSH: Add cd and pwd commands and current working directory to all NSH
|
* NSH: Add cd and pwd commands and current working directory to all NSH
|
||||||
commands that refer to paths.
|
commands that refer to paths.
|
||||||
* Fix errors and warnings introduced into Linux sim build because of recent
|
* 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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
* NSH: Add cd and pwd commands and current working directory to all NSH
|
||||||
commands that refer to paths.
|
commands that refer to paths.
|
||||||
* Fix errors and warnings introduced into Linux sim build because of recent
|
* 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>
|
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/fs.h>
|
#include <nuttx/fs.h>
|
||||||
|
#include <debug.h>
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -47,6 +47,7 @@ examples/nsh
|
|||||||
ifconfig CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0
|
ifconfig CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
ls CONFIG_NFILE_DESCRIPTORS > 0
|
ls CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
mb,mh,mw ---
|
mb,mh,mw ---
|
||||||
|
mem ---
|
||||||
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
|
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
|
||||||
mkfifo !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
mkfifo !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
|
@ -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_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_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_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);
|
extern int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
|
|
||||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
|
@ -277,3 +277,24 @@ int cmd_mw(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
return ret;
|
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;
|
||||||
|
}
|
@ -111,6 +111,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||||||
{ "ls", cmd_ls, 1, 5, "[-lRs] <dir-path>" },
|
{ "ls", cmd_ls, 1, 5, "[-lRs] <dir-path>" },
|
||||||
#endif
|
#endif
|
||||||
{ "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
|
{ "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
|
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||||
#ifdef CONFIG_FS_FAT
|
#ifdef CONFIG_FS_FAT
|
||||||
|
Loading…
Reference in New Issue
Block a user