aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-12-02 16:44:42 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-12-11 16:46:51 +0000
commitcfdb109180cb01c17f92a465f925c244259ba06b (patch)
treeb4bf1ea473a74f5da041ec05d4a2366d9812a155 /src/svm
parentc00f480ba080847417b4ecb41118d5079f9860c7 (diff)
session: Add mq debug cli
Type: feature This add a `show app message queue` cli command that shows mq size per app & thread. Change-Id: I5c6ce024b149fb7a47d899bc514c5a4887429982 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/svm')
-rw-r--r--src/svm/message_queue.c14
-rw-r--r--src/svm/message_queue.h6
2 files changed, 20 insertions, 0 deletions
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c
index 6113450e7cb..10266a8039c 100644
--- a/src/svm/message_queue.c
+++ b/src/svm/message_queue.c
@@ -15,6 +15,7 @@
#include <svm/message_queue.h>
#include <vppinfra/mem.h>
+#include <vppinfra/format.h>
#include <sys/eventfd.h>
static inline svm_msg_q_ring_t *
@@ -265,6 +266,19 @@ svm_msg_q_alloc_producer_eventfd (svm_msg_q_t * mq)
return 0;
}
+u8 *
+format_svm_msg_q (u8 * s, va_list * args)
+{
+ svm_msg_q_t *mq = va_arg (*args, svm_msg_q_t *);
+ s = format (s, " [Q:%d/%d]", mq->q->cursize, mq->q->maxsize);
+ for (u32 i = 0; i < vec_len (mq->rings); i++)
+ {
+ s = format (s, " [R%d:%d/%d]", i, mq->rings[i].cursize,
+ mq->rings[i].nitems);
+ }
+ return s;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 7226560124f..37293fc29d1 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -247,6 +247,12 @@ int svm_msg_q_alloc_consumer_eventfd (svm_msg_q_t * mq);
*/
int svm_msg_q_alloc_producer_eventfd (svm_msg_q_t * mq);
+
+/**
+ * Format message queue, shows msg count for each ring
+ */
+u8 *format_svm_msg_q (u8 * s, va_list * args);
+
/**
* Check if message queue is full
*/