diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-08-22 08:56:53 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-09-03 22:57:23 -0400 |
| commit | d83b96faeb02d7a3574e63880141d6b23f31ced1 (patch) | |
| tree | b6cd2feca3513dccba012b9da2ac230e94d09ac0 /src/core/socket.h | |
| parent | 1b2a93503e0ed108f7c4add4bcf4b201a363bb80 (diff) | |
| download | nng-d83b96faeb02d7a3574e63880141d6b23f31ced1.tar.gz nng-d83b96faeb02d7a3574e63880141d6b23f31ced1.tar.bz2 nng-d83b96faeb02d7a3574e63880141d6b23f31ced1.zip | |
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.
Diffstat (limited to 'src/core/socket.h')
| -rw-r--r-- | src/core/socket.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/socket.h b/src/core/socket.h index 4b9c4642..5486918e 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -25,6 +25,7 @@ extern uint16_t nni_sock_peer_id(nni_sock *); extern const char *nni_sock_proto_name(nni_sock *); extern const char *nni_sock_peer_name(nni_sock *); extern void * nni_sock_proto_data(nni_sock *); +extern void nni_sock_add_stat(nni_sock *, nni_stat_item *); extern struct nni_proto_pipe_ops *nni_sock_proto_pipe_ops(nni_sock *); @@ -107,4 +108,12 @@ extern int nni_ctx_getopt( extern int nni_ctx_setopt( nni_ctx *, const char *, const void *, size_t, nni_opt_type); +// nni_sock_bump_rx is called by a protocol when a message is received by +// a consuming app. It bumps the rxmsgs by one and rxbytes by the size. +extern void nni_sock_bump_rx(nni_sock *s, uint64_t sz); + +// nni_sock_bump_rx is called by a protocol when a message is sent by +// a consuming app. It bumps the txmsgs by one and txbytes by the size. +extern void nni_sock_bump_tx(nni_sock *s, uint64_t sz); + #endif // CORE_SOCKET_H |
