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 B605DA00C2; Sun, 1 Jan 2023 05:35:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BC6040689; Sun, 1 Jan 2023 05:35:55 +0100 (CET) Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.220]) by mails.dpdk.org (Postfix) with ESMTP id 80F9840141 for ; Sun, 1 Jan 2023 05:35:53 +0100 (CET) HMM_SOURCE_IP: 172.18.0.218:49796.344041663 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-101.43.140.16 (unknown [172.18.0.218]) by chinatelecom.cn (HERMES) with SMTP id 929F2280090; Sun, 1 Jan 2023 12:35:49 +0800 (CST) X-189-SAVE-TO-SEND: wushaohua@chinatelecom.cn Received: from ([101.43.140.16]) by app0025 with ESMTP id 2be13c44213545c881fed05b17c5725a for dev@dpdk.org; Sun, 01 Jan 2023 12:35:51 CST X-Transaction-ID: 2be13c44213545c881fed05b17c5725a X-Real-From: wushaohua@chinatelecom.cn X-Receive-IP: 101.43.140.16 X-MEDUSA-Status: 0 Sender: wushaohua@chinatelecom.cn From: wushaohua@chinatelecom.cn To: dev@dpdk.org Cc: olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru Subject: [PATCH 1/2] mempool:Add monitor dump for memory pool Date: Sun, 1 Jan 2023 12:35:48 +0800 Message-Id: <20230101043548.1355909-1-wushaohua@chinatelecom.cn> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221231160738> References: <20221231160738> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 rte_mempool_dump add dump for monitoring available and used memory blocks Signed-off-by: wushaohua --- 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)); + fprintf(f, " common_pool_used_count=%u\n", + rte_mempool_in_use_count(mp)); /* sum and dump statistics */ #ifdef RTE_LIBRTE_MEMPOOL_STATS -- 2.30.2