DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
	Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH 13/15] event/sw: add dump function for easier debugging
Date: Mon, 16 Jan 2017 15:40:53 +0000	[thread overview]
Message-ID: <1484581255-148720-14-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1484581255-148720-1-git-send-email-harry.van.haaren@intel.com>

From: Bruce Richardson <bruce.richardson@intel.com>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/event/sw/sw_evdev.c | 109 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index 318f1d7..ea34b99 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -400,6 +400,114 @@ sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info)
 	*info = evdev_sw_info;
 }
 
+static void
+sw_dump(struct rte_eventdev *dev, FILE *f)
+{
+	const struct sw_evdev *sw = sw_pmd_priv(dev);
+
+	static const char * const q_type_strings[] = {
+			"Ordered", "Atomic", "Parallel", "Directed"
+	};
+	uint32_t i;
+	fprintf(f, "EventDev %s: ports %d, qids %d\n", "todo-fix-name",
+			sw->port_count, sw->qid_count);
+
+	fprintf(f, "\trx   %"PRIu64"\n\tdrop %"PRIu64"\n\ttx   %"PRIu64"\n",
+		sw->stats.rx_pkts, sw->stats.rx_dropped, sw->stats.tx_pkts);
+	fprintf(f, "\tsched calls: %"PRIu64"\n", sw->sched_called);
+	fprintf(f, "\tsched cq/qid call: %"PRIu64"\n", sw->sched_cq_qid_called);
+	fprintf(f, "\tsched no IQ enq: %"PRIu64"\n", sw->sched_no_iq_enqueues);
+	fprintf(f, "\tsched no CQ enq: %"PRIu64"\n", sw->sched_no_cq_enqueues);
+	uint32_t quanta = *((const uint32_t *)(&sw->inflight_quanta));
+	uint32_t credits = sw->nb_events_limit - (quanta * SW_INFLIGHT_QUANTA_SIZE);
+	fprintf(f, "\tinflight sw credits: %d\n", credits);
+
+#define COL_RED "\x1b[31m"
+#define COL_RESET "\x1b[0m"
+
+	for (i = 0; i < sw->port_count; i++) {
+		int max, j;
+		const struct sw_port *p = &sw->ports[i];
+		fprintf(f, "  Port %d %s\n", i,
+				p->is_directed ? " (SingleCons)" : "");
+		fprintf(f, "\trx   %"PRIu64"\tdrop %"PRIu64"\ttx   %"PRIu64"\tinflight %d\n",
+				sw->ports[i].stats.rx_pkts,
+			sw->ports[i].stats.rx_dropped,
+			sw->ports[i].stats.tx_pkts, sw->ports[i].inflights);
+
+		fprintf(f, "\tAvg cycles PP: %"PRIu64"\tCredits: %u\n",
+			sw->ports[i].avg_pkt_ticks, sw->ports[i].inflight_credits);
+		fprintf(f, "\tReceive burst distribution:\n");
+		float zp_percent = p->zero_polls * 100.0 / p->total_polls;
+		fprintf(f, zp_percent < 10 ? "\t\t0:%.02f%% " : "\t\t0:%.0f%% ",
+				zp_percent);
+		for (max = (int)RTE_DIM(p->poll_buckets); max --> 0;)
+			if (p->poll_buckets[max] != 0)
+				break;
+		for (j = 0; j <= max; j++)
+			if (p->poll_buckets[j] != 0)
+				printf("%u-%u:%.02f%% ",
+						((j << SW_DEQ_STAT_BUCKET_SHIFT) + 1),
+						((j+1) << SW_DEQ_STAT_BUCKET_SHIFT),
+						p->poll_buckets[j] * 100.0 / p->total_polls);
+		printf("\n");
+
+		uint64_t rx_used = qe_ring_count(p->rx_worker_ring);
+		uint64_t rx_free = qe_ring_free_count(p->rx_worker_ring);
+		const char *rxcol = (rx_free == 0) ? COL_RED : COL_RESET;
+		fprintf(f, "\t%srx ring used: %4"PRIu64"\tfree: %4"PRIu64 COL_RESET"\n",
+				rxcol, rx_used, rx_free);
+
+		uint64_t tx_used = qe_ring_count(p->cq_worker_ring);
+		uint64_t tx_free = qe_ring_free_count(p->cq_worker_ring);
+		const char *txcol = (tx_free == 0) ? COL_RED : COL_RESET;
+		fprintf(f, "\t%scq ring used: %4"PRIu64"\tfree: %4"PRIu64 COL_RESET"\n",
+				txcol, tx_used, tx_free);
+	}
+
+	for (i = 0; i < sw->qid_count; i++) {
+		const struct sw_qid *qid = &sw->qids[i];
+		int affinities_per_port[SW_PORTS_MAX] = {0};
+		uint32_t inflights = 0;
+
+		fprintf(f, "  Queue %d (%s)\n", i, q_type_strings[qid->type]);
+		fprintf(f, "\trx   %"PRIu64"\tdrop %"PRIu64"\ttx   %"PRIu64"\n",
+			qid->stats.rx_pkts, qid->stats.rx_dropped,
+			qid->stats.tx_pkts);
+		if (qid->type == RTE_SCHED_TYPE_ORDERED)
+			fprintf(f, "\tReorder entries in use: %u\n",
+				rte_ring_free_count(qid->reorder_buffer_freelist));
+
+		uint32_t flow;
+		for (flow = 0; flow < RTE_DIM(qid->fids); flow++)
+			if (qid->fids[flow].cq != -1) {
+				affinities_per_port[qid->fids[flow].cq]++;
+				inflights += qid->fids[flow].pcount;
+			}
+
+		uint32_t cq;
+		fprintf(f, "\tInflights: %u\tFlows pinned per port: ", inflights);
+		for (cq = 0; cq < sw->port_count; cq++)
+			fprintf(f, "%d ", affinities_per_port[cq]);
+		fprintf(f, "\n");
+
+		uint32_t iq;
+		uint32_t iq_printed = 0;
+		for (iq = 0; iq < SW_IQS_MAX; iq++) {
+			uint32_t used = iq_ring_count(qid->iq[iq]);
+			uint32_t free = iq_ring_free_count(qid->iq[iq]);
+			const char *col = (free == 0) ? COL_RED : COL_RESET;
+			if (used > 0) {
+				fprintf(f, "\t%siq %d: Used %d\tFree %d"COL_RESET"\n",
+					col, iq, used, free);
+				iq_printed = 1;
+			}
+		}
+		if (iq_printed == 0)
+			fprintf(f, "\t-- iqs empty --\n");
+	}
+}
+
 static int
 sw_start(struct rte_eventdev *dev)
 {
@@ -500,6 +608,7 @@ sw_probe(const char *name, const char *params)
 			.dev_close = sw_close,
 			.dev_start = sw_start,
 			.dev_stop = sw_stop,
+			.dump = sw_dump,
 
 			.queue_def_conf = sw_queue_def_conf,
 			.queue_setup = sw_queue_setup,
-- 
2.7.4

  parent reply	other threads:[~2017-01-16 15:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 15:40 [dpdk-dev] [PATCH 00/15] next-eventdev: event/sw Software Eventdev Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 01/15] eventdev: remove unneeded dependencies Harry van Haaren
2017-01-17  9:11   ` Jerin Jacob
2017-01-17  9:59     ` Van Haaren, Harry
2017-01-17 10:38       ` Jerin Jacob
2017-01-21 17:34   ` Jerin Jacob
2017-01-16 15:40 ` [dpdk-dev] [PATCH 02/15] eventdev: add APIs for extended stats Harry van Haaren
2017-01-21 18:59   ` Jerin Jacob
2017-01-16 15:40 ` [dpdk-dev] [PATCH 03/15] event/sw: add new software-only eventdev driver Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 04/15] event/sw: add function to return device capabilities Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 05/15] event/sw: add configure function Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 06/15] event/sw: add fns to return default port/queue config Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 07/15] event/sw: add support for event queues Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 08/15] event/sw: add support for event ports Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 09/15] event/sw: add support for linking queues to ports Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 10/15] event/sw: add worker core functions Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 11/15] event/sw: add scheduling logic Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 12/15] event/sw: add start, stop and close functions Harry van Haaren
2017-01-16 15:40 ` Harry van Haaren [this message]
2017-01-16 15:40 ` [dpdk-dev] [PATCH 14/15] event/sw: add xstats support Harry van Haaren
2017-01-16 15:40 ` [dpdk-dev] [PATCH 15/15] app/test: add unit tests for SW eventdev driver Harry van Haaren
2017-01-21 17:57 ` [dpdk-dev] [PATCH 00/15] next-eventdev: event/sw Software Eventdev Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484581255-148720-14-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).