This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19294 )
Change subject: rate_ctr: Add functions to reset rate counter (groups)
......................................................................
rate_ctr: Add functions to reset rate counter (groups)
Change-Id: If2f806d044cd0fb6929dac44ef8f8a15941ffe9b
Related: SYS#4877
---
M TODO-RELEASE
M include/osmocom/core/rate_ctr.h
M src/rate_ctr.c
3 files changed, 25 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE
index e2fd830..3696681 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -15,3 +15,4 @@
gsm API/ABI change add new member to lapd_datalink
gsm new API new gsm0808_create_common_id()
gb new API new bssgp_tx_bvc_reset2()
+core new API new rate_ctr_reset(), rate_ctr_group_reset()
diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h
index f7e6e22..1669ce4 100644
--- a/include/osmocom/core/rate_ctr.h
+++ b/include/osmocom/core/rate_ctr.h
@@ -116,4 +116,7 @@
int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data);
+void rate_ctr_reset(struct rate_ctr *ctr);
+void rate_ctr_group_reset(struct rate_ctr_group *ctrg);
+
/*! @} */
diff --git a/src/rate_ctr.c b/src/rate_ctr.c
index 026670b..9043a2c 100644
--- a/src/rate_ctr.c
+++ b/src/rate_ctr.c
@@ -426,4 +426,25 @@
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);
+ }
+}
+
/*! @} */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19294
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If2f806d044cd0fb6929dac44ef8f8a15941ffe9b
Gerrit-Change-Number: 19294
Gerrit-PatchSet: 5
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200717/43bbda40/attachment.htm>