libosmocore 1.9.0.196-9975
Osmocom core library
stat_item.h File Reference
#include <stdint.h>
#include <osmocom/core/defs.h>
#include <osmocom/core/linuxlist.h>

Go to the source code of this file.

Data Structures

struct  osmo_stat_item_desc
 Statistics item description. More...
 
struct  osmo_stat_item_group_desc
 Description of a statistics item group. More...
 
struct  osmo_stat_item_group
 One instance of a counter group class. More...
 

Macros

#define OSMO_STAT_ITEM_NOVALUE_ID   0
 
#define OSMO_STAT_ITEM_NO_UNIT   NULL
 

Typedefs

typedef int(* osmo_stat_item_handler_t) (struct osmo_stat_item_group *, struct osmo_stat_item *, void *)
 
typedef int(* osmo_stat_item_group_handler_t) (struct osmo_stat_item_group *, void *)
 

Functions

struct osmo_stat_item_grouposmo_stat_item_group_alloc (void *ctx, const struct osmo_stat_item_group_desc *group_desc, unsigned int idx)
 Allocate a new group of counters according to description. More...
 
static void osmo_stat_item_group_udp_idx (struct osmo_stat_item_group *grp, unsigned int idx)
 
struct osmo_stat_itemosmo_stat_item_group_get_item (struct osmo_stat_item_group *grp, unsigned int idx)
 Get statistics item from group, identified by index idx. More...
 
void osmo_stat_item_group_set_name (struct osmo_stat_item_group *statg, const char *name)
 Set a name for the statistics item group to be used instead of index value at report time. More...
 
void osmo_stat_item_group_free (struct osmo_stat_item_group *grp)
 Free the memory for the specified group of stat items. More...
 
void osmo_stat_item_inc (struct osmo_stat_item *item, int32_t value)
 Increase the stat_item to the given value. More...
 
void osmo_stat_item_dec (struct osmo_stat_item *item, int32_t value)
 Descrease the stat_item to the given value. More...
 
void osmo_stat_item_set (struct osmo_stat_item *item, int32_t value)
 Set the a given stat_item to the given value. More...
 
int osmo_stat_item_init (void *tall_ctx)
 Initialize the stat item module. More...
 
struct osmo_stat_item_grouposmo_stat_item_get_group_by_name_idx (const char *name, const unsigned int idx)
 Search for item group based on group name and index. More...
 
struct osmo_stat_item_grouposmo_stat_item_get_group_by_name_idxname (const char *group_name, const char *idx_name)
 Search for item group based on group name and index's name. More...
 
const struct osmo_stat_itemosmo_stat_item_get_by_name (const struct osmo_stat_item_group *statg, const char *name)
 Search for item based on group + item name. More...
 
int32_t osmo_stat_item_get_last (const struct osmo_stat_item *item)
 Get the last (freshest) value. More...
 
void osmo_stat_item_flush (struct osmo_stat_item *item)
 Indicate that a reporting period has elapsed, and prepare the stat item for a new period of collecting min/max/avg. More...
 
int osmo_stat_item_for_each_item (struct osmo_stat_item_group *statg, osmo_stat_item_handler_t handle_item, void *data)
 Iterate over all items in group, call user-supplied function on each. More...
 
int osmo_stat_item_for_each_group (osmo_stat_item_group_handler_t handle_group, void *data)
 Iterate over all stat_item groups in system, call user-supplied function on each. More...
 
void osmo_stat_item_reset (struct osmo_stat_item *item)
 Remove all values of a stat item. More...
 
void osmo_stat_item_group_reset (struct osmo_stat_item_group *statg)
 Reset all osmo stat items in a group. More...
 
const struct osmo_stat_item_descosmo_stat_item_get_desc (struct osmo_stat_item *item)
 Return the description for an osmo_stat_item. More...