nn_get_statistic.adoc 2.7 KB

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