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/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/25437 ) Change subject: rate ctr: move rate_ctr_add and rate_ctr_group_get_ctr to header ...................................................................... rate ctr: move rate_ctr_add and rate_ctr_group_get_ctr to header rate_ctr_add merely increments a number, so hiding this in a shared library means the compiler can't just inline it, there will always be a function call into that lib just for icrementing a value. This also applies to rate_ctr_group_get_ctr. Moving the funcs to the header fixes that. Change-Id: Ib600f39f10d263606f3cb51a25676b56b80dfe83 --- M include/osmocom/core/rate_ctr.h M src/rate_ctr.c 2 files changed, 13 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/37/25437/1 diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h index ffaae91..558c77a 100644 --- a/include/osmocom/core/rate_ctr.h +++ b/include/osmocom/core/rate_ctr.h @@ -77,14 +77,25 @@ } void rate_ctr_group_set_name(struct rate_ctr_group *grp, const char *name); -struct rate_ctr *rate_ctr_group_get_ctr(struct rate_ctr_group *grp, unsigned int idx); +/*! Get rate counter from group, identified by index idx + * \param[in] grp Rate counter group + * \param[in] idx Index of the counter to retrieve + * \returns rate counter requested + */ +static struct rate_ctr *rate_ctr_group_get_ctr(struct rate_ctr_group *grp, unsigned int idx) +{ + return &grp->ctr[idx]; +} void rate_ctr_group_free(struct rate_ctr_group *grp); /*! Increment the counter by \a inc * \param ctr \ref rate_ctr to increment * \param inc quantity to increment \a ctr by */ -void rate_ctr_add(struct rate_ctr *ctr, int inc); +static void rate_ctr_add(struct rate_ctr *ctr, int inc) +{ + ctr->current += inc; +} /*! Increment the counter by 1 * \param ctr \ref rate_ctr to increment */ diff --git a/src/rate_ctr.c b/src/rate_ctr.c index aa02005..0400bfe 100644 --- a/src/rate_ctr.c +++ b/src/rate_ctr.c @@ -265,16 +265,6 @@ talloc_free(grp); } -/*! Get rate counter from group, identified by index idx - * \param[in] grp Rate counter group - * \param[in] idx Index of the counter to retrieve - * \returns rate counter requested - */ -struct rate_ctr *rate_ctr_group_get_ctr(struct rate_ctr_group *grp, unsigned int idx) -{ - return &grp->ctr[idx]; -} - /*! Set a name for the group of counters be used instead of index value at report time. * \param[in] grp Rate counter group @@ -285,12 +275,6 @@ osmo_talloc_replace_string(grp, &grp->name, name); } -/*! Add a number to the counter */ -void rate_ctr_add(struct rate_ctr *ctr, int inc) -{ - ctr->current += inc; -} - /*! Return the counter difference since the last call to this function */ int64_t rate_ctr_difference(struct rate_ctr *ctr) { -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25437 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib600f39f10d263606f3cb51a25676b56b80dfe83 Gerrit-Change-Number: 25437 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ewild at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210910/7f48fa54/attachment.htm>