From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vipin Varghese Subject: [PATCH v2 8/9] app/procinfo: add code for debug mempool Date: Wed, 24 Oct 2018 12:18:04 +0530 Message-ID: <20181024064805.23197-8-vipin.varghese@intel.com> References: <20181023135751.21536-1-vipin.varghese@intel.com> <20181024064805.23197-1-vipin.varghese@intel.com> Cc: amol.patel@intel.com, sivaprasad.tummala@intel.com, stephen1.byrne@intel.com, michael.j.glynn@intel.com, Vipin Varghese To: dev@dpdk.org, stephen@networkplumber.org, maryam.tahhan@intel.com, reshma.pattan@intel.com 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) In-Reply-To: <20181024064805.23197-1-vipin.varghese@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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