On 16/05/2024 09:59, Morten Brørup wrote:
> Added information about the memory chunks holding the objects in the
> mempool when dumping the status of the mempool to a file.
> 
> Signed-off-by: Morten Brørup <m...@smartsharesystems.com>
> ---
>  lib/mempool/rte_mempool.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index 12390a2c81..e9a8a5b411 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -1230,6 +1230,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>  #endif
>       struct rte_mempool_memhdr *memhdr;
>       struct rte_mempool_ops *ops;
> +     unsigned int n;
>       unsigned common_count;
>       unsigned cache_count;
>       size_t mem_len = 0;
> @@ -1264,6 +1265,15 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)
>                       (long double)mem_len / mp->size);
>       }
>  
> +     fprintf(f, "  mem_list:\n");
> +     n = 0;
> +     STAILQ_FOREACH(memhdr, &mp->mem_list, next) {
> +             fprintf(f, "    addr[%u]=%p\n", n, memhdr->addr);
> +             fprintf(f, "    iova[%u]=0x%" PRIx64 "\n", n, memhdr->iova);
> +             fprintf(f, "    len[%u]=%zu\n", n, memhdr->len);
> +             n++;
> +     }
> +
>       cache_count = rte_mempool_dump_cache(f, mp);
>       common_count = rte_mempool_ops_get_count(mp);
>       if ((cache_count + common_count) > mp->size)

It's useful information to dump. Maybe consider adding something akin to
RTE_LIBRTE_MEMPOOL_STATS to gate this in case the prints are
overwhelming due to high list element number.

Reviewed-by: Paul Szczepanek <paul.szczepa...@arm.com>

Reply via email to