libosmocore
0.9.3
Osmocom core library
|
00001 #pragma once 00002 00007 struct osmo_counter { 00008 struct llist_head list; 00009 const char *name; 00010 const char *description; 00011 unsigned long value; 00012 unsigned long previous; 00013 }; 00014 00016 static inline void osmo_counter_inc(struct osmo_counter *ctr) 00017 { 00018 ctr->value++; 00019 } 00020 00022 static inline unsigned long osmo_counter_get(struct osmo_counter *ctr) 00023 { 00024 return ctr->value; 00025 } 00026 00028 static inline void osmo_counter_reset(struct osmo_counter *ctr) 00029 { 00030 ctr->value = 0; 00031 } 00032 00034 struct osmo_counter *osmo_counter_alloc(const char *name); 00035 00039 void osmo_counter_free(struct osmo_counter *ctr); 00040 00045 int osmo_counters_for_each(int (*handle_counter)(struct osmo_counter *, void *), void *data); 00046 00051 struct osmo_counter *osmo_counter_get_by_name(const char *name); 00052 00054 int osmo_counter_difference(struct osmo_counter *ctr);