From d83b96faeb02d7a3574e63880141d6b23f31ced1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 22 Aug 2018 08:56:53 -0700 Subject: fixes #4 Statistics support This introduces new public APIs for obtaining statistics, and adds some generic stats for dialers, listeners, pipes, and sockets. Also added are stats for inproc and pairv1 protocol. The other protocols and transports will have stats added incrementally as time goes on. A simple test program, and man pages are provided for this. Start by looking at nng_stat(5). Statistics does have some impact, and they can be disabled by using the advanced NNG_ENABLE_STATS (setting it to OFF, it's ON by default) if you need to build a minimized configuration. --- src/core/msgqueue.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/msgqueue.h') diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h index 7dc5800d..bd9b3682 100644 --- a/src/core/msgqueue.h +++ b/src/core/msgqueue.h @@ -99,4 +99,13 @@ extern int nni_msgq_len(nni_msgq *mq); extern int nni_msgq_get_recvable(nni_msgq *mq, nni_pollable **); extern int nni_msgq_get_sendable(nni_msgq *mq, nni_pollable **); +// message queues keep statistics +extern uint64_t nni_msgq_stat_get_bytes(nni_msgq *); +extern uint64_t nni_msgq_stat_put_bytes(nni_msgq *); +extern uint64_t nni_msgq_stat_get_msgs(nni_msgq *); +extern uint64_t nni_msgq_stat_put_msgs(nni_msgq *); +extern uint64_t nni_msgq_stat_get_errs(nni_msgq *); +extern uint64_t nni_msgq_stat_put_errs(nni_msgq *); +extern uint64_t nni_msgq_stat_discards(nni_msgq *); + #endif // CORE_MSQUEUE_H -- cgit v1.2.3-70-g09d2