mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
cmd/free: add nused field in command free
N/A Change-Id: I74aa4b1e7394a17c3b117322a4cc24aa52aac3b8 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -150,6 +150,7 @@ void host_mallinfo(struct host_mallinfo *info)
|
||||
tmp = mallinfo();
|
||||
info->arena = tmp.arena;
|
||||
info->ordblks = tmp.ordblks;
|
||||
info->aordblks = tmp.hblks;
|
||||
info->mxordblk = tmp.usmblks;
|
||||
info->uordblks = tmp.uordblks;
|
||||
info->fordblks = tmp.fordblks;
|
||||
|
||||
@@ -176,6 +176,7 @@ struct host_mallinfo
|
||||
int arena; /* This is the total size of memory allocated
|
||||
* for use by malloc in bytes. */
|
||||
int ordblks; /* This is the number of free (not in use) chunks */
|
||||
int aordblks; /* This is the number of allocated (in use) chunks */
|
||||
int mxordblk; /* Size of the largest free (not in use) chunk */
|
||||
int uordblks; /* This is the total size of memory occupied by
|
||||
* chunks handed out by malloc. */
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
* to handle the longest line generated by this logic.
|
||||
*/
|
||||
|
||||
#define MEMINFO_LINELEN 64
|
||||
#define MEMINFO_LINELEN 80
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@@ -74,6 +74,7 @@ struct progmem_info_s
|
||||
{
|
||||
int arena; /* Total size of available progmem. */
|
||||
int ordblks; /* This is the number of free chunks */
|
||||
int aordblks; /* This is the number of allocated chunks */
|
||||
int mxordblk; /* Size of the largest free chunk */
|
||||
int uordblks; /* Total size of memory for allocated chunks */
|
||||
int fordblks; /* Total size of memory for free chunks. */
|
||||
@@ -146,6 +147,7 @@ static void meminfo_progmem(FAR struct progmem_info_s *progmem)
|
||||
|
||||
progmem->arena = 0;
|
||||
progmem->ordblks = 0;
|
||||
progmem->aordblks = 0;
|
||||
progmem->fordblks = 0;
|
||||
progmem->uordblks = 0;
|
||||
progmem->mxordblk = 0;
|
||||
@@ -171,6 +173,7 @@ static void meminfo_progmem(FAR struct progmem_info_s *progmem)
|
||||
}
|
||||
else if (status != 0)
|
||||
{
|
||||
progmem->aordblks++;
|
||||
progmem->uordblks += pagesize;
|
||||
|
||||
if (stpage != 0xffff && up_progmem_isuniform())
|
||||
@@ -285,7 +288,7 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
linesize =
|
||||
procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
" total used free largest nfree\n");
|
||||
" total used free largest nused nfree\n");
|
||||
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
@@ -303,11 +306,12 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
mem = kmm_mallinfo();
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"Kmem: %11lu%11lu%11lu%11lu%7lu\n",
|
||||
"Kmem: %11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
(unsigned long)mem.arena,
|
||||
(unsigned long)mem.uordblks,
|
||||
(unsigned long)mem.fordblks,
|
||||
(unsigned long)mem.mxordblk,
|
||||
(unsigned long)mem.aordblks,
|
||||
(unsigned long)mem.ordblks);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
@@ -325,11 +329,12 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
mem = kumm_mallinfo();
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"Umem: %11lu%11lu%11lu%11lu%7lu\n",
|
||||
"Umem: %11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
(unsigned long)mem.arena,
|
||||
(unsigned long)mem.uordblks,
|
||||
(unsigned long)mem.fordblks,
|
||||
(unsigned long)mem.mxordblk,
|
||||
(unsigned long)mem.aordblks,
|
||||
(unsigned long)mem.ordblks);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
@@ -381,11 +386,12 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
meminfo_progmem(&progmem);
|
||||
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"Prog: %11lu%11lu%11lu%11lu%7lu\n",
|
||||
"Prog: %11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
(unsigned long)progmem.arena,
|
||||
(unsigned long)progmem.uordblks,
|
||||
(unsigned long)progmem.fordblks,
|
||||
(unsigned long)progmem.mxordblk,
|
||||
(unsigned long)progmem.aordblks,
|
||||
(unsigned long)progmem.ordblks);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
|
||||
@@ -40,6 +40,7 @@ struct mallinfo
|
||||
int arena; /* This is the total size of memory allocated
|
||||
* for use by malloc in bytes. */
|
||||
int ordblks; /* This is the number of free (not in use) chunks */
|
||||
int aordblks; /* This is the number of allocated (in use) chunks */
|
||||
int mxordblk; /* Size of the largest free (not in use) chunk */
|
||||
int uordblks; /* This is the total size of memory occupied by
|
||||
* chunks handed out by malloc. */
|
||||
|
||||
@@ -66,6 +66,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
||||
FAR struct mm_allocnode_s *prev;
|
||||
size_t mxordblk = 0;
|
||||
int ordblks = 0; /* Number of non-inuse chunks */
|
||||
int aordblks = 0; /* Number of inuse chunks */
|
||||
size_t uordblks = 0; /* Total allocated space */
|
||||
size_t fordblks = 0; /* Total non-inuse space */
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
@@ -107,6 +108,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
||||
if ((node->preceding & MM_ALLOC_BIT) != 0)
|
||||
{
|
||||
DEBUGASSERT(node->size >= SIZEOF_MM_ALLOCNODE);
|
||||
aordblks ++;
|
||||
uordblks += node->size;
|
||||
}
|
||||
else
|
||||
@@ -148,6 +150,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
|
||||
|
||||
info->arena = heap_impl->mm_heapsize;
|
||||
info->ordblks = ordblks;
|
||||
info->aordblks = aordblks;
|
||||
info->mxordblk = mxordblk;
|
||||
info->uordblks = uordblks;
|
||||
info->fordblks = fordblks;
|
||||
|
||||
Reference in New Issue
Block a user