mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
mempool:Calibration total memory statistics
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -154,6 +154,8 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
|
||||
sq_init(&pool->queue);
|
||||
sq_init(&pool->iqueue);
|
||||
sq_init(&pool->equeue);
|
||||
pool->nexpend = 0;
|
||||
pool->totalsize = 0;
|
||||
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
list_initialize(&pool->alist);
|
||||
@@ -173,6 +175,8 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pool->nexpend++;
|
||||
pool->totalsize += size;
|
||||
mempool_add_queue(&pool->iqueue, pool->ibase, ninterrupt, blocksize);
|
||||
kasan_poison(pool->ibase, size);
|
||||
}
|
||||
@@ -194,6 +198,8 @@ int mempool_init(FAR struct mempool_s *pool, FAR const char *name)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pool->nexpend++;
|
||||
pool->totalsize += size;
|
||||
mempool_add_queue(&pool->queue, base, ninitial, blocksize);
|
||||
sq_addlast((FAR sq_entry_t *)(base + ninitial * blocksize),
|
||||
&pool->equeue);
|
||||
@@ -273,6 +279,8 @@ retry:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pool->nexpend++;
|
||||
pool->totalsize += size;
|
||||
kasan_poison(base, size);
|
||||
flags = spin_lock_irqsave(&pool->lock);
|
||||
mempool_add_queue(&pool->queue, base, nexpand, blocksize);
|
||||
@@ -425,6 +433,11 @@ int mempool_info_task(FAR struct mempool_s *pool,
|
||||
|
||||
info->aordblks += count;
|
||||
info->uordblks += count * pool->blocksize;
|
||||
if (pool->calibrate)
|
||||
{
|
||||
info->aordblks -= pool->nexpend;
|
||||
info->uordblks -= pool->totalsize;
|
||||
}
|
||||
}
|
||||
else if (info->pid == -1)
|
||||
{
|
||||
@@ -436,6 +449,8 @@ int mempool_info_task(FAR struct mempool_s *pool,
|
||||
|
||||
info->aordblks += count;
|
||||
info->uordblks += count * pool->blocksize;
|
||||
info->aordblks -= pool->nexpend;
|
||||
info->uordblks -= pool->totalsize;
|
||||
}
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user