From 66ff33813a8cd9d4cba96280bb613762fb0c2ce2 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 11 Nov 2020 21:29:54 -0800 Subject: fixes #1323 stats framework is *way* to heavy This should reduce the amount of copying, and the overall size used by pipes and other objects quite a bit. (On my system, the sizeof nni_pipe shrank by 400 bytes, for example.) --- docs/man/CMakeLists.txt | 2 ++ docs/man/libnng.3.adoc | 3 ++- docs/man/nng_stat_bool.3.adoc | 50 +++++++++++++++++++++++++++++++++++++++++ docs/man/nng_stat_string.3.adoc | 5 ++++- docs/man/nng_stat_value.3.adoc | 9 ++++---- 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 docs/man/nng_stat_bool.3.adoc (limited to 'docs') diff --git a/docs/man/CMakeLists.txt b/docs/man/CMakeLists.txt index 0f175195..a33d4ee8 100644 --- a/docs/man/CMakeLists.txt +++ b/docs/man/CMakeLists.txt @@ -163,6 +163,7 @@ if (NNG_ENABLE_DOC) nng_socket_set nng_stats_free nng_stats_get + nng_stat_bool nng_stat_child nng_stat_desc nng_stat_find @@ -354,6 +355,7 @@ if (NNG_ENABLE_DOC) nng_options nng_pipe nng_sockaddr + nng_sockaddr_abstract nng_sockaddr_in nng_sockaddr_in6 nng_sockaddr_inproc diff --git a/docs/man/libnng.3.adoc b/docs/man/libnng.3.adoc index ab1a6b11..ccc2732c 100644 --- a/docs/man/libnng.3.adoc +++ b/docs/man/libnng.3.adoc @@ -239,6 +239,7 @@ The following functions provide access to statistics which can be used to observe program behaviors and as an aid in troubleshooting. |=== +|xref:nng_stat_bool.3.adoc[nng_stat_bool()]|get statistic Boolean value |xref:nng_stat_child.3.adoc[nng_stat_child()]|get child statistic |xref:nng_stat_desc.3.adoc[nng_stat_name()]|get statistic description |xref:nng_stat_find.3.adoc[nng_stat_find()]|find statistic by name @@ -251,7 +252,7 @@ to observe program behaviors and as an aid in troubleshooting. |xref:nng_stat_timestamp.3.adoc[nng_stat_timestamp()]|get statistic timestamp |xref:nng_stat_type.3.adoc[nng_stat_type()]|get statistic type |xref:nng_stat_unit.3.adoc[nng_stat_unit()]|get statistic unit -|xref:nng_stat_value.3.adoc[nng_stat_value()]|get statistic value +|xref:nng_stat_value.3.adoc[nng_stat_value()]|get statistic numeric value |xref:nng_stats_free.3.adoc[nng_stats_free()]|free statistics |xref:nng_stats_get.3.adoc[nng_stats_get()]|get statistics |=== diff --git a/docs/man/nng_stat_bool.3.adoc b/docs/man/nng_stat_bool.3.adoc new file mode 100644 index 00000000..17b7bbca --- /dev/null +++ b/docs/man/nng_stat_bool.3.adoc @@ -0,0 +1,50 @@ += nng_stat_value(3) +// +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV +// +// This document is supplied under the terms of the MIT License, a +// copy of which should be located in the distribution where this +// file was obtained (LICENSE.txt). A copy of the license may also be +// found online at https://opensource.org/licenses/MIT. +// + +== NAME + +nng_stat_value - get statistic value + +== SYNOPSIS + +[source, c] +---- +#include + +typedef struct nng_stat nng_stat; + +bool nng_stat_bool(nng_stat *stat); +---- + +== DESCRIPTION + +The `nng_stat_bool()` function returns the Boolean value for the statistic _stat_. +Otherwise, if the statistic is not of Boolean type, the result is indeterminate. +See xref:nng_stat_type.3.adoc[`nng_stat_type()`] for a description of statistic types. + +== RETURN VALUES + +The boolean value associated with _stat_. + +== ERRORS + +None. + +== SEE ALSO + +[.text-left] +xref:libnng.3.adoc[libnng(3)], +xref:nng_stats_get.3.adoc[nng_stats_get(3)], +xref:nng_stat_type.3.adoc[nng_stat_type(3)], +xref:nng_stat_unit.3.adoc[nng_stat_unit(3)], +xref:nng_stat_value.3.adoc[nng_stat_value(3)], +xref:nng_stat.5.adoc[nng_stat(5)], +xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_stat_string.3.adoc b/docs/man/nng_stat_string.3.adoc index 3323fef3..4c65fb1a 100644 --- a/docs/man/nng_stat_string.3.adoc +++ b/docs/man/nng_stat_string.3.adoc @@ -1,6 +1,6 @@ = nng_stat_string(3) // -// Copyright 2018 Staysail Systems, Inc. +// Copyright 2020 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a @@ -31,6 +31,9 @@ which must be of type `NNG_STAT_STRING` (see xref:nng_stat_type.3.adoc[`nng_stat If the statistic is not of type `NNG_STAT_STRING`, then `NULL` will be returned. +NOTE: The returned string is valid until xref:nng_stats_free.3.adoc[`nng_stats_free()`] is called to +free the memory for the snapshot. + == RETURN VALUES The string value associated with _stat_, or `NULL` if the statistic is not diff --git a/docs/man/nng_stat_value.3.adoc b/docs/man/nng_stat_value.3.adoc index 6f1b9201..32b87e12 100644 --- a/docs/man/nng_stat_value.3.adoc +++ b/docs/man/nng_stat_value.3.adoc @@ -1,6 +1,6 @@ = nng_stat_value(3) // -// Copyright 2018 Staysail Systems, Inc. +// Copyright 2020 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This document is supplied under the terms of the MIT License, a @@ -27,14 +27,12 @@ uint64_t nng_stat_value(nng_stat *stat); == DESCRIPTION The `nng_stat_value()` function returns a numeric value for the statistic _stat_. -If the statistic has a boolean value, then zero is returned for `false`, and -one is returned for `true`. -Otherwise, if the statistic is not of numeric type, then zero is returned. +If the statistic is not of numeric type, then zero is returned. See xref:nng_stat_type.3.adoc[`nng_stat_type()`] for a description of statistic types. == RETURN VALUES -The numeric or boolean value associated with _stat_. +The numeric value associated with _stat_. == ERRORS @@ -45,6 +43,7 @@ None. [.text-left] xref:libnng.3.adoc[libnng(3)], xref:nng_stats_get.3.adoc[nng_stats_get(3)], +xref:nng_stat_bool.3.adoc[nng_stat_bool(3)], xref:nng_stat_type.3.adoc[nng_stat_type(3)], xref:nng_stat_unit.3.adoc[nng_stat_unit(3)], xref:nng_stat.5.adoc[nng_stat(5)], -- cgit v1.2.3-70-g09d2