mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
fs/procfs: layout the output of meminfo correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ic30e70772e19a43e2ad3b298e3ba1ac77f2f2219
This commit is contained in:
@@ -287,9 +287,9 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
/* The first line is the headers */
|
||||
|
||||
linesize =
|
||||
procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
" total used free largest nused nfree\n");
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"%13s%11s%11s%11s%11s%7s%7s\n", "", "total",
|
||||
"used", "free", "largest", "nused", "nfree");
|
||||
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
@@ -311,15 +311,15 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
/* Show heap information */
|
||||
|
||||
entry->mallinfo(entry->user_data, &minfo);
|
||||
linesize = snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"%12s: %11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
entry->name,
|
||||
(unsigned long)minfo.arena,
|
||||
(unsigned long)minfo.uordblks,
|
||||
(unsigned long)minfo.fordblks,
|
||||
(unsigned long)minfo.mxordblk,
|
||||
(unsigned long)minfo.aordblks,
|
||||
(unsigned long)minfo.ordblks);
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
entry->name,
|
||||
(unsigned long)minfo.arena,
|
||||
(unsigned long)minfo.uordblks,
|
||||
(unsigned long)minfo.fordblks,
|
||||
(unsigned long)minfo.mxordblk,
|
||||
(unsigned long)minfo.aordblks,
|
||||
(unsigned long)minfo.ordblks);
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer,
|
||||
buflen, &offset);
|
||||
totalsize += copysize;
|
||||
@@ -348,8 +348,8 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer,
|
||||
max = (unsigned long)pginfo.mxfree << MM_PGSHIFT;
|
||||
|
||||
linesize = procfs_snprintf(procfile->line, MEMINFO_LINELEN,
|
||||
"Page: %11lu%11lu%11lu%11lu\n",
|
||||
total, allocated, available, max);
|
||||
"%12s:%11lu%11lu%11lu%11lu\n",
|
||||
"Page", total, allocated, available, max);
|
||||
|
||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, buflen,
|
||||
&offset);
|
||||
@@ -370,7 +370,8 @@ 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%7lu\n",
|
||||
"%12s:%11lu%11lu%11lu%11lu%7lu%7lu\n",
|
||||
"Prog",
|
||||
(unsigned long)progmem.arena,
|
||||
(unsigned long)progmem.uordblks,
|
||||
(unsigned long)progmem.fordblks,
|
||||
|
||||
Reference in New Issue
Block a user