1NN_GET_STATISTIC(3) nanomsg 1.1.5 NN_GET_STATISTIC(3)
2
3
4
6 nn_get_statistic - retrieve statistics from nanomsg socket
7
9 #include <nanomsg/nn.h>
10
11 uint64_t nn_get_statistic (int s, int statistic);
12
14 Retrieves the value of a statistic from the socket.
15
16 Caution
17 While this API is stable, these statistics are intended for human
18 consumption, to facilitate observability and debugging. The actual
19 statistics themselves as well as their meanings are unstable, and
20 subject to change without notice. Programs should not depend on the
21 presence or values of any particular statistic.
22
23 The following statistics are maintained by the nanomsg core framework;
24 others may be present. As those are undocumented, no interpretration
25 should be made from them. Not all statistics are relevant to all
26 transports. For example, the nn_inproc(7) transport does not maintain
27 any of the connection related statistics.
28
29 NN_STAT_ESTABLISHED_CONNECTIONS
30 The number of connections successfully established that were
31 initiated from this socket.
32
33 NN_STAT_ACCEPTED_CONNECTIONS
34 The number of connections successfully established that were
35 accepted by this socket.
36
37 NN_STAT_DROPPED_CONNECTIONS
38 The number of established connections that were dropped by this
39 socket.
40
41 NN_STAT_BROKEN_CONNECTIONS
42 The number of established connections that were closed by this
43 socket, typically due to protocol errors.
44
45 NN_STAT_CONNECT_ERRORS
46 The number of errors encountered by this socket trying to connect
47 to a remote peer.
48
49 NN_STAT_BIND_ERRORS
50 The number of errors encountered by this socket trying to bind to a
51 local address.
52
53 NN_STAT_ACCEPT_ERRORS
54 The number of errors encountered by this socket trying to accept a
55 a connection from a remote peer.
56
57 NN_STAT_CURRENT_CONNECTIONS
58 The number of connections currently estabalished to this socket.
59
60 NN_STAT_MESSAGES_SENT
61 The number messages sent by this socket.
62
63 NN_STAT_MESSAGES_RECEIVED
64 The number messages received by this socket.
65
66 NN_STAT_BYTES_SENT
67 The number of bytes sent by this socket.
68
69 NN_STAT_BYTES_RECEIVED
70 The number of bytes received by this socket.
71
73 On success, the value of the statistic is returned, otherwise
74 (uint64_t)-1 is returned.
75
77 EINVAL
78 The statistic is invalid or unsupported.
79
80 EBADF
81 The provided socket is invalid.
82
83 ETERM
84 The library is terminating.
85
87 val = nn_get_statistic (s, NN_STAT_MESSAGES_SENT);
88 if (val == 0)
89 printf ("No messages have been sent yet.\n");
90
92 nn_errno(3) nn_symbol(3) nanomsg(7)
93
95 Garrett D’Amore <garrett@damore.org>
96
97
98
99 2020-01-29 NN_GET_STATISTIC(3)