From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 914365F19 for ; Wed, 24 Oct 2018 08:52:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 23:52:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,419,1534834800"; d="scan'208";a="80469137" Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by fmsmga007.fm.intel.com with ESMTP; 23 Oct 2018 23:52:10 -0700 From: Vipin Varghese To: dev@dpdk.org, stephen@networkplumber.org, maryam.tahhan@intel.com, reshma.pattan@intel.com Cc: amol.patel@intel.com, sivaprasad.tummala@intel.com, stephen1.byrne@intel.com, michael.j.glynn@intel.com, Vipin Varghese Date: Wed, 24 Oct 2018 12:18:04 +0530 Message-Id: <20181024064805.23197-8-vipin.varghese@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181024064805.23197-1-vipin.varghese@intel.com> References: <20181023135751.21536-1-vipin.varghese@intel.com> <20181024064805.23197-1-vipin.varghese@intel.com> Subject: [dpdk-dev] [PATCH v2 8/9] app/procinfo: add code for debug mempool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2018 06:52:14 -0000 Function debug_mempool is used for displaying the MEMPOOL of the primary process. For valid mempool name elements are iterated for max of 256 bytes. Signed-off-by: Vipin Varghese --- app/proc-info/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index a4cf9f2ad..0668dac1c 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -33,6 +33,7 @@ #include #include #include +#include /* Maximum long option length for option parsing. */ #define MAX_LONG_OPT_SZ 64 @@ -1103,10 +1104,54 @@ debug_ring(char *name) STATS_BDR_STR(50, ""); } +static void +mempool_itr_obj(struct rte_mempool *mp, + void *opaque, void *obj, + unsigned int obj_idx) +{ + printf(" - name %s, obj_idx %u opaque %p obj %p\n", + mp->name, obj_idx, opaque, obj); + + if (obj) + rte_hexdump(stdout, " Mempool Obj Content", + obj, (mp->elt_size > 256)?256:mp->elt_size); +} + static void debug_mempool(char *name) { - printf(" mempools Name (%s)", name); + snprintf(bdr_str, 100, "debug - MEMPOOL %"PRIu64, rte_get_tsc_hz()); + STATS_BDR_STR(10, bdr_str); + + if (name != NULL) { + struct rte_mempool *ptr = rte_mempool_lookup(name); + if (ptr != NULL) { + printf(" - Name: %s on socket %d flags %u\n", + ptr->name, ptr->socket_id, ptr->flags); + printf(" - Size %u Cache %u element %u" + " header %u trailer %u " + " private data size %u\n", + ptr->size, + ptr->cache_size, + ptr->elt_size, + ptr->header_size, + ptr->trailer_size, + ptr->private_data_size); + printf(" - memezone - socket %d\n", + ptr->mz->socket_id); + + /* iterate each object */ + int ret = rte_mempool_obj_iter(ptr, + mempool_itr_obj, NULL); + printf(" - iterated %u objects\n", ret); + + STATS_BDR_STR(50, ""); + return; + } + } + + rte_mempool_list_dump(stdout); + STATS_BDR_STR(50, ""); } int -- 2.17.1