From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2CF4D1B532 for ; Tue, 23 Oct 2018 16:01:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 07:01:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,416,1534834800"; d="scan'208";a="80934722" Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by fmsmga008.fm.intel.com with ESMTP; 23 Oct 2018 07:01:53 -0700 From: Vipin Varghese To: dev@dpdk.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: Tue, 23 Oct 2018 19:27:50 +0530 Message-Id: <20181023135751.21536-8-vipin.varghese@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181023135751.21536-1-vipin.varghese@intel.com> References: <20181023135751.21536-1-vipin.varghese@intel.com> Subject: [dpdk-dev] [PATCH v1 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: Tue, 23 Oct 2018 14:01:56 -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 f8b28d47f..764ef5731 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