[PATCH] mempool: hide zero value items when dump cache
Konstantin Ananyev
konstantin.ananyev at huawei.com
Fri Sep 5 10:08:52 CEST 2025
> Hide zero value items when dump mempool cache.
>
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> ---
> lib/mempool/rte_mempool.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index 1021ede0c2..3042d94c14 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -1057,7 +1057,7 @@ rte_mempool_dump_cache(FILE *f, const struct
> rte_mempool *mp)
> unsigned count = 0;
> unsigned cache_count;
>
> - fprintf(f, " internal cache infos:\n");
> + fprintf(f, " internal cache infos (hide zero value items):\n");
> fprintf(f, " cache_size=%"PRIu32"\n", mp->cache_size);
>
> if (mp->cache_size == 0)
> @@ -1065,6 +1065,8 @@ rte_mempool_dump_cache(FILE *f, const struct
> rte_mempool *mp)
>
> for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
> cache_count = mp->local_cache[lcore_id].len;
> + if (cache_count == 0)
> + continue;
> fprintf(f, " cache_count[%u]=%"PRIu32"\n",
> lcore_id, cache_count);
> count += cache_count;
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
> 2.17.1
More information about the dev
mailing list