libosmocore  0.9.6.311-c977
Osmocom core library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
statistics.h File Reference

Common routines regarding statistics. More...

Go to the source code of this file.

Data Structures

struct  osmo_counter
 structure representing a single counter More...
 

Functions

static void osmo_counter_dec (struct osmo_counter *ctr)
 Decrement counter. More...
 
static void osmo_counter_inc (struct osmo_counter *ctr)
 Increment counter. More...
 
static unsigned long osmo_counter_get (struct osmo_counter *ctr)
 Get current value of counter. More...
 
static void osmo_counter_reset (struct osmo_counter *ctr)
 Reset current value of counter to 0. More...
 
struct osmo_counterosmo_counter_alloc (const char *name)
 Allocate a new counter. More...
 
void osmo_counter_free (struct osmo_counter *ctr)
 Free the specified counter. More...
 
int osmo_counters_for_each (int(*handle_counter)(struct osmo_counter *, void *), void *data)
 Iterate over all counters. More...
 
struct osmo_counterosmo_counter_get_by_name (const char *name)
 Resolve counter by human-readable name. More...
 
int osmo_counter_difference (struct osmo_counter *ctr)
 Return the counter difference since the last call to this function. More...
 

Detailed Description

Common routines regarding statistics.

Function Documentation

struct osmo_counter* osmo_counter_alloc ( const char *  name)

Allocate a new counter.

References osmo_counter::list, llist_add_tail(), osmo_counter::name, name, and tall_ctr_ctx.

static void osmo_counter_dec ( struct osmo_counter ctr)
inlinestatic

Decrement counter.

References osmo_counter::value.

int osmo_counter_difference ( struct osmo_counter ctr)

Return the counter difference since the last call to this function.

References osmo_counter::previous, and osmo_counter::value.

Referenced by handle_counter().

void osmo_counter_free ( struct osmo_counter ctr)

Free the specified counter.

Parameters
[in]ctrCounter

References osmo_counter::list, and llist_del().

static unsigned long osmo_counter_get ( struct osmo_counter ctr)
inlinestatic

Get current value of counter.

References osmo_counter::value.

struct osmo_counter* osmo_counter_get_by_name ( const char *  name)

Resolve counter by human-readable name.

Parameters
[in]namehuman-readable name of counter
Returns
pointer to counter (osmo_counter) or NULL otherwise

References osmo_counter::list, llist_for_each_entry, and osmo_counter::name.

static void osmo_counter_inc ( struct osmo_counter ctr)
inlinestatic

Increment counter.

References osmo_counter::value.

static void osmo_counter_reset ( struct osmo_counter ctr)
inlinestatic

Reset current value of counter to 0.

References osmo_counter::value.

int osmo_counters_for_each ( int(*)(struct osmo_counter *, void *)  handle_counter,
void *  data 
)

Iterate over all counters.

Parameters
[in]handle_counterCall-back function, aborts if rc < 0
[in]dataPrivate dtata handed through to handle_counter

References handle_counter(), osmo_counter::list, and llist_for_each_entry.

Referenced by osmo_stats_report().