aboutsummaryrefslogtreecommitdiffstats
path: root/src/rate_ctr.c
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-07-14 18:04:18 +0200
committerlaforge <laforge@osmocom.org>2020-07-17 16:41:31 +0000
commit26a9539e18295dcd84597cacbd736652075426e2 (patch)
tree3728be3c9214eddc2877b55f5d9f9063dbb72cae /src/rate_ctr.c
parent0e7349d386ade2107a05c90dcf8a67f498f6975c (diff)
rate_ctr: Add functions to reset rate counter (groups)
Diffstat (limited to 'src/rate_ctr.c')
-rw-r--r--src/rate_ctr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 026670bd..9043a2c6 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -426,4 +426,25 @@ int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
return rc;
}
+/*! Reset a rate counter back to zero
+ * \param[in] ctr counter to reset
+ */
+void rate_ctr_reset(struct rate_ctr *ctr)
+{
+ memset(ctr, 0, sizeof(*ctr));
+}
+
+/*! Reset all counters in a group
+ * \param[in] ctrg counter group to reset
+ */
+void rate_ctr_group_reset(struct rate_ctr_group *ctrg)
+{
+ int i;
+
+ for (i = 0; i < ctrg->desc->num_ctr; i++) {
+ struct rate_ctr *ctr = &ctrg->ctr[i];
+ rate_ctr_reset(ctr);
+ }
+}
+
/*! @} */