procfs: add heap info for every task

cat /proc/2/heap
AllocSize:  512
AllocBlks:  10

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2022-01-22 20:21:51 +08:00
committed by Xiang Xiao
parent 2dcc4a359d
commit 7ae3c572dc
6 changed files with 181 additions and 0 deletions
+12
View File
@@ -52,6 +52,15 @@ struct mallinfo
* by free (not in use) chunks. */
};
#ifdef CONFIG_DEBUG_MM
struct mallinfo_task
{
pid_t pid; /* The pid of task */
int aordblks; /* This is the number of allocated (in use) chunks for task */
int uordblks; /* This is the total size of memory occupied for task */
};
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -63,6 +72,9 @@ extern "C"
struct mallinfo mallinfo(void);
size_t malloc_size(FAR void *ptr);
#ifdef CONFIG_DEBUG_MM
struct mallinfo_task mallinfo_task(pid_t pid);
#endif
#if defined(__cplusplus)
}
+8
View File
@@ -296,11 +296,19 @@ void kmm_extend(FAR void *mem, size_t size, int region);
struct mallinfo; /* Forward reference */
int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info);
#ifdef CONFIG_DEBUG_MM
struct mallinfo_task; /* Forward reference */
int mm_mallinfo_task(FAR struct mm_heap_s *heap,
FAR struct mallinfo_task *info);
#endif
/* Functions contained in kmm_mallinfo.c ************************************/
#ifdef CONFIG_MM_KERNEL_HEAP
struct mallinfo kmm_mallinfo(void);
# ifdef CONFIG_DEBUG_MM
struct mallinfo_task kmm_mallinfo_task(pid_t pid);
# endif
#endif
/* Functions contained in mm_memdump.c **************************************/