From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5D81A00C2; Sun, 1 Jan 2023 12:29:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D70B40693; Sun, 1 Jan 2023 12:29:01 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id D428C40689 for ; Sun, 1 Jan 2023 12:28:58 +0100 (CET) Content-class: urn:content-classes:message Subject: RE: [PATCH] mempool:Add monitor dump for memory pool MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Sun, 1 Jan 2023 12:28:56 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87616@smartserver.smartshare.dk> X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: <20230101051803.1363757-1-wushaohua@chinatelecom.cn> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] mempool:Add monitor dump for memory pool Thread-Index: AdkdoHWZ8Vjq50N+RX+3Y+de2JG+ywAMM5UA References: <20230101051803.1363757-1-wushaohua@chinatelecom.cn> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: , Cc: , X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: wushaohua@chinatelecom.cn [mailto:wushaohua@chinatelecom.cn] > Sent: Sunday, 1 January 2023 06.18 >=20 > From: Shaohua Wu >=20 > rte_mempool_dump add dump for monitoring available and > used memory blocks >=20 > Signed-off-by: Shaohua Wu > --- > lib/mempool/rte_mempool.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > 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) >=20 > cache_count =3D rte_mempool_dump_cache(f, mp); > common_count =3D rte_mempool_ops_get_count(mp); > + > if ((cache_count + common_count) > mp->size) > common_count =3D mp->size - cache_count; > fprintf(f, " common_pool_count=3D%u\n", common_count); > + fprintf(f, " common_pool_avail_count=3D%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=3D%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). >=20 > /* sum and dump statistics */ > #ifdef RTE_LIBRTE_MEMPOOL_STATS > -- > 2.30.2 >=20