DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: <wushaohua@chinatelecom.cn>, <dev@dpdk.org>
Cc: <olivier.matz@6wind.com>, <andrew.rybchenko@oktetlabs.ru>
Subject: RE: [PATCH] mempool:Add monitor dump for memory pool
Date: Sun, 1 Jan 2023 12:28:56 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87616@smartserver.smartshare.dk> (raw)
In-Reply-To: <20230101051803.1363757-1-wushaohua@chinatelecom.cn>

> From: wushaohua@chinatelecom.cn [mailto:wushaohua@chinatelecom.cn]
> Sent: Sunday, 1 January 2023 06.18
> 
> From: Shaohua Wu <wushaohua@chinatelecom.cn>
> 
> rte_mempool_dump add dump for monitoring available and
> used memory blocks
> 
> Signed-off-by: Shaohua Wu <wushaohua@chinatelecom.cn>
> ---
>  lib/mempool/rte_mempool.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index f33f455790..09d512a604 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -1265,9 +1265,14 @@ rte_mempool_dump(FILE *f, struct rte_mempool
> *mp)
> 
>  	cache_count = rte_mempool_dump_cache(f, mp);
>  	common_count = rte_mempool_ops_get_count(mp);
> +
>  	if ((cache_count + common_count) > mp->size)
>  		common_count = mp->size - cache_count;
>  	fprintf(f, "  common_pool_count=%u\n", common_count);
> +	fprintf(f, "  common_pool_avail_count=%u\n",
> +				rte_mempool_avail_count(mp));

The number of available objects in the common pool is already shown as "common_pool_count".

If you want to show the total number of available objects in both the common pool and the caches, you can calculate is as common_count + cache_count, instead of calling rte_mempool_avail_count(). And "total_count" would be a better name than "common_pool_avail_count".

> +	fprintf(f, "  common_pool_used_count=%u\n",
> +				rte_mempool_in_use_count(mp));

common_pool_used_count can be calculated as mp->size - common_count, instead of calling rte_mempool_in_use_count(mp).

> 
>  	/* sum and dump statistics */
>  #ifdef RTE_LIBRTE_MEMPOOL_STATS
> --
> 2.30.2
> 


  reply	other threads:[~2023-01-01 11:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-01  5:18 wushaohua
2023-01-01 11:28 ` Morten Brørup [this message]
2023-02-20 13:43   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35D87616@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=wushaohua@chinatelecom.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).