#include <nanomsg/nn.h>
uint64_t nn_get_statistic (int s, int statistic);
Retrieves the value of a statistic from the socket.
While this API is stable, these statistics are intended for human consumption, to facilitate observability and debugging. The actual statistics themselves as well as their meanings are unstable, and subject to change without notice. Programs should not depend on the presence or values of any particular statistic.
The following statistics are maintained by the nanomsg core framework; others may be present. As those are undocumented, no interpretration should be made from them. Not all statistics are relevant to all transports. For example, the nn_inproc(7) transport does not maintain any of the connection related statistics.
NN_STAT_ESTABLISHED_CONNECTIONS
NN_STAT_ACCEPTED_CONNECTIONS
NN_STAT_DROPPED_CONNECTIONS
NN_STAT_BROKEN_CONNECTIONS
NN_STAT_CONNECT_ERRORS
NN_STAT_BIND_ERRORS
NN_STAT_ACCEPT_ERRORS
NN_STAT_CURRENT_CONNECTIONS
NN_STAT_MESSAGES_SENT
NN_STAT_MESSAGES_RECEIVED
NN_STAT_BYTES_SENT
NN_STAT_BYTES_RECEIVED
On success, the value of the statistic is returned, otherwise (uint64_t)-1 is returned.
EINVAL
EBADF
ETERM
val = nn_get_statistic (s, NN_STAT_MESSAGES_SENT); if (val == 0) printf ("No messages have been sent yet.\n");
nn_errno(3) nn_symbol(3) nanomsg(7)