aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm
diff options
context:
space:
mode:
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
*/