mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
mm/tlfs: Count the backtrace overhead in mm_mallinfo_task
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
313f79d55e
commit
590e968c5f
1 changed files with 6 additions and 14 deletions
|
@ -280,17 +280,10 @@ static void mallinfo_handler(FAR void *ptr, size_t size, int used,
|
|||
static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
||||
FAR void *user)
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
FAR struct memdump_backtrace_s *buf;
|
||||
#endif
|
||||
FAR struct mm_mallinfo_handler_s *handler = user;
|
||||
FAR const struct malltask *task = handler->task;
|
||||
FAR struct mallinfo_task *info = handler->info;
|
||||
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
size -= sizeof(struct memdump_backtrace_s);
|
||||
buf = ptr + size;
|
||||
|
||||
if (used)
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
|
@ -300,6 +293,9 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
|||
info->uordblks += size;
|
||||
}
|
||||
#else
|
||||
FAR struct memdump_backtrace_s *buf =
|
||||
ptr + size - sizeof(struct memdump_backtrace_s);
|
||||
|
||||
if ((task->pid == PID_MM_ALLOC || task->pid == buf->pid ||
|
||||
(task->pid == PID_MM_LEAK && !!nxsched_get_tcb(buf->pid))) &&
|
||||
buf->seqno >= task->seqmin && buf->seqno <= task->seqmax)
|
||||
|
@ -314,7 +310,6 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
|||
info->aordblks++;
|
||||
info->uordblks += size;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -404,18 +399,15 @@ static void memdump_handler(FAR void *ptr, size_t size, int used,
|
|||
FAR void *user)
|
||||
{
|
||||
FAR const struct mm_memdump_s *dump = user;
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
FAR struct memdump_backtrace_s *buf;
|
||||
|
||||
size -= sizeof(struct memdump_backtrace_s);
|
||||
buf = ptr + size;
|
||||
#endif
|
||||
|
||||
if (used)
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
if (dump->pid == PID_MM_ALLOC)
|
||||
#else
|
||||
FAR struct memdump_backtrace_s *buf =
|
||||
ptr + size - sizeof(struct memdump_backtrace_s);
|
||||
|
||||
if ((dump->pid == PID_MM_ALLOC || dump->pid == buf->pid) &&
|
||||
buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue