| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/stats.R |
| 3 |
\name{stat} |
| 4 |
\alias{stat} |
| 5 |
\title{Get Statistic for a Socket, Listener or Dialer} |
| 6 |
\usage{ |
| 7 |
stat(object, name) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{object}{a Socket, Listener or Dialer.} |
| 11 |
|
| 12 |
\item{name}{character name of statistic to return.} |
| 13 |
} |
| 14 |
\value{ |
| 15 |
The value of the statistic (character or double depending on the type |
| 16 |
of statistic requested) if available, or else NULL. |
| 17 |
} |
| 18 |
\description{ |
| 19 |
Obtain value of a statistic for a Socket, Listener or Dialer. This function |
| 20 |
exposes the stats interface of NNG. |
| 21 |
} |
| 22 |
\details{ |
| 23 |
Note: the values of individual statistics are guaranteed to be atomic, but |
| 24 |
due to the way statistics are collected there may be discrepancies between |
| 25 |
them at times. For example, statistics counting bytes and messages received |
| 26 |
may not reflect the same number of messages, depending on when the snapshot |
| 27 |
is taken. This potential inconsistency arises as a result of optimisations to |
| 28 |
minimise the impact of statistics on actual operations. |
| 29 |
} |
| 30 |
\section{Stats}{ |
| 31 |
|
| 32 |
|
| 33 |
The following stats may be requested for a Socket: |
| 34 |
\itemize{ |
| 35 |
\item 'id' - numeric id of the socket. |
| 36 |
\item 'name' - character socket name. |
| 37 |
\item 'protocol' - character protocol type e.g. 'bus'. |
| 38 |
\item 'pipes' - numeric number of pipes (active connections). |
| 39 |
\item 'dialers' - numeric number of listeners attached to the socket. |
| 40 |
\item 'listeners' - numeric number of dialers attached to the socket. |
| 41 |
} |
| 42 |
|
| 43 |
The following stats may be requested for a Listener / Dialer: |
| 44 |
\itemize{ |
| 45 |
\item 'id' - numeric id of the listener / dialer. |
| 46 |
\item 'socket' - numeric id of the socket of the listener / dialer. |
| 47 |
\item 'url' - character URL address. |
| 48 |
\item 'pipes' - numeric number of pipes (active connections). |
| 49 |
} |
| 50 |
|
| 51 |
The following additional stats may be requested for a Listener: |
| 52 |
\itemize{ |
| 53 |
\item 'accept' - numeric total number of connection attempts, whether |
| 54 |
successful or not. |
| 55 |
\item 'reject' - numeric total number of rejected connection attempts e.g. |
| 56 |
due to incompatible protocols. |
| 57 |
} |
| 58 |
|
| 59 |
The following additional stats may be requested for a Dialer: |
| 60 |
\itemize{ |
| 61 |
\item 'connect' - numeric total number of connection attempts, whether |
| 62 |
successful or not. |
| 63 |
\item 'reject' - numeric total number of rejected connection attempts e.g. |
| 64 |
due to incompatible protocols. |
| 65 |
\item 'refused' - numeric total number of refused connections e.g. when |
| 66 |
starting synchronously with no listener on the other side. |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
\examples{ |
| 71 |
s <- socket("bus", listen = "inproc://stats") |
| 72 |
stat(s, "pipes") |
| 73 |
|
| 74 |
s1 <- socket("bus", dial = "inproc://stats") |
| 75 |
stat(s, "pipes") |
| 76 |
|
| 77 |
close(s1) |
| 78 |
stat(s, "pipes") |
| 79 |
|
| 80 |
close(s) |
| 81 |
|
| 82 |
} |