From 3e3dd5ef9bec1db07bcb340691b58af9099446cd Mon Sep 17 00:00:00 2001 From: gdamore Date: Tue, 31 Dec 2024 17:51:33 +0000 Subject: deploy: c3bb282e916bf1ece77bf81901878498e39f0017 --- ref/api/stats.html | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'ref/api/stats.html') diff --git a/ref/api/stats.html b/ref/api/stats.html index 9b1f56dc..83c8b4a3 100644 --- a/ref/api/stats.html +++ b/ref/api/stats.html @@ -272,6 +272,7 @@ through statsp using the function nng_stats_get.

Traversing the Tree

const nng_stat *nng_stat_child(const nng_stat *stat);
 const nng_stat *nng_stat_next(const nng_stat *stat);
+const nng_stat *nng_stat_parent(const nng_stat *stat);
 

Traversing the tree of statistics is done using the nng_stat_child and nng_stat_next functions.

@@ -279,6 +280,8 @@ const nng_stat *nng_stat_next(const nng_stat *stat); or NULL if the stat has no children.

The nng_stat_next function returns the nearest sibling to the right of stat, or NULL if stat has no more siblings to the right.

+

The nng_stat_parent function returns the parent of stat, or NULL if +stat is the root of the statistics tree.

Finding a Statistic

const nng_stat *nng_stat_find(const nng_stat *stat, const char *name);
 const nng_stat *nng_stat_find_dialer(const nng_stat *stat, nng_dialer dialer);
@@ -289,10 +292,10 @@ const nng_stat *nng_stat_find_socket(const nng_stat *stat, nng_dialer socket);
 or possibly to find the tree of statistics associated iwth a specific socket,
 dialer, or listener.

The nng_stat_find functions are provided for this purpose.

-

The nng_stat_find function returns the first statistic within the subtree of +

The nng_stat_find function returns the first statistic within the subtree of statistics stat, with the given name. If no such statistic can be found, NULL is returned.

-

The nng_stat_find_dialer, nng_stat_find_listener, and nng_stat_find_socket +

The nng_stat_find_dialer, nng_stat_find_listener, and nng_stat_find_socket return the statistics subtree for the given dialer, listener, or socket object. If no such statistic can be found, then they return NULL. These functions should be provided the root of the statistic tree, in order to ensure @@ -301,23 +304,23 @@ that they can find the desired object.

const char *nng_stat_name(const nng_stat *stat);
 const char *nng_stat_desc(const nng_stat *stat);
 
-

Every statistic has a name, returned by nng_stat_name, and a description, returned by -nng_stat_desc. Descriptions are human-readable text, which might be useful for display.

+

Every statistic has a name, returned by nng_stat_name, and a description, returned by +nng_stat_desc. Descriptions are human-readable text, which might be useful for display.

Statistic Type

int nng_stat_type(const nng_stat *stat);
 
-

The function nng_stat_type returns the type of the statistic. +

The function nng_stat_type returns the type of the statistic. The type of a statistic determines the nature of the value, and which function can be used to obtain that value.

  • -

    NNG_STAT_SCOPE: +

    NNG_STAT_SCOPE: The statistic does not carry any real value, but is used for grouping related statistics together. This is a nexus in the statistics tree.

  • -

    NNG_STAT_COUNTER: +

    NNG_STAT_COUNTER: The statistic is a counter that only increments. Usually the change in the value of the statistic is more interesting (as a rate) than the absolute value at any given time. The value should @@ -325,7 +328,7 @@ be obtained using nng_stat_value The units will be given by the value returned from nng_stat_unit.

  • -

    NNG_STAT_LEVEL: +

    NNG_STAT_LEVEL: The statistic represnts a measured value which corresponds to a specific value at a specific time. For example, this may represent the number of messages currently queued for some operation, or the link speed @@ -335,19 +338,19 @@ than the change in the value over time. Again the value can be obtained with with nng_stat_unit.

  • -

    NNG_STAT_STRING: +

    NNG_STAT_STRING: The statistic is a string, such as a name. The value of the string can be obtained with nng_stat_string. The value of this string will remain valid until the snapshot is deallocated with nng_stats_free.

  • -

    NNG_STAT_BOOLEAN: +

    NNG_STAT_BOOLEAN: The value of the statistic is a truth value (either true or false) and can be obtained with nng_stat_bool.

  • -

    NNG_STAT_ID: +

    NNG_STAT_ID: The value of the statistic is a numeric identifier, such as a socket identifier. The value can be obtained with nng_stat_value, and will be fixed for the life of the statistic.

    @@ -359,12 +362,12 @@ const char *nng_stat_string(const nng_stat *stat); bool nng_stat_bool(const nng_stat *stat);

These functions return the value associated with the statistic.

-

The nng_stat_value function returns the the numeric value for the statistic stat +

The nng_stat_value function returns the the numeric value for the statistic stat of type NNG_STAT_COUNTER, NNG_STAT_LEVEL, or NNG_STAT_ID. If stat is not one of these types, then it returns zero.

-

The nng_stat_bool function returns the Boolean value (either true or false) for the statistic stat of +

The nng_stat_bool function returns the Boolean value (either true or false) for the statistic stat of type NNG_STAT_BOOLEAN. If the statistics is not of this type, then it returns false.

-

The nng_stat_string function returns a pointer to a string value for the statistic stat, +

The nng_stat_string function returns a pointer to a string value for the statistic stat, of type NNG_STAT_STRING. This string will remain valud until the snapshot that stat was collected with is deallocated with nng_stats_free. If the statistic is not of type NNG_STAT_STRING, then NULL is returned.

@@ -373,19 +376,19 @@ is not of type NNG_STAT_STRING, then NULL is returned.

For statistics of type NNG_STAT_COUNTER or NNG_STAT_LEVEL, it is often useful to know what that quantity being reported measures. -The following units may be returned from nng_stat_unit for such a statistic:

+The following units may be returned from nng_stat_unit for such a statistic:

Statistic Timestamp

uint64_t nng_stat_timestamp(const nng_stat *stat);
 

Statistics have a timestamp indicating when the value was sampled, -obtained via nng_stat_timestamp. The timestamp is given in +obtained via nng_stat_timestamp. The timestamp is given in in milliseconds since a reference time, and the reference time used here is the same reference time used for nng_clock.

See Also

-- cgit v1.2.3-70-g09d2