\doxysection{src/core/stat\+\_\+item.c File Reference}
\label{stat__item_8c}\index{src/core/stat\_item.c@{src/core/stat\_item.c}}


utility routines for keeping statistical values  


{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/timer.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/stat\+\_\+item.\+h$>$}\newline
{\ttfamily \#include $<$stat\+\_\+item\+\_\+internal.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static \textbf{ LLIST\+\_\+\+HEAD} (osmo\+\_\+stat\+\_\+item\+\_\+groups)
\begin{DoxyCompactList}\small\item\em global list of stat\+\_\+item groups \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+alloc} (void $\ast$ctx, const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc} $\ast$group\+\_\+desc, unsigned int idx)
\begin{DoxyCompactList}\small\item\em Allocate a new group of counters according to description. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+free} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$grp)
\begin{DoxyCompactList}\small\item\em Free the memory for the specified group of stat items. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+get\+\_\+item} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$grp, unsigned int idx)
\begin{DoxyCompactList}\small\item\em Get statistics item from group, identified by index idx. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+set\+\_\+name} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$statg, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Set a name for the statistics item group to be used instead of index value at report time. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+inc} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item, int32\+\_\+t value)
\begin{DoxyCompactList}\small\item\em Increase the stat\+\_\+item to the given value. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+dec} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item, int32\+\_\+t value)
\begin{DoxyCompactList}\small\item\em Descrease the stat\+\_\+item to the given value. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+set} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item, int32\+\_\+t value)
\begin{DoxyCompactList}\small\item\em Set the a given stat\+\_\+item to the given value. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+flush} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item)
\begin{DoxyCompactList}\small\item\em Indicate that a reporting period has elapsed, and prepare the stat item for a new period of collecting min/max/avg. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+init} (void $\ast$tall\+\_\+ctx)
\begin{DoxyCompactList}\small\item\em Initialize the stat item module. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idx} (const char $\ast$\textbf{ name}, const unsigned int idx)
\begin{DoxyCompactList}\small\item\em Search for item group based on group name and index. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idxname} (const char $\ast$group\+\_\+name, const char $\ast$idx\+\_\+name)
\begin{DoxyCompactList}\small\item\em Search for item group based on group name and index\textquotesingle{}s name. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+by\+\_\+name} (const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$statg, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Search for item based on group + item name. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+for\+\_\+each\+\_\+item} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$statg, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+handler\+\_\+t} handle\+\_\+item, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Iterate over all items in group, call user-\/supplied function on each. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+for\+\_\+each\+\_\+group} (\textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+handler\+\_\+t} handle\+\_\+group, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Iterate over all stat\+\_\+item groups in system, call user-\/supplied function on each. \end{DoxyCompactList}\item 
int32\+\_\+t \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+last} (const struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item)
\begin{DoxyCompactList}\small\item\em Get the last (freshest) value. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+reset} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item)
\begin{DoxyCompactList}\small\item\em Remove all values of a stat item. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+reset} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$statg)
\begin{DoxyCompactList}\small\item\em Reset all osmo stat items in a group. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc} $\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+desc} (struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$item)
\begin{DoxyCompactList}\small\item\em Return the description for an \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static void $\ast$ \textbf{ tall\+\_\+stat\+\_\+item\+\_\+ctx}
\begin{DoxyCompactList}\small\item\em talloc context from which we allocate \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
utility routines for keeping statistical values 

