mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
mm: Rename mm_memdump_s to malltask
align with the naming of mallinfo_task Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
c76f9f9349
commit
ddbe9eb6ab
@@ -55,8 +55,8 @@ struct mallinfo kmm_mallinfo(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct mallinfo_task kmm_mallinfo_task(FAR const struct mm_memdump_s *dump)
|
||||
struct mallinfo_task kmm_mallinfo_task(FAR const struct malltask *task)
|
||||
{
|
||||
return mm_mallinfo_task(g_kmmheap, dump);
|
||||
return mm_mallinfo_task(g_kmmheap, task);
|
||||
}
|
||||
#endif /* CONFIG_MM_KERNEL_HEAP */
|
||||
|
||||
@@ -393,7 +393,7 @@ int mempool_info(FAR struct mempool_s *pool, FAR struct mempoolinfo_s *info)
|
||||
|
||||
struct mallinfo_task
|
||||
mempool_info_task(FAR struct mempool_s *pool,
|
||||
FAR const struct mm_memdump_s *dump)
|
||||
FAR const struct malltask *task)
|
||||
{
|
||||
irqstate_t flags = spin_lock_irqsave(&pool->lock);
|
||||
struct mallinfo_task info =
|
||||
@@ -401,7 +401,7 @@ mempool_info_task(FAR struct mempool_s *pool,
|
||||
0, 0
|
||||
};
|
||||
|
||||
if (dump->pid == MM_BACKTRACE_FREE_PID)
|
||||
if (task->pid == MM_BACKTRACE_FREE_PID)
|
||||
{
|
||||
size_t count = mempool_queue_lenth(&pool->queue) +
|
||||
mempool_queue_lenth(&pool->iqueue);
|
||||
@@ -410,7 +410,7 @@ mempool_info_task(FAR struct mempool_s *pool,
|
||||
info.uordblks += count * pool->blocksize;
|
||||
}
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
else if (dump->pid == MM_BACKTRACE_ALLOC_PID)
|
||||
else if (task->pid == MM_BACKTRACE_ALLOC_PID)
|
||||
{
|
||||
size_t count = pool->nalloc;
|
||||
|
||||
@@ -425,11 +425,11 @@ mempool_info_task(FAR struct mempool_s *pool,
|
||||
list_for_every_entry(&pool->alist, buf, struct mempool_backtrace_s,
|
||||
node)
|
||||
{
|
||||
if (dump->pid == buf->pid || dump->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
(dump->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
if (task->pid == buf->pid || task->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
(task->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
nxsched_get_tcb(buf->pid) == NULL))
|
||||
{
|
||||
if (buf->seqno >= dump->seqmin && buf->seqno <= dump->seqmax)
|
||||
if (buf->seqno >= task->seqmin && buf->seqno <= task->seqmax)
|
||||
{
|
||||
info.aordblks++;
|
||||
info.uordblks += pool->blocksize;
|
||||
|
||||
@@ -768,7 +768,7 @@ mempool_multiple_mallinfo(FAR struct mempool_multiple_s *mpool)
|
||||
|
||||
struct mallinfo_task
|
||||
mempool_multiple_info_task(FAR struct mempool_multiple_s *mpool,
|
||||
FAR const struct mm_memdump_s *dump)
|
||||
FAR const struct malltask *task)
|
||||
{
|
||||
int i;
|
||||
struct mallinfo_task info;
|
||||
@@ -779,7 +779,7 @@ mempool_multiple_info_task(FAR struct mempool_multiple_s *mpool,
|
||||
|
||||
for (i = 0; i < mpool->npools; i++)
|
||||
{
|
||||
info = mempool_info_task(mpool->pools + i, dump);
|
||||
info = mempool_info_task(mpool->pools + i, task);
|
||||
ret.aordblks += info.aordblks;
|
||||
ret.uordblks += info.uordblks;
|
||||
}
|
||||
|
||||
+11
-12
@@ -37,7 +37,7 @@
|
||||
|
||||
struct mm_mallinfo_handler_s
|
||||
{
|
||||
FAR const struct mm_memdump_s *dump;
|
||||
FAR const struct malltask *task;
|
||||
FAR struct mallinfo_task *info;
|
||||
};
|
||||
|
||||
@@ -96,19 +96,19 @@ static void mallinfo_task_handler(FAR struct mm_allocnode_s *node,
|
||||
{
|
||||
DEBUGASSERT(nodesize >= SIZEOF_MM_ALLOCNODE);
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
if (handle->dump->pid == MM_BACKTRACE_ALLOC_PID)
|
||||
if (handle->task->pid == MM_BACKTRACE_ALLOC_PID)
|
||||
{
|
||||
handle->info->aordblks++;
|
||||
handle->info->uordblks += nodesize;
|
||||
}
|
||||
#else
|
||||
if (handle->dump->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
handle->dump->pid == node->pid ||
|
||||
(handle->dump->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
if (handle->task->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
handle->task->pid == node->pid ||
|
||||
(handle->task->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
nxsched_get_tcb(node->pid) == NULL))
|
||||
{
|
||||
if (node->seqno >= handle->dump->seqmin &&
|
||||
node->seqno <= handle->dump->seqmax)
|
||||
if (node->seqno >= handle->task->seqmin &&
|
||||
node->seqno <= handle->task->seqmax)
|
||||
{
|
||||
handle->info->aordblks++;
|
||||
handle->info->uordblks += nodesize;
|
||||
@@ -116,7 +116,7 @@ static void mallinfo_task_handler(FAR struct mm_allocnode_s *node,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (handle->dump->pid == MM_BACKTRACE_FREE_PID)
|
||||
else if (handle->task->pid == MM_BACKTRACE_FREE_PID)
|
||||
{
|
||||
handle->info->aordblks++;
|
||||
handle->info->uordblks += nodesize;
|
||||
@@ -170,7 +170,7 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
|
||||
****************************************************************************/
|
||||
|
||||
struct mallinfo_task mm_mallinfo_task(FAR struct mm_heap_s *heap,
|
||||
FAR const struct mm_memdump_s *dump)
|
||||
FAR const struct malltask *task)
|
||||
{
|
||||
struct mm_mallinfo_handler_s handle;
|
||||
struct mallinfo_task info =
|
||||
@@ -179,11 +179,10 @@ struct mallinfo_task mm_mallinfo_task(FAR struct mm_heap_s *heap,
|
||||
};
|
||||
|
||||
#if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
|
||||
|
||||
info = mempool_multiple_info_task(heap->mm_mpool, dump);
|
||||
info = mempool_multiple_info_task(heap->mm_mpool, task);
|
||||
#endif
|
||||
|
||||
handle.dump = dump;
|
||||
handle.task = task;
|
||||
handle.info = &info;
|
||||
mm_foreach(heap, mallinfo_task_handler, &handle);
|
||||
|
||||
|
||||
@@ -78,14 +78,14 @@ static void free_delaylist(FAR struct mm_heap_s *heap)
|
||||
void mm_dump_handler(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
{
|
||||
struct mallinfo_task info;
|
||||
struct mm_memdump_s dump;
|
||||
struct malltask task;
|
||||
|
||||
dump.pid = tcb ? tcb->pid : MM_BACKTRACE_INVALID_PID;
|
||||
dump.seqmin = 0;
|
||||
dump.seqmax = ULONG_MAX;
|
||||
info = mm_mallinfo_task(arg, &dump);
|
||||
task.pid = tcb ? tcb->pid : MM_BACKTRACE_INVALID_PID;
|
||||
task.seqmin = 0;
|
||||
task.seqmax = ULONG_MAX;
|
||||
info = mm_mallinfo_task(arg, &task);
|
||||
mwarn("pid:%5d, used:%10d, nused:%10d\n",
|
||||
dump.pid, info.uordblks, info.aordblks);
|
||||
task.pid, info.uordblks, info.aordblks);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+11
-11
@@ -122,7 +122,7 @@ struct memdump_backtrace_s
|
||||
|
||||
struct mm_mallinfo_handler_s
|
||||
{
|
||||
FAR const struct mm_memdump_s *dump;
|
||||
FAR const struct malltask *task;
|
||||
FAR struct mallinfo_task *info;
|
||||
};
|
||||
|
||||
@@ -292,19 +292,19 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
||||
if (used)
|
||||
{
|
||||
#if CONFIG_MM_BACKTRACE < 0
|
||||
if (handler->dump->pid = MM_BACKTRACE_ALLOC_PID)
|
||||
if (handler->task->pid = MM_BACKTRACE_ALLOC_PID)
|
||||
{
|
||||
handler->info->aordblks++;
|
||||
handler->info->uordblks += size;
|
||||
}
|
||||
#else
|
||||
if (handler->dump->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
handler->dump->pid == buf->pid ||
|
||||
(handler->dump->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
if (handler->task->pid == MM_BACKTRACE_ALLOC_PID ||
|
||||
handler->task->pid == buf->pid ||
|
||||
(handler->task->pid == MM_BACKTRACE_INVALID_PID &&
|
||||
nxsched_get_tcb(buf->pid) == NULL))
|
||||
{
|
||||
if (buf->seqno >= handler->dump->seqmin &&
|
||||
buf->seqno <= handler->dump->seqmax)
|
||||
if (buf->seqno >= handler->task->seqmin &&
|
||||
buf->seqno <= handler->task->seqmax)
|
||||
{
|
||||
handler->info->aordblks++;
|
||||
handler->info->uordblks += size;
|
||||
@@ -312,7 +312,7 @@ static void mallinfo_task_handler(FAR void *ptr, size_t size, int used,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (handler->dump->pid == MM_BACKTRACE_FREE_PID)
|
||||
else if (handler->task->pid == MM_BACKTRACE_FREE_PID)
|
||||
{
|
||||
handler->info->aordblks++;
|
||||
handler->info->uordblks += size;
|
||||
@@ -905,7 +905,7 @@ struct mallinfo mm_mallinfo(FAR struct mm_heap_s *heap)
|
||||
}
|
||||
|
||||
struct mallinfo_task mm_mallinfo_task(FAR struct mm_heap_s *heap,
|
||||
FAR const struct mm_memdump_s *dump)
|
||||
FAR const struct malltask *task)
|
||||
{
|
||||
struct mm_mallinfo_handler_s handle;
|
||||
struct mallinfo_task info =
|
||||
@@ -920,10 +920,10 @@ struct mallinfo_task mm_mallinfo_task(FAR struct mm_heap_s *heap,
|
||||
#endif
|
||||
|
||||
#if CONFIG_MM_HEAP_MEMPOOL_THRESHOLD != 0
|
||||
info = mempool_multiple_info_task(heap->mm_mpool, dump);
|
||||
info = mempool_multiple_info_task(heap->mm_mpool, task);
|
||||
#endif
|
||||
|
||||
handle.dump = dump;
|
||||
handle.task = task;
|
||||
handle.info = &info;
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
for (region = 0; region < heap->mm_nregions; region++)
|
||||
|
||||
@@ -57,7 +57,7 @@ struct mallinfo mallinfo(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct mallinfo_task mallinfo_task(FAR const struct mm_memdump_s *dump)
|
||||
struct mallinfo_task mallinfo_task(FAR const struct malltask *task)
|
||||
{
|
||||
return mm_mallinfo_task(USR_HEAP, dump);
|
||||
return mm_mallinfo_task(USR_HEAP, task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user