[dpdk-dev] [PATCH v6 7/9] app/procinfo: add support for debug ring

Vipin Varghese vipin.varghese at intel.com
Mon Dec 3 06:49:58 CET 2018


Function show_ring is used for displaying the RING of the
primary process.

Signed-off-by: Vipin Varghese <vipin.varghese at intel.com>
---

V3:
 - replace space to tab in printf - Reshma Pathan
 - change ring display information - Vipin Varghese
---
 app/proc-info/main.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 2aa448605..00b2d85f7 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1126,7 +1126,39 @@ show_crypto(void)
 static void
 show_ring(char *name)
 {
-	printf(" ring Name (%s)\n", name);
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
+		rte_get_tsc_hz());
+	STATS_BDR_STR(10, bdr_str);
+
+	if (name != NULL) {
+		struct rte_ring *ptr = rte_ring_lookup(name);
+		if (ptr != NULL) {
+			printf("  - Name (%s) on socket (%d)\n"
+				"  - flags:\n"
+				"\t  -- Single Producer Enqueue (%u)\n"
+				"\t  -- Single Consmer Dequeue (%u)\n",
+				ptr->name,
+				ptr->memzone->socket_id,
+				ptr->flags & RING_F_SP_ENQ,
+				ptr->flags & RING_F_SC_DEQ);
+			printf("  - size (%u) mask (0x%x) capacity (%u)\n",
+				ptr->size,
+				ptr->mask,
+				ptr->capacity);
+			printf("  - count (%u) free count (%u)\n",
+				rte_ring_count(ptr),
+				rte_ring_free_count(ptr));
+			printf("  - full (%d) empty (%d)\n",
+				rte_ring_full(ptr),
+				rte_ring_empty(ptr));
+
+			STATS_BDR_STR(50, "");
+			return;
+		}
+	}
+
+	rte_ring_list_dump(stdout);
+	STATS_BDR_STR(50, "");
 }
 
 static void
-- 
2.17.1



More information about the dev mailing list