Support memdump to realize incremental dump function

Add a new field to record the global on the basis of mm_backtrace.
When using alloc, the field is incremented by 1,
so that the memory usage can be dumped within the range
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2023-05-05 16:52:30 +08:00
committed by Xiang Xiao
parent 97e652aed1
commit c60dd72a2a
17 changed files with 296 additions and 152 deletions
+18 -2
View File
@@ -52,13 +52,29 @@ struct mallinfo
* by free (not in use) chunks. */
};
struct mm_memdump_s
{
pid_t pid; /* Process id */
#if CONFIG_MM_BACKTRACE >= 0
unsigned long seqmin; /* The minimum sequence */
unsigned long seqmax; /* The maximum sequence */
#endif
};
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 */
};
/****************************************************************************
* Public data
****************************************************************************/
#if CONFIG_MM_BACKTRACE >= 0
extern unsigned long g_mm_seqno;
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -70,7 +86,7 @@ extern "C"
struct mallinfo mallinfo(void);
size_t malloc_size(FAR void *ptr);
struct mallinfo_task mallinfo_task(pid_t pid);
struct mallinfo_task mallinfo_task(FAR const struct mm_memdump_s *dump);
#if defined(__cplusplus)
}