aboutsummaryrefslogtreecommitdiffstats
path: root/src/rate_ctr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rate_ctr.c')
-rw-r--r--src/rate_ctr.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 436deef9..f995f3fd 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -153,7 +153,10 @@ int rate_ctr_init(void *tall_ctx)
return 0;
}
-/*! \brief Search for counter group based on group name and index */
+/*! \brief Search for counter group based on group name and index
+ * \param[in] name Name of the counter group you're looking for
+ * \param[in] idx Index inside the counter group
+ * \returns \ref rate_ctr_group or NULL in case of error */
struct rate_ctr_group *rate_ctr_get_group_by_name_idx(const char *name, const unsigned int idx)
{
struct rate_ctr_group *ctrg;
@@ -170,7 +173,11 @@ struct rate_ctr_group *rate_ctr_get_group_by_name_idx(const char *name, const un
return NULL;
}
-/*! \brief Search for counter group based on group name */
+/*! \brief Search for counter based on group + name
+ * \param[in] ctrg pointer to \ref rate_ctr_group
+ * \param[in] name name of counter inside group
+ * \returns \ref rate_ctr or NULL in caes of error
+ */
const struct rate_ctr *rate_ctr_get_by_name(const struct rate_ctr_group *ctrg, const char *name)
{
int i;
@@ -189,6 +196,12 @@ const struct rate_ctr *rate_ctr_get_by_name(const struct rate_ctr_group *ctrg, c
return NULL;
}
+/*! \brief Iterate over each counter in group and call function
+ * \param[in] counter group over whose counter to iterate
+ * \param[in] handle_counter function pointer
+ * \param[in] data Data to hand transparently to \ref handle_counter
+ * \returns 0 on success; negative otherwise
+ */
int rate_ctr_for_each_counter(struct rate_ctr_group *ctrg,
rate_ctr_handler_t handle_counter, void *data)
{
@@ -206,6 +219,11 @@ int rate_ctr_for_each_counter(struct rate_ctr_group *ctrg,
return rc;
}
+/*! \brief Iterate over all counter groups
+ * \param[in] handle_group function pointer of callback function
+ * \param[in] data Data to hand transparently to \ref handle_group
+ * \returns 0 on success; negative otherwise
+ */
int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
{
struct rate_ctr_group *statg;
@@ -220,5 +238,4 @@ int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
return rc;
}
-
/*! @} */