\doxysection{src/core/rate\+\_\+ctr.c File Reference}
\label{rate__ctr_8c}\index{src/core/rate\_ctr.c@{src/core/rate\_ctr.c}}
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$stdbool.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$inttypes.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/rate\+\_\+ctr.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\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 
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 
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 
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\+\_\+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 
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 
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 
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)
\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}\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}
