\doxysection{Rate counters}
\label{group__rate__ctr}\index{Rate counters@{Rate counters}}


Counters about events and their event rates.  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ rate\+\_\+ctr.\+h}
\item 
file \textbf{ rate\+\_\+ctr.\+c}
\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ rate\+\_\+ctr\+\_\+per\+\_\+intv}
\begin{DoxyCompactList}\small\item\em data we keep for each of the intervals \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr}
\begin{DoxyCompactList}\small\item\em data we keep for each actual value \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr\+\_\+desc}
\begin{DoxyCompactList}\small\item\em rate counter description \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc}
\begin{DoxyCompactList}\small\item\em description of a rate counter group \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr\+\_\+group}
\begin{DoxyCompactList}\small\item\em One instance of a counter group class. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+NUM}~4
\begin{DoxyCompactList}\small\item\em Number of rate counter intervals. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \textbf{ rate\+\_\+ctr\+\_\+handler\+\_\+t}) (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$, struct \textbf{ rate\+\_\+ctr} $\ast$, const struct \textbf{ rate\+\_\+ctr\+\_\+desc} $\ast$, void $\ast$)
\item 
typedef int($\ast$ \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+handler\+\_\+t}) (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$, void $\ast$)
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ rate\+\_\+ctr\+\_\+intv} \{ \newline
\textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+SEC}
, \newline
\textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+MIN}
, \newline
\textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+HOUR}
, \newline
\textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+DAY}
 \}
\begin{DoxyCompactList}\small\item\em Rate counter interval. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static int \textbf{ rate\+\_\+ctr\+\_\+handler} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, struct \textbf{ rate\+\_\+ctr} $\ast$ctr, const struct \textbf{ rate\+\_\+ctr\+\_\+desc} $\ast$\textbf{ desc}, void $\ast$vctx\+\_\+)
\item 
void \textbf{ vty\+\_\+out\+\_\+rate\+\_\+ctr\+\_\+group2} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$prefix, struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, bool skip\+\_\+zero)
\item 
void \textbf{ vty\+\_\+out\+\_\+rate\+\_\+ctr\+\_\+group} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$prefix, struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg)
\item 
static char $\ast$ \textbf{ pad\+\_\+append\+\_\+str} (char $\ast$s, const char $\ast$a, int minwidth)
\item 
static char $\ast$ \textbf{ pad\+\_\+append\+\_\+ctr} (char $\ast$s, uint64\+\_\+t ctr, int minwidth)
\item 
static int \textbf{ rate\+\_\+ctr\+\_\+handler\+\_\+fmt} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, struct \textbf{ rate\+\_\+ctr} $\ast$ctr, const struct \textbf{ rate\+\_\+ctr\+\_\+desc} $\ast$\textbf{ desc}, void $\ast$vctx\+\_\+)
\item 
void \textbf{ vty\+\_\+out\+\_\+rate\+\_\+ctr\+\_\+group\+\_\+fmt2} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$fmt, struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, bool skip\+\_\+zero)
\item 
void \textbf{ vty\+\_\+out\+\_\+rate\+\_\+ctr\+\_\+group\+\_\+fmt} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$fmt, struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg)
\item 
static int \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+handler} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, void $\ast$vctx\+\_\+)
\item 
struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc} (void $\ast$ctx, const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$\textbf{ desc}, unsigned int idx)
\begin{DoxyCompactList}\small\item\em Allocate a new group of counters according to description. \end{DoxyCompactList}\item 
static void \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+upd\+\_\+idx} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$grp, unsigned int idx)
\item 
void \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+set\+\_\+name} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$grp, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Set a name for the group of counters be used instead of index value at report time. \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr} $\ast$ \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+get\+\_\+ctr} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$grp, unsigned int idx)
\begin{DoxyCompactList}\small\item\em Get rate counter from group, identified by index idx. \end{DoxyCompactList}\item 
void \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+free} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$grp)
\begin{DoxyCompactList}\small\item\em Free the memory for the specified group of counters. \end{DoxyCompactList}\item 
void \textbf{ rate\+\_\+ctr\+\_\+add} (struct \textbf{ rate\+\_\+ctr} $\ast$ctr, int inc)
\begin{DoxyCompactList}\small\item\em Increment the counter by {\itshape inc}. \end{DoxyCompactList}\item 
static void \textbf{ rate\+\_\+ctr\+\_\+add2} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, unsigned int idx, int inc)
\begin{DoxyCompactList}\small\item\em Increment the counter by {\itshape inc}. \end{DoxyCompactList}\item 
static void \textbf{ rate\+\_\+ctr\+\_\+inc} (struct \textbf{ rate\+\_\+ctr} $\ast$ctr)
\begin{DoxyCompactList}\small\item\em Increment the counter by 1. \end{DoxyCompactList}\item 
static void \textbf{ rate\+\_\+ctr\+\_\+inc2} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, unsigned int idx)
\begin{DoxyCompactList}\small\item\em Increment the counter by 1. \end{DoxyCompactList}\item 
int64\+\_\+t \textbf{ rate\+\_\+ctr\+\_\+difference} (struct \textbf{ rate\+\_\+ctr} $\ast$ctr)
\begin{DoxyCompactList}\small\item\em Return the counter difference since the last call to this function. \end{DoxyCompactList}\item 
int \textbf{ rate\+\_\+ctr\+\_\+init} (void $\ast$tall\+\_\+ctx)
\begin{DoxyCompactList}\small\item\em Initialize the counter module. \end{DoxyCompactList}\item 
struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ \textbf{ rate\+\_\+ctr\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idx} (const char $\ast$\textbf{ name}, const unsigned int idx)
\begin{DoxyCompactList}\small\item\em Search for counter group based on group name and index. \end{DoxyCompactList}\item 
const struct \textbf{ rate\+\_\+ctr} $\ast$ \textbf{ rate\+\_\+ctr\+\_\+get\+\_\+by\+\_\+name} (const struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Search for counter based on group + name. \end{DoxyCompactList}\item 
int \textbf{ rate\+\_\+ctr\+\_\+for\+\_\+each\+\_\+counter} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg, \textbf{ rate\+\_\+ctr\+\_\+handler\+\_\+t} \textbf{ handle\+\_\+counter}, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Iterate over each counter in group and call function. \end{DoxyCompactList}\item 
int \textbf{ rate\+\_\+ctr\+\_\+for\+\_\+each\+\_\+group} (\textbf{ rate\+\_\+ctr\+\_\+group\+\_\+handler\+\_\+t} handle\+\_\+group, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Iterate over all counter groups. \end{DoxyCompactList}\item 
void \textbf{ rate\+\_\+ctr\+\_\+reset} (struct \textbf{ rate\+\_\+ctr} $\ast$ctr)
\begin{DoxyCompactList}\small\item\em Reset a rate counter back to zero. \end{DoxyCompactList}\item 
void \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+reset} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ctrg)
\begin{DoxyCompactList}\small\item\em Reset all counters in a group. \end{DoxyCompactList}\item 
static \textbf{ LLIST\+\_\+\+HEAD} (rate\+\_\+ctr\+\_\+groups)
\item 
static bool \textbf{ rate\+\_\+ctrl\+\_\+group\+\_\+desc\+\_\+validate} (const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$\textbf{ desc})
\item 
static char $\ast$ \textbf{ mangle\+\_\+identifier\+\_\+ifneeded} (const void $\ast$ctx, const char $\ast$in)
\item 
static struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$ \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+\_\+mangle} (void $\ast$ctx, const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$\textbf{ desc})
\item 
static unsigned int \textbf{ rate\+\_\+ctr\+\_\+get\+\_\+unused\+\_\+name\+\_\+idx} (const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Find an unused index for this rate counter group. \end{DoxyCompactList}\item 
static void \textbf{ interval\+\_\+expired} (struct \textbf{ rate\+\_\+ctr} $\ast$ctr, enum \textbf{ rate\+\_\+ctr\+\_\+intv} intv)
\item 
static void \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+intv} (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$grp)
\item 
static int \textbf{ rate\+\_\+ctr\+\_\+timer\+\_\+cb} (struct \textbf{ osmo\+\_\+fd} $\ast$ofd, unsigned int what)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static void $\ast$ \textbf{ tall\+\_\+rate\+\_\+ctr\+\_\+ctx}
\item 
static struct \textbf{ osmo\+\_\+fd} \textbf{ rate\+\_\+ctr\+\_\+timer} = \{ .fd = -\/1 \}
\item 
static uint64\+\_\+t \textbf{ timer\+\_\+ticks}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Counters about events and their event rates. 

As \doxyref{osmo\+\_\+counter}{p.}{structosmo__counter} and \doxyref{Statistics value item}{p.}{group__osmo__stat__item} are concerned only with a single given value that may be increased/decreased, or the difference to one given previous value, this module adds some support for keeping long term information about a given event rate.

A \doxyref{Rate counters}{p.}{group__rate__ctr} keeps information on the amount of events per second, per minute, per hour and per day.

\doxyref{Rate counters}{p.}{group__rate__ctr} come in groups\+: An application describes a group of counters with their names and identities once in a (typically const) \doxyref{rate\+\_\+ctr\+\_\+group\+\_\+desc}{p.}{structrate__ctr__group__desc}.

As objects (such as e.\+g. a subscriber or a PDP context) are allocated dynamically at runtime, the application calls \doxyref{rate\+\_\+ctr\+\_\+group\+\_\+alloc}{p.}{group__rate__ctr_ga108907e64481db1455cb1fca5374b659} with a refernce to the \doxyref{rate\+\_\+ctr\+\_\+group\+\_\+desc}{p.}{structrate__ctr__group__desc}, which causes the library to allocate one set of rate\+\_\+ctr\+: One for each in the group.

The application then uses functions like \doxyref{rate\+\_\+ctr\+\_\+add}{p.}{group__rate__ctr_gada3668404ea1bd57e2aaab8287bc16b6} or \doxyref{rate\+\_\+ctr\+\_\+inc}{p.}{group__rate__ctr_ga8f2e881dafe07d4fbdec1027394991eb} to increment the value as certain events (e.\+g. location update) happens.

The library internally keeps a timer once per second which iterates over all registered counters and which updates the per-\/second, per-\/minute, per-\/hour and per-\/day averages based on the current value.

The counters can be reported using \doxyref{Statistics reporting}{p.}{group__stats} or by VTY introspection, as well as by any application-\/specific code accessing the \doxyref{rate\+\_\+ctr\+::intv}{p.}{structrate__ctr_ab24986d08ab612eed00102f446a7764b} array directly. 

\doxysubsection{Macro Definition Documentation}
\mbox{\label{group__rate__ctr_ga85def00abef0c8c8bbdf23d735b6cee5}} 
\index{Rate counters@{Rate counters}!RATE\_CTR\_INTV\_NUM@{RATE\_CTR\_INTV\_NUM}}
\index{RATE\_CTR\_INTV\_NUM@{RATE\_CTR\_INTV\_NUM}!Rate counters@{Rate counters}}
\doxysubsubsection{RATE\_CTR\_INTV\_NUM}
{\footnotesize\ttfamily \#define RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+NUM~4}



Number of rate counter intervals. 



\doxysubsection{Typedef Documentation}
\mbox{\label{group__rate__ctr_ga6866d0e48674968700a4e0b180d920ec}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_handler\_t@{rate\_ctr\_group\_handler\_t}}
\index{rate\_ctr\_group\_handler\_t@{rate\_ctr\_group\_handler\_t}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_handler\_t}
{\footnotesize\ttfamily typedef int($\ast$ rate\+\_\+ctr\+\_\+group\+\_\+handler\+\_\+t) (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$, void $\ast$)}

\mbox{\label{group__rate__ctr_ga8e56c2c4dfd115cc0dce5ece64358134}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_handler\_t@{rate\_ctr\_handler\_t}}
\index{rate\_ctr\_handler\_t@{rate\_ctr\_handler\_t}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_handler\_t}
{\footnotesize\ttfamily typedef int($\ast$ rate\+\_\+ctr\+\_\+handler\+\_\+t) (struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$, struct \textbf{ rate\+\_\+ctr} $\ast$, const struct \textbf{ rate\+\_\+ctr\+\_\+desc} $\ast$, void $\ast$)}



\doxysubsection{Enumeration Type Documentation}
\mbox{\label{group__rate__ctr_ga206bdcbeb51642012c2e45d8f058a9f0}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_intv@{rate\_ctr\_intv}}
\index{rate\_ctr\_intv@{rate\_ctr\_intv}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_intv}
{\footnotesize\ttfamily enum \textbf{ rate\+\_\+ctr\+\_\+intv}}



Rate counter interval. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{RATE\_CTR\_INTV\_SEC@{RATE\_CTR\_INTV\_SEC}!Rate counters@{Rate counters}}\index{Rate counters@{Rate counters}!RATE\_CTR\_INTV\_SEC@{RATE\_CTR\_INTV\_SEC}}}\mbox{\label{group__rate__ctr_gga206bdcbeb51642012c2e45d8f058a9f0a6b6b79abab6c1a040df680ab5449f9df}} 
RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+SEC&last second \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{RATE\_CTR\_INTV\_MIN@{RATE\_CTR\_INTV\_MIN}!Rate counters@{Rate counters}}\index{Rate counters@{Rate counters}!RATE\_CTR\_INTV\_MIN@{RATE\_CTR\_INTV\_MIN}}}\mbox{\label{group__rate__ctr_gga206bdcbeb51642012c2e45d8f058a9f0aad41f28c9d50eb22834cf166befb415c}} 
RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+MIN&last minute \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{RATE\_CTR\_INTV\_HOUR@{RATE\_CTR\_INTV\_HOUR}!Rate counters@{Rate counters}}\index{Rate counters@{Rate counters}!RATE\_CTR\_INTV\_HOUR@{RATE\_CTR\_INTV\_HOUR}}}\mbox{\label{group__rate__ctr_gga206bdcbeb51642012c2e45d8f058a9f0ad4ea3a8a9bc17930d092e508cb72cdf2}} 
RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+HOUR&last hour \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{RATE\_CTR\_INTV\_DAY@{RATE\_CTR\_INTV\_DAY}!Rate counters@{Rate counters}}\index{Rate counters@{Rate counters}!RATE\_CTR\_INTV\_DAY@{RATE\_CTR\_INTV\_DAY}}}\mbox{\label{group__rate__ctr_gga206bdcbeb51642012c2e45d8f058a9f0a1afdc7f2127e33125916f7de9c9eae32}} 
RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+DAY&last day \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{group__rate__ctr_ga079b465bb26f59e060c8108b81284034}} 
\index{Rate counters@{Rate counters}!interval\_expired@{interval\_expired}}
\index{interval\_expired@{interval\_expired}!Rate counters@{Rate counters}}
\doxysubsubsection{interval\_expired()}
{\footnotesize\ttfamily static void interval\+\_\+expired (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr} $\ast$}]{ctr,  }\item[{enum \textbf{ rate\+\_\+ctr\+\_\+intv}}]{intv }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ current}, \textbf{ intv}, \textbf{ rate\+\_\+ctr\+\_\+per\+\_\+intv\+::last}, and \textbf{ rate\+\_\+ctr\+\_\+per\+\_\+intv\+::rate}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+intv()}.

\mbox{\label{group__rate__ctr_gac8fcdb2fb5acb5fa9b4144f7858a6f7b}} 
\index{Rate counters@{Rate counters}!LLIST\_HEAD@{LLIST\_HEAD}}
\index{LLIST\_HEAD@{LLIST\_HEAD}!Rate counters@{Rate counters}}
\doxysubsubsection{LLIST\_HEAD()}
{\footnotesize\ttfamily static LLIST\+\_\+\+HEAD (\begin{DoxyParamCaption}\item[{rate\+\_\+ctr\+\_\+groups}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}

\mbox{\label{group__rate__ctr_gac3403aeac127acce2366d638809a5d61}} 
\index{Rate counters@{Rate counters}!mangle\_identifier\_ifneeded@{mangle\_identifier\_ifneeded}}
\index{mangle\_identifier\_ifneeded@{mangle\_identifier\_ifneeded}!Rate counters@{Rate counters}}
\doxysubsubsection{mangle\_identifier\_ifneeded()}
{\footnotesize\ttfamily static char $\ast$ mangle\+\_\+identifier\+\_\+ifneeded (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{const char $\ast$}]{in }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ DLGLOBAL}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGP}, and \textbf{ OSMO\+\_\+\+ASSERT}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+\_\+mangle()}.

\mbox{\label{group__rate__ctr_gada3668404ea1bd57e2aaab8287bc16b6}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_add@{rate\_ctr\_add}}
\index{rate\_ctr\_add@{rate\_ctr\_add}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_add()}
{\footnotesize\ttfamily void rate\+\_\+ctr\+\_\+add (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr} $\ast$}]{ctr,  }\item[{int}]{inc }\end{DoxyParamCaption})}



Increment the counter by {\itshape inc}. 

Add a number to the counter.


\begin{DoxyParams}{Parameters}
{\em ctr} & \doxyref{Rate counters}{p.}{group__rate__ctr} to increment \\
\hline
{\em inc} & quantity to increment {\itshape ctr} by \\
\hline
\end{DoxyParams}


References \textbf{ current}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+add2()}, and \textbf{ rate\+\_\+ctr\+\_\+inc()}.

\mbox{\label{group__rate__ctr_ga053d7640f3b442c96e493c113190629b}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_add2@{rate\_ctr\_add2}}
\index{rate\_ctr\_add2@{rate\_ctr\_add2}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_add2()}
{\footnotesize\ttfamily static void rate\+\_\+ctr\+\_\+add2 (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{ctrg,  }\item[{unsigned int}]{idx,  }\item[{int}]{inc }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Increment the counter by {\itshape inc}. 


\begin{DoxyParams}{Parameters}
{\em ctrg} & \doxyref{rate\+\_\+ctr\+\_\+group}{p.}{structrate__ctr__group} of counter \\
\hline
{\em idx} & index into {\itshape ctrg} counter group \\
\hline
{\em inc} & quantity to increment {\itshape ctr} by \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+add()}, and \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+get\+\_\+ctr()}.

\mbox{\label{group__rate__ctr_gaabc955b67c53b2d239bd6d6193cbf6c8}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_difference@{rate\_ctr\_difference}}
\index{rate\_ctr\_difference@{rate\_ctr\_difference}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_difference()}
{\footnotesize\ttfamily int64\+\_\+t rate\+\_\+ctr\+\_\+difference (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr} $\ast$}]{ctr }\end{DoxyParamCaption})}



Return the counter difference since the last call to this function. 



References \textbf{ current}, and \textbf{ previous}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+handler()}.

\mbox{\label{group__rate__ctr_gacded8db7ae1f6b7bd5b837680df23df7}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_for\_each\_counter@{rate\_ctr\_for\_each\_counter}}
\index{rate\_ctr\_for\_each\_counter@{rate\_ctr\_for\_each\_counter}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_for\_each\_counter()}
{\footnotesize\ttfamily int rate\+\_\+ctr\+\_\+for\+\_\+each\+\_\+counter (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{ctrg,  }\item[{\textbf{ rate\+\_\+ctr\+\_\+handler\+\_\+t}}]{handle\+\_\+counter,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Iterate over each counter in group and call function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctrg} & counter group over which to iterate \\
\hline
\mbox{\texttt{ in}}  & {\em handle\+\_\+counter} & function pointer \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Data to hand transparently to \textbf{ handle\+\_\+counter()} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative otherwise 
\end{DoxyReturn}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::ctr\+\_\+desc}, \textbf{ data}, \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ handle\+\_\+counter()}, and \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::num\+\_\+ctr}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+handler()}.

\mbox{\label{group__rate__ctr_ga7481b6560512295ed28806e2fe916c09}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_for\_each\_group@{rate\_ctr\_for\_each\_group}}
\index{rate\_ctr\_for\_each\_group@{rate\_ctr\_for\_each\_group}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_for\_each\_group()}
{\footnotesize\ttfamily int rate\+\_\+ctr\+\_\+for\+\_\+each\+\_\+group (\begin{DoxyParamCaption}\item[{\textbf{ rate\+\_\+ctr\+\_\+group\+\_\+handler\+\_\+t}}]{handle\+\_\+group,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Iterate over all counter groups. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em handle\+\_\+group} & function pointer of callback function \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Data to hand transparently to handle\+\_\+group() \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative otherwise 
\end{DoxyReturn}


References \textbf{ data}, \textbf{ list}, and \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}.



Referenced by \textbf{ osmo\+\_\+stats\+\_\+report()}.

\mbox{\label{group__rate__ctr_ga13a0c06042c667f41dc56ee02325c077}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_get\_by\_name@{rate\_ctr\_get\_by\_name}}
\index{rate\_ctr\_get\_by\_name@{rate\_ctr\_get\_by\_name}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_get\_by\_name()}
{\footnotesize\ttfamily const struct \textbf{ rate\+\_\+ctr} $\ast$ rate\+\_\+ctr\+\_\+get\+\_\+by\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{ctrg,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Search for counter based on group + name. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctrg} & pointer to \doxyref{rate\+\_\+ctr\+\_\+group}{p.}{structrate__ctr__group} \\
\hline
\mbox{\texttt{ in}}  & {\em name} & name of counter inside group \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxyref{Rate counters}{p.}{group__rate__ctr} or NULL in case of error 
\end{DoxyReturn}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::ctr\+\_\+desc}, \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ name}, \textbf{ rate\+\_\+ctr\+\_\+desc\+::name}, and \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::num\+\_\+ctr}.

\mbox{\label{group__rate__ctr_ga8ec85b6a07ce4c18fd9b8b548a4badfe}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_get\_group\_by\_name\_idx@{rate\_ctr\_get\_group\_by\_name\_idx}}
\index{rate\_ctr\_get\_group\_by\_name\_idx@{rate\_ctr\_get\_group\_by\_name\_idx}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_get\_group\_by\_name\_idx()}
{\footnotesize\ttfamily struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ rate\+\_\+ctr\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idx (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name,  }\item[{const unsigned int}]{idx }\end{DoxyParamCaption})}



Search for counter group based on group name and index. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & Name of the counter group you\textquotesingle{}re looking for \\
\hline
\mbox{\texttt{ in}}  & {\em idx} & Index inside the counter group \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxyref{rate\+\_\+ctr\+\_\+group}{p.}{structrate__ctr__group} or NULL in case of error 
\end{DoxyReturn}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::group\+\_\+name\+\_\+prefix}, \textbf{ rate\+\_\+ctr\+\_\+group\+::idx}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, and \textbf{ name}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc()}.

\mbox{\label{group__rate__ctr_ga2995d63535f2a8774fb553b9fef7c060}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_get\_unused\_name\_idx@{rate\_ctr\_get\_unused\_name\_idx}}
\index{rate\_ctr\_get\_unused\_name\_idx@{rate\_ctr\_get\_unused\_name\_idx}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_get\_unused\_name\_idx()}
{\footnotesize\ttfamily static unsigned int rate\+\_\+ctr\+\_\+get\+\_\+unused\+\_\+name\+\_\+idx (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Find an unused index for this rate counter group. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & Name of the counter group \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the largest used index number + 1, or 0 if none exist yet. 
\end{DoxyReturn}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::group\+\_\+name\+\_\+prefix}, \textbf{ rate\+\_\+ctr\+\_\+group\+::idx}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, and \textbf{ name}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc()}.

\mbox{\label{group__rate__ctr_ga108907e64481db1455cb1fca5374b659}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_alloc@{rate\_ctr\_group\_alloc}}
\index{rate\_ctr\_group\_alloc@{rate\_ctr\_group\_alloc}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_alloc()}
{\footnotesize\ttfamily struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$ rate\+\_\+ctr\+\_\+group\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$}]{desc,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})}



Allocate a new group of counters according to description. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & parent talloc context \\
\hline
\mbox{\texttt{ in}}  & {\em desc} & Rate counter group description \\
\hline
\mbox{\texttt{ in}}  & {\em idx} & Index of new counter group \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ DLGLOBAL}, \textbf{ rate\+\_\+ctr\+\_\+group\+::idx}, \textbf{ rate\+\_\+ctr\+\_\+group\+::list}, \textbf{ llist\+\_\+add()}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ rate\+\_\+ctr\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idx()}, \textbf{ rate\+\_\+ctr\+\_\+get\+\_\+unused\+\_\+name\+\_\+idx()}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+\_\+mangle()}, \textbf{ rate\+\_\+ctrl\+\_\+group\+\_\+desc\+\_\+validate()}, and \textbf{ tall\+\_\+rate\+\_\+ctr\+\_\+ctx}.

\mbox{\label{group__rate__ctr_ga901d8e3b5d32175c2c23e217b0561420}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_desc\_mangle@{rate\_ctr\_group\_desc\_mangle}}
\index{rate\_ctr\_group\_desc\_mangle@{rate\_ctr\_group\_desc\_mangle}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_desc\_mangle()}
{\footnotesize\ttfamily static struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$ rate\+\_\+ctr\+\_\+group\+\_\+desc\+\_\+mangle (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$}]{desc }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::class\+\_\+id}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::ctr\+\_\+desc}, \textbf{ rate\+\_\+ctr\+\_\+desc\+::description}, \textbf{ DLGLOBAL}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::group\+\_\+description}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::group\+\_\+name\+\_\+prefix}, \textbf{ if()}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+INFO}, \textbf{ LOGP}, \textbf{ mangle\+\_\+identifier\+\_\+ifneeded()}, \textbf{ name}, \textbf{ rate\+\_\+ctr\+\_\+desc\+::name}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::num\+\_\+ctr}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ rate\+\_\+ctrl\+\_\+group\+\_\+desc\+\_\+validate()}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc()}.

\mbox{\label{group__rate__ctr_ga2b28875fc006413054b17cb80e540edd}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_free@{rate\_ctr\_group\_free}}
\index{rate\_ctr\_group\_free@{rate\_ctr\_group\_free}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_free()}
{\footnotesize\ttfamily void rate\+\_\+ctr\+\_\+group\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{grp }\end{DoxyParamCaption})}



Free the memory for the specified group of counters. 



References \textbf{ rate\+\_\+ctr\+\_\+group\+::list}, \textbf{ llist\+\_\+del()}, and \textbf{ llist\+\_\+empty()}.

\mbox{\label{group__rate__ctr_ga317acaee831407fbff64233258a48734}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_get\_ctr@{rate\_ctr\_group\_get\_ctr}}
\index{rate\_ctr\_group\_get\_ctr@{rate\_ctr\_group\_get\_ctr}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_get\_ctr()}
{\footnotesize\ttfamily struct \textbf{ rate\+\_\+ctr} $\ast$ rate\+\_\+ctr\+\_\+group\+\_\+get\+\_\+ctr (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{grp,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})}



Get rate counter from group, identified by index idx. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em grp} & Rate counter group \\
\hline
\mbox{\texttt{ in}}  & {\em idx} & Index of the counter to retrieve \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
rate counter requested 
\end{DoxyReturn}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+add2()}, and \textbf{ rate\+\_\+ctr\+\_\+inc2()}.

\mbox{\label{group__rate__ctr_ga7f2e58d3d3a1349845924f05489326df}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_intv@{rate\_ctr\_group\_intv}}
\index{rate\_ctr\_group\_intv@{rate\_ctr\_group\_intv}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_intv()}
{\footnotesize\ttfamily static void rate\+\_\+ctr\+\_\+group\+\_\+intv (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{grp }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}, \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ interval\+\_\+expired()}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::num\+\_\+ctr}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+DAY}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+HOUR}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+MIN}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+INTV\+\_\+\+SEC}, and \textbf{ timer\+\_\+ticks}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+timer\+\_\+cb()}.

\mbox{\label{group__rate__ctr_ga55836246eef523c255256cb530a99d64}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_reset@{rate\_ctr\_group\_reset}}
\index{rate\_ctr\_group\_reset@{rate\_ctr\_group\_reset}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_reset()}
{\footnotesize\ttfamily void rate\+\_\+ctr\+\_\+group\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{ctrg }\end{DoxyParamCaption})}



Reset all counters in a group. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctrg} & counter group to reset \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}, \textbf{ rate\+\_\+ctr\+\_\+group\+::desc}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+::num\+\_\+ctr}, and \textbf{ rate\+\_\+ctr\+\_\+reset()}.

\mbox{\label{group__rate__ctr_ga5d551206dbf14b5dd7c465e3d6e6ee8d}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_set\_name@{rate\_ctr\_group\_set\_name}}
\index{rate\_ctr\_group\_set\_name@{rate\_ctr\_group\_set\_name}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_set\_name()}
{\footnotesize\ttfamily void rate\+\_\+ctr\+\_\+group\+\_\+set\+\_\+name (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{grp,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Set a name for the group of counters be used instead of index value at report time. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em grp} & Rate counter group \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Name identifier to assign to the rate counter group \\
\hline
\end{DoxyParams}


References \textbf{ name}, \textbf{ rate\+\_\+ctr\+\_\+group\+::name}, and \textbf{ osmo\+\_\+talloc\+\_\+replace\+\_\+string()}.

\mbox{\label{group__rate__ctr_ga753c11230f62e060d7858817f7b002e0}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_group\_upd\_idx@{rate\_ctr\_group\_upd\_idx}}
\index{rate\_ctr\_group\_upd\_idx@{rate\_ctr\_group\_upd\_idx}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_group\_upd\_idx()}
{\footnotesize\ttfamily static void rate\+\_\+ctr\+\_\+group\+\_\+upd\+\_\+idx (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{grp,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ rate\+\_\+ctr\+\_\+group\+::idx}.

\mbox{\label{group__rate__ctr_ga8f2e881dafe07d4fbdec1027394991eb}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_inc@{rate\_ctr\_inc}}
\index{rate\_ctr\_inc@{rate\_ctr\_inc}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_inc()}
{\footnotesize\ttfamily static void rate\+\_\+ctr\+\_\+inc (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr} $\ast$}]{ctr }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Increment the counter by 1. 


\begin{DoxyParams}{Parameters}
{\em ctr} & \doxyref{Rate counters}{p.}{group__rate__ctr} to increment \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+add()}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+inc2()}.

\mbox{\label{group__rate__ctr_ga1bf97abfab860f29e4b0019c3f5dfddb}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_inc2@{rate\_ctr\_inc2}}
\index{rate\_ctr\_inc2@{rate\_ctr\_inc2}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_inc2()}
{\footnotesize\ttfamily static void rate\+\_\+ctr\+\_\+inc2 (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr\+\_\+group} $\ast$}]{ctrg,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Increment the counter by 1. 


\begin{DoxyParams}{Parameters}
{\em ctrg} & \doxyref{rate\+\_\+ctr\+\_\+group}{p.}{structrate__ctr__group} of counter \\
\hline
{\em idx} & index into {\itshape ctrg} counter group \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+get\+\_\+ctr()}, and \textbf{ rate\+\_\+ctr\+\_\+inc()}.

\mbox{\label{group__rate__ctr_ga9bfe8ec87ccaabd9f1fdddef5f36cbfa}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_init@{rate\_ctr\_init}}
\index{rate\_ctr\_init@{rate\_ctr\_init}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_init()}
{\footnotesize\ttfamily int rate\+\_\+ctr\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{tall\+\_\+ctx }\end{DoxyParamCaption})}



Initialize the counter module. 

Call this once from your application. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em tall\+\_\+ctx} & Talloc context from which \doxyref{rate\+\_\+ctr\+\_\+group}{p.}{structrate__ctr__group} will be allocated \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error 
\end{DoxyReturn}


References \textbf{ DLGLOBAL}, \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ osmo\+\_\+fd\+\_\+is\+\_\+registered()}, \textbf{ osmo\+\_\+timerfd\+\_\+schedule()}, \textbf{ osmo\+\_\+timerfd\+\_\+setup()}, \textbf{ rate\+\_\+ctr\+\_\+timer}, \textbf{ rate\+\_\+ctr\+\_\+timer\+\_\+cb()}, and \textbf{ tall\+\_\+rate\+\_\+ctr\+\_\+ctx}.

\mbox{\label{group__rate__ctr_ga099666d2e04df4d35c73b373b4a3cb5f}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_reset@{rate\_ctr\_reset}}
\index{rate\_ctr\_reset@{rate\_ctr\_reset}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_reset()}
{\footnotesize\ttfamily void rate\+\_\+ctr\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ rate\+\_\+ctr} $\ast$}]{ctr }\end{DoxyParamCaption})}



Reset a rate counter back to zero. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctr} & counter to reset \\
\hline
\end{DoxyParams}


References \textbf{ rate\+\_\+ctr\+\_\+group\+::ctr}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+reset()}.

\mbox{\label{group__rate__ctr_ga42e417495cd1b2bf5bd409af1ca429f9}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_timer\_cb@{rate\_ctr\_timer\_cb}}
\index{rate\_ctr\_timer\_cb@{rate\_ctr\_timer\_cb}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_timer\_cb()}
{\footnotesize\ttfamily static int rate\+\_\+ctr\+\_\+timer\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{ofd,  }\item[{unsigned int}]{what }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ DLGLOBAL}, \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ LOGP}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+FD\+\_\+\+READ}, \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+intv()}, and \textbf{ timer\+\_\+ticks}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+init()}.

\mbox{\label{group__rate__ctr_gaa4194e021daec715f7d17ca92dea258b}} 
\index{Rate counters@{Rate counters}!rate\_ctrl\_group\_desc\_validate@{rate\_ctrl\_group\_desc\_validate}}
\index{rate\_ctrl\_group\_desc\_validate@{rate\_ctrl\_group\_desc\_validate}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctrl\_group\_desc\_validate()}
{\footnotesize\ttfamily static bool rate\+\_\+ctrl\+\_\+group\+\_\+desc\+\_\+validate (\begin{DoxyParamCaption}\item[{const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} $\ast$}]{desc }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ DEBUGP}, \textbf{ DLGLOBAL}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ name}, and \textbf{ osmo\+\_\+identifier\+\_\+valid()}.



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc()}, and \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc\+\_\+mangle()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__rate__ctr_ga323b22b7fea6ff550272c9fa065638b5}} 
\index{Rate counters@{Rate counters}!rate\_ctr\_timer@{rate\_ctr\_timer}}
\index{rate\_ctr\_timer@{rate\_ctr\_timer}!Rate counters@{Rate counters}}
\doxysubsubsection{rate\_ctr\_timer}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+fd} rate\+\_\+ctr\+\_\+timer = \{ .fd = -\/1 \}\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ rate\+\_\+ctr\+\_\+init()}.

\mbox{\label{group__rate__ctr_ga3b69e9b208cadac269976b2c025c06b4}} 
\index{Rate counters@{Rate counters}!tall\_rate\_ctr\_ctx@{tall\_rate\_ctr\_ctx}}
\index{tall\_rate\_ctr\_ctx@{tall\_rate\_ctr\_ctx}!Rate counters@{Rate counters}}
\doxysubsubsection{tall\_rate\_ctr\_ctx}
{\footnotesize\ttfamily void$\ast$ tall\+\_\+rate\+\_\+ctr\+\_\+ctx\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+alloc()}, and \textbf{ rate\+\_\+ctr\+\_\+init()}.

\mbox{\label{group__rate__ctr_gabdf5657b1022ebe1848ae003a19ae943}} 
\index{Rate counters@{Rate counters}!timer\_ticks@{timer\_ticks}}
\index{timer\_ticks@{timer\_ticks}!Rate counters@{Rate counters}}
\doxysubsubsection{timer\_ticks}
{\footnotesize\ttfamily uint64\+\_\+t timer\+\_\+ticks\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+intv()}, and \textbf{ rate\+\_\+ctr\+\_\+timer\+\_\+cb()}.

