diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-02-24 14:43:34 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-02-24 14:46:35 +0100 |
commit | 175a4ae93aaf1068b61041dca12962059d65ed55 (patch) | |
tree | d6f43f27a6fa5db4a60f85326621e3ac94a2fc1e /include | |
parent | 218c4de84f6d94a882e3a945332f53732bf2e134 (diff) |
rate_ctr: Add rate_ctr_inc2() as convenience wrapper
rate_ctr_inc2() is slightly easier to use than the old
rate_ctr_inc() variant.
Change-Id: Ie00706be201c32ec2981ea38b70354ed85e1aefd
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocom/core/rate_ctr.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/core/rate_ctr.h b/include/osmocom/core/rate_ctr.h index 6ce2dfed..865467ce 100644 --- a/include/osmocom/core/rate_ctr.h +++ b/include/osmocom/core/rate_ctr.h @@ -88,6 +88,15 @@ static inline void rate_ctr_inc(struct rate_ctr *ctr) rate_ctr_add(ctr, 1); } +/*! Increment the counter by 1 + * \param ctrg \ref rate_ctr_group of counter + * \param idx index into \a ctrg counter group */ +static inline void rate_ctr_inc2(struct rate_ctr_group *ctrg, unsigned int idx) +{ + rate_ctr_inc(&ctrg->ctr[idx]); +} + + /*! Return the counter difference since the last call to this function */ int64_t rate_ctr_difference(struct rate_ctr *ctr); |