\doxysection{Statistics value item}
\label{group__osmo__stat__item}\index{Statistics value item@{Statistics value item}}


This \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} module adds instrumentation capabilities to gather measurement and statistical values in a similar fashion to what we have as osmo\+\_\+counter\+\_\+group.  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ stat\+\_\+item.\+h}
\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc}
\begin{DoxyCompactList}\small\item\em Statistics item description. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc}
\begin{DoxyCompactList}\small\item\em Description of a statistics item group. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group}
\begin{DoxyCompactList}\small\item\em One instance of a counter group class. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period}
\item 
struct \textbf{ osmo\+\_\+stat\+\_\+item}
\begin{DoxyCompactList}\small\item\em data we keep for each actual item \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ OSMO\+\_\+\+STAT\+\_\+\+ITEM\+\_\+\+NOVALUE\+\_\+\+ID}~0
\item 
\#define \textbf{ OSMO\+\_\+\+STAT\+\_\+\+ITEM\+\_\+\+NO\+\_\+\+UNIT}~NULL
\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+handler\+\_\+t}) (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$, struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$, void $\ast$)
\item 
typedef int($\ast$ \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+handler\+\_\+t}) (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$, void $\ast$)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\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 
static void \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+udp\+\_\+idx} (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$grp, unsigned int idx)
\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\+\_\+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 
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 
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 
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\+\_\+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\+\_\+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 
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}\item 
static \textbf{ LLIST\+\_\+\+HEAD} (osmo\+\_\+stat\+\_\+item\+\_\+groups)
\begin{DoxyCompactList}\small\item\em global list of stat\+\_\+item groups \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}
This \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} module adds instrumentation capabilities to gather measurement and statistical values in a similar fashion to what we have as osmo\+\_\+counter\+\_\+group. 

As opposed to counters, \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} do not increment but consist of a configurable-\/sized FIFO, which can store not only the current (most recent) value, but also historic values.

The only supported value type is an int32\+\_\+t.

Getting values from \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} is usually done at a high level through the stats API (stats.\+c). It uses item-\/$>$stats\+\_\+next\+\_\+id to store what has been sent to all enabled reporters. It is also possible to read from \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} directly, without modifying its state, by storing next\+\_\+id outside of \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item}.

Each value stored in the FIFO of an \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item} has an associated value\+\_\+id. The value\+\_\+id is increased with each value, so (until the counter wraps) more recent values will have higher values.

When a new value is set, the oldest value in the FIFO gets silently overwritten. Lost values are skipped when getting values from the item. 

\doxysubsection{Macro Definition Documentation}
\mbox{\label{group__osmo__stat__item_ga5302c4affa8c6f44c37d58782abc1cc2}} 
\index{Statistics value item@{Statistics value item}!OSMO\_STAT\_ITEM\_NO\_UNIT@{OSMO\_STAT\_ITEM\_NO\_UNIT}}
\index{OSMO\_STAT\_ITEM\_NO\_UNIT@{OSMO\_STAT\_ITEM\_NO\_UNIT}!Statistics value item@{Statistics value item}}
\doxysubsubsection{OSMO\_STAT\_ITEM\_NO\_UNIT}
{\footnotesize\ttfamily \#define OSMO\+\_\+\+STAT\+\_\+\+ITEM\+\_\+\+NO\+\_\+\+UNIT~NULL}

\mbox{\label{group__osmo__stat__item_gaf6f3007c03bc8114990c8b31bd030820}} 
\index{Statistics value item@{Statistics value item}!OSMO\_STAT\_ITEM\_NOVALUE\_ID@{OSMO\_STAT\_ITEM\_NOVALUE\_ID}}
\index{OSMO\_STAT\_ITEM\_NOVALUE\_ID@{OSMO\_STAT\_ITEM\_NOVALUE\_ID}!Statistics value item@{Statistics value item}}
\doxysubsubsection{OSMO\_STAT\_ITEM\_NOVALUE\_ID}
{\footnotesize\ttfamily \#define OSMO\+\_\+\+STAT\+\_\+\+ITEM\+\_\+\+NOVALUE\+\_\+\+ID~0}



\doxysubsection{Typedef Documentation}
\mbox{\label{group__osmo__stat__item_gab6f48cb83fad5c21428d2dbb02af048a}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_handler\_t@{osmo\_stat\_item\_group\_handler\_t}}
\index{osmo\_stat\_item\_group\_handler\_t@{osmo\_stat\_item\_group\_handler\_t}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_handler\_t}
{\footnotesize\ttfamily typedef int($\ast$ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+handler\+\_\+t) (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$, void $\ast$)}

\mbox{\label{group__osmo__stat__item_gabebffafb8b666e2a52c0c4784eeabfbf}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_handler\_t@{osmo\_stat\_item\_handler\_t}}
\index{osmo\_stat\_item\_handler\_t@{osmo\_stat\_item\_handler\_t}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_handler\_t}
{\footnotesize\ttfamily typedef int($\ast$ osmo\+\_\+stat\+\_\+item\+\_\+handler\+\_\+t) (struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$, struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$, void $\ast$)}



\doxysubsection{Function Documentation}
\mbox{\label{group__osmo__stat__item_ga918922f0159b002fd13bf021ec3bc294}} 
\index{Statistics value item@{Statistics value item}!LLIST\_HEAD@{LLIST\_HEAD}}
\index{LLIST\_HEAD@{LLIST\_HEAD}!Statistics value item@{Statistics value item}}
\doxysubsubsection{LLIST\_HEAD()}
{\footnotesize\ttfamily static LLIST\+\_\+\+HEAD (\begin{DoxyParamCaption}\item[{osmo\+\_\+stat\+\_\+item\+\_\+groups}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



global list of stat\+\_\+item groups 

\mbox{\label{group__osmo__stat__item_ga462b34eb55a9432b335f5e2cc32a5498}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_dec@{osmo\_stat\_item\_dec}}
\index{osmo\_stat\_item\_dec@{osmo\_stat\_item\_dec}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_dec()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+dec (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item,  }\item[{int32\+\_\+t}]{value }\end{DoxyParamCaption})}



Descrease the stat\+\_\+item to the given value. 

This function adds a new value for the given stat\+\_\+item at the end of the FIFO. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em item} & The stat\+\_\+item whose {\itshape value} we want to set \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The numeric value we want to store at end of FIFO \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+set()}, and \textbf{ value}.

\mbox{\label{group__osmo__stat__item_ga312b34dbb43757e505c5c215592c7552}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_flush@{osmo\_stat\_item\_flush}}
\index{osmo\_stat\_item\_flush@{osmo\_stat\_item\_flush}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_flush()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+flush (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item }\end{DoxyParamCaption})}



Indicate that a reporting period has elapsed, and prepare the stat item for a new period of collecting min/max/avg. 


\begin{DoxyParams}{Parameters}
{\em item} & Stat item to flush. \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::max}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::min}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::n}, \textbf{ reported}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::sum}, and \textbf{ value}.



Referenced by \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+handler()}.

\mbox{\label{group__osmo__stat__item_gae1367b44f93a6ea46cbe90a955b06dda}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_for\_each\_group@{osmo\_stat\_item\_for\_each\_group}}
\index{osmo\_stat\_item\_for\_each\_group@{osmo\_stat\_item\_for\_each\_group}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_for\_each\_group()}
{\footnotesize\ttfamily int osmo\+\_\+stat\+\_\+item\+\_\+for\+\_\+each\+\_\+group (\begin{DoxyParamCaption}\item[{\textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+handler\+\_\+t}}]{handle\+\_\+group,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Iterate over all stat\+\_\+item groups in system, call user-\/supplied function on each. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em handle\+\_\+group} & Call-\/back function, aborts if rc $<$ 0 \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Private data handed through to {\itshape handle\+\_\+group} \\
\hline
\end{DoxyParams}


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



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

\mbox{\label{group__osmo__stat__item_ga4b20503c85250536c1fe215aa8f0caac}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_for\_each\_item@{osmo\_stat\_item\_for\_each\_item}}
\index{osmo\_stat\_item\_for\_each\_item@{osmo\_stat\_item\_for\_each\_item}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_for\_each\_item()}
{\footnotesize\ttfamily int osmo\+\_\+stat\+\_\+item\+\_\+for\+\_\+each\+\_\+item (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{statg,  }\item[{\textbf{ osmo\+\_\+stat\+\_\+item\+\_\+handler\+\_\+t}}]{handle\+\_\+item,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Iterate over all items in group, call user-\/supplied function on each. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em statg} & stat\+\_\+item group over whose items to iterate \\
\hline
\mbox{\texttt{ in}}  & {\em handle\+\_\+item} & Call-\/back function, aborts if rc $<$ 0 \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Private data handed through to {\itshape handle\+\_\+item} \\
\hline
\end{DoxyParams}


References \textbf{ data}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::items}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::num\+\_\+items}.



Referenced by \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+handler()}.

\mbox{\label{group__osmo__stat__item_ga088dc4ca88656f25e0a0a6bdfb024bc1}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_get\_by\_name@{osmo\_stat\_item\_get\_by\_name}}
\index{osmo\_stat\_item\_get\_by\_name@{osmo\_stat\_item\_get\_by\_name}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_get\_by\_name()}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+by\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{statg,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Search for item based on group + item name. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em statg} & group in which to search for the item \\
\hline
\mbox{\texttt{ in}}  & {\em name} & name of item to search within {\itshape statg} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to item, if found; NULL otherwise 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::item\+\_\+desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::items}, \textbf{ name}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc\+::name}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::num\+\_\+items}.

\mbox{\label{group__osmo__stat__item_ga2b5922d91fc40c32c41e59dd7f87c9b7}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_get\_desc@{osmo\_stat\_item\_get\_desc}}
\index{osmo\_stat\_item\_get\_desc@{osmo\_stat\_item\_get\_desc}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_get\_desc()}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+desc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item }\end{DoxyParamCaption})}



Return the description for an \doxyref{osmo\+\_\+stat\+\_\+item}{p.}{structosmo__stat__item}. 



References \textbf{ desc}.

\mbox{\label{group__osmo__stat__item_ga59062bfcaa3f804df9ac69bcf52a2fb4}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_get\_group\_by\_name\_idx@{osmo\_stat\_item\_get\_group\_by\_name\_idx}}
\index{osmo\_stat\_item\_get\_group\_by\_name\_idx@{osmo\_stat\_item\_get\_group\_by\_name\_idx}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_get\_group\_by\_name\_idx()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idx (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name,  }\item[{const unsigned int}]{idx }\end{DoxyParamCaption})}



Search for item group based on group name and index. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & Name of stats\+\_\+item\+\_\+group we want to find \\
\hline
\mbox{\texttt{ in}}  & {\em idx} & Index of the group we want to find \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to group, if found; NULL otherwise 
\end{DoxyReturn}


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

\mbox{\label{group__osmo__stat__item_ga49dec12c98ad324d7c255c8a4f9f6437}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_get\_group\_by\_name\_idxname@{osmo\_stat\_item\_get\_group\_by\_name\_idxname}}
\index{osmo\_stat\_item\_get\_group\_by\_name\_idxname@{osmo\_stat\_item\_get\_group\_by\_name\_idxname}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_get\_group\_by\_name\_idxname()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+group\+\_\+by\+\_\+name\+\_\+idxname (\begin{DoxyParamCaption}\item[{const char $\ast$}]{group\+\_\+name,  }\item[{const char $\ast$}]{idx\+\_\+name }\end{DoxyParamCaption})}



Search for item group based on group name and index\textquotesingle{}s name. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em name} & Name of stats\+\_\+item\+\_\+group we want to find. \\
\hline
\mbox{\texttt{ in}}  & {\em idx\+\_\+name} & Index of the group we want to find, by the index\textquotesingle{}s name (osmo\+\_\+stat\+\_\+item\+\_\+group-\/$>$name). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to group, if found; NULL otherwise. 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::group\+\_\+name\+\_\+prefix}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::name}.

\mbox{\label{group__osmo__stat__item_ga595e25b76fdca35c9e2ec5b4e4e4410a}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_get\_last@{osmo\_stat\_item\_get\_last}}
\index{osmo\_stat\_item\_get\_last@{osmo\_stat\_item\_get\_last}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_get\_last()}
{\footnotesize\ttfamily int32\+\_\+t osmo\+\_\+stat\+\_\+item\+\_\+get\+\_\+last (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item }\end{DoxyParamCaption})}



Get the last (freshest) value. 



References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, and \textbf{ value}.

\mbox{\label{group__osmo__stat__item_gaa1a7c1500d64a803883ee7ff12ccf963}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_alloc@{osmo\_stat\_item\_group\_alloc}}
\index{osmo\_stat\_item\_group\_alloc@{osmo\_stat\_item\_group\_alloc}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_alloc()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc} $\ast$}]{group\+\_\+desc,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})}



Allocate a new group of counters according to description. 

Allocate a group of stat items described in {\itshape desc} from talloc context {\itshape ctx}, giving the new group the index {\itshape idx}. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context \\
\hline
\mbox{\texttt{ in}}  & {\em desc} & Statistics item group description \\
\hline
\mbox{\texttt{ in}}  & {\em idx} & Index of new stat item group \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc\+::default\+\_\+value}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::desc}, \textbf{ desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::idx}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::item\+\_\+desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::items}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::list}, \textbf{ llist\+\_\+add()}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::num\+\_\+items}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ tall\+\_\+stat\+\_\+item\+\_\+ctx}.



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

\mbox{\label{group__osmo__stat__item_ga070d81e1291c4f54abfb159cda2b5340}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_free@{osmo\_stat\_item\_group\_free}}
\index{osmo\_stat\_item\_group\_free@{osmo\_stat\_item\_group\_free}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_free()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{statg }\end{DoxyParamCaption})}



Free the memory for the specified group of stat items. 



References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::list}, and \textbf{ llist\+\_\+del()}.



Referenced by \textbf{ osmo\+\_\+stats\+\_\+tcp\+\_\+osmo\+\_\+fd\+\_\+unregister()}.

\mbox{\label{group__osmo__stat__item_gad0553a8db021f131aca944e4200785ec}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_get\_item@{osmo\_stat\_item\_group\_get\_item}}
\index{osmo\_stat\_item\_group\_get\_item@{osmo\_stat\_item\_group\_get\_item}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_get\_item()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+get\+\_\+item (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{grp,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})}



Get statistics item 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{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::items}.



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

\mbox{\label{group__osmo__stat__item_ga9522e7b07091b7ad531a41f07764359f}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_reset@{osmo\_stat\_item\_group\_reset}}
\index{osmo\_stat\_item\_group\_reset@{osmo\_stat\_item\_group\_reset}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_reset()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{statg }\end{DoxyParamCaption})}



Reset all osmo stat items in a group. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em statg} & stat item group to reset \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::items}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc\+::num\+\_\+items}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+reset()}.

\mbox{\label{group__osmo__stat__item_gadf35c36fb3cefaba1a1f9d7daa68bdf4}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_set\_name@{osmo\_stat\_item\_group\_set\_name}}
\index{osmo\_stat\_item\_group\_set\_name@{osmo\_stat\_item\_group\_set\_name}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_set\_name()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+set\+\_\+name (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{statg,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



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


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em statg} & Statistics item group \\
\hline
\mbox{\texttt{ in}}  & {\em name} & Name identifier to assign to the statistics item group \\
\hline
\end{DoxyParams}


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



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

\mbox{\label{group__osmo__stat__item_gad86cf00ee8f70547c5b80159cf7d4678}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_group\_udp\_idx@{osmo\_stat\_item\_group\_udp\_idx}}
\index{osmo\_stat\_item\_group\_udp\_idx@{osmo\_stat\_item\_group\_udp\_idx}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_group\_udp\_idx()}
{\footnotesize\ttfamily static void osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+udp\+\_\+idx (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group} $\ast$}]{grp,  }\item[{unsigned int}]{idx }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+::idx}.

\mbox{\label{group__osmo__stat__item_ga45140f45c0e7e057f83c97ddab5330e6}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_inc@{osmo\_stat\_item\_inc}}
\index{osmo\_stat\_item\_inc@{osmo\_stat\_item\_inc}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_inc()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+inc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item,  }\item[{int32\+\_\+t}]{value }\end{DoxyParamCaption})}



Increase the stat\+\_\+item to the given value. 

This function adds a new value for the given stat\+\_\+item at the end of the FIFO. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em item} & The stat\+\_\+item whose {\itshape value} we want to set \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The numeric value we want to store at end of FIFO \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+set()}, and \textbf{ value}.

\mbox{\label{group__osmo__stat__item_ga9ac290aa2ab34c36fc86bf620adec408}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_init@{osmo\_stat\_item\_init}}
\index{osmo\_stat\_item\_init@{osmo\_stat\_item\_init}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_init()}
{\footnotesize\ttfamily int osmo\+\_\+stat\+\_\+item\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{tall\+\_\+ctx }\end{DoxyParamCaption})}



Initialize the stat item module. 

Call this once from your program. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em tall\+\_\+ctx} & Talloc context from which this module allocates \\
\hline
\end{DoxyParams}


References \textbf{ tall\+\_\+stat\+\_\+item\+\_\+ctx}.

\mbox{\label{group__osmo__stat__item_gad3d919ff9ce0c85a69388252aeb257c9}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_reset@{osmo\_stat\_item\_reset}}
\index{osmo\_stat\_item\_reset@{osmo\_stat\_item\_reset}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_reset()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item }\end{DoxyParamCaption})}



Remove all values of a stat item. 


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


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc\+::default\+\_\+value}, \textbf{ desc}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::max}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::min}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::n}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::sum}, and \textbf{ value}.



Referenced by \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+reset()}.

\mbox{\label{group__osmo__stat__item_gabf7ea5516b1929ca8b8b2d2e51c0f662}} 
\index{Statistics value item@{Statistics value item}!osmo\_stat\_item\_set@{osmo\_stat\_item\_set}}
\index{osmo\_stat\_item\_set@{osmo\_stat\_item\_set}!Statistics value item@{Statistics value item}}
\doxysubsubsection{osmo\_stat\_item\_set()}
{\footnotesize\ttfamily void osmo\+\_\+stat\+\_\+item\+\_\+set (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stat\+\_\+item} $\ast$}]{item,  }\item[{int32\+\_\+t}]{value }\end{DoxyParamCaption})}



Set the a given stat\+\_\+item to the given value. 

This function adds a new value for the given stat\+\_\+item at the end of the FIFO. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em item} & The stat\+\_\+item whose {\itshape value} we want to set \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The numeric value we want to store at end of FIFO \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::last}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::max}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::min}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::n}, \textbf{ OSMO\+\_\+\+MAX}, \textbf{ OSMO\+\_\+\+MIN}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+period\+::sum}, and \textbf{ value}.



Referenced by \textbf{ fill\+\_\+stats()}, \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+dec()}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+inc()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__osmo__stat__item_ga7785ff605fed9985c603bf1a691c97a0}} 
\index{Statistics value item@{Statistics value item}!tall\_stat\_item\_ctx@{tall\_stat\_item\_ctx}}
\index{tall\_stat\_item\_ctx@{tall\_stat\_item\_ctx}!Statistics value item@{Statistics value item}}
\doxysubsubsection{tall\_stat\_item\_ctx}
{\footnotesize\ttfamily void$\ast$ tall\+\_\+stat\+\_\+item\+\_\+ctx\hspace{0.3cm}{\ttfamily [static]}}



talloc context from which we allocate 



Referenced by \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+alloc()}, and \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+init()}.

