\doxysection{counter.\+h}
\label{counter_8h_source}\index{include/osmocom/core/counter.h@{include/osmocom/core/counter.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{2 }
\DoxyCodeLine{3 \textcolor{preprocessor}{\#include <osmocom/core/defs.h>}}
\DoxyCodeLine{4 }
\DoxyCodeLine{9 \textcolor{keyword}{struct }osmo\_counter \{}
\DoxyCodeLine{10         \textcolor{keyword}{struct }llist\_head list;           }
\DoxyCodeLine{11         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name;           }
\DoxyCodeLine{12         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *description;     }
\DoxyCodeLine{13         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} value;               }
\DoxyCodeLine{14         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} previous;         }
\DoxyCodeLine{15 \};}
\DoxyCodeLine{16 }
\DoxyCodeLine{19 OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}})}
\DoxyCodeLine{20 static inline \textcolor{keywordtype}{void} osmo\_counter\_dec(struct osmo\_counter *ctr)}
\DoxyCodeLine{21 \{}
\DoxyCodeLine{22         ctr-\/>value-\/-\/;}
\DoxyCodeLine{23 \}}
\DoxyCodeLine{24 }
\DoxyCodeLine{27 OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}})}
\DoxyCodeLine{28 static inline \textcolor{keywordtype}{void} osmo\_counter\_inc(struct osmo\_counter *ctr)}
\DoxyCodeLine{29 \{}
\DoxyCodeLine{30         ctr-\/>value++;}
\DoxyCodeLine{31 \}}
\DoxyCodeLine{32 }
\DoxyCodeLine{34 OSMO\_DEPRECATED\_OUTSIDE(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}})}
\DoxyCodeLine{35 static inline \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} osmo\_counter\_get(struct osmo\_counter *ctr)}
\DoxyCodeLine{36 \{}
\DoxyCodeLine{37         \textcolor{keywordflow}{return} ctr-\/>value;}
\DoxyCodeLine{38 \}}
\DoxyCodeLine{39 }
\DoxyCodeLine{41 OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}})}
\DoxyCodeLine{42 static inline \textcolor{keywordtype}{void} osmo\_counter\_reset(struct osmo\_counter *ctr)}
\DoxyCodeLine{43 \{}
\DoxyCodeLine{44         ctr-\/>value = 0;}
\DoxyCodeLine{45 \}}
\DoxyCodeLine{46 }
\DoxyCodeLine{47 \textcolor{keyword}{struct }osmo\_counter *osmo\_counter\_alloc(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *name)}
\DoxyCodeLine{48         OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}});}
\DoxyCodeLine{49 }
\DoxyCodeLine{50 \textcolor{keywordtype}{void} osmo\_counter\_free(\textcolor{keyword}{struct} osmo\_counter *ctr)}
\DoxyCodeLine{51         OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Implement as osmo\_stat\_item instead"{}});}
\DoxyCodeLine{52 }
\DoxyCodeLine{53 \textcolor{keywordtype}{int} osmo\_counters\_for\_each(\textcolor{keywordtype}{int} (*handle\_counter)(\textcolor{keyword}{struct} osmo\_counter *, \textcolor{keywordtype}{void} *), \textcolor{keywordtype}{void} *data);}
\DoxyCodeLine{54 }
\DoxyCodeLine{55 \textcolor{keywordtype}{int} osmo\_counters\_count(\textcolor{keywordtype}{void});}
\DoxyCodeLine{56 }
\DoxyCodeLine{57 \textcolor{keyword}{struct }osmo\_counter *osmo\_counter\_get\_by\_name(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *name);}
\DoxyCodeLine{58 }
\DoxyCodeLine{59 \textcolor{keywordtype}{int} osmo\_counter\_difference(\textcolor{keyword}{struct} osmo\_counter *ctr);}

\end{DoxyCode}
