libosmocore 0.3.6
Osmocom core library
Rate counters

Data Structures

struct  rate_ctr_per_intv
 data we keep for each of the intervals More...
struct  rate_ctr
 data we keep for each actual value More...
struct  rate_ctr_desc
 rate counter description More...
struct  rate_ctr_group_desc
 description of a rate counter group More...
struct  rate_ctr_group
 One instance of a counter group class. More...

Files

file  rate_ctr.h
file  rate_ctr.c

Enumerations

enum  rate_ctr_intv { RATE_CTR_INTV_SEC, RATE_CTR_INTV_MIN, RATE_CTR_INTV_HOUR, RATE_CTR_INTV_DAY }
 Rate counter interval. More...

Functions

struct rate_ctr_grouprate_ctr_group_alloc (void *ctx, const struct rate_ctr_group_desc *desc, unsigned int idx)
 Allocate a new group of counters according to description.
void rate_ctr_group_free (struct rate_ctr_group *grp)
 Free the memory for the specified group of counters.
void rate_ctr_add (struct rate_ctr *ctr, int inc)
 Add a number to the counter.
static void rate_ctr_inc (struct rate_ctr *ctr)
 Increment the counter by 1.
int rate_ctr_init (void *tall_ctx)
 Initialize the counter module.
struct rate_ctr_grouprate_ctr_get_group_by_name_idx (const char *name, const unsigned int idx)
 Search for counter group based on group name and index.
struct rate_ctrrate_ctr_get_by_name (const struct rate_ctr_group *ctrg, const char *name)
 Search for counter group based on group name.
static LLIST_HEAD (rate_ctr_groups)
static void interval_expired (struct rate_ctr *ctr, enum rate_ctr_intv intv)
static void rate_ctr_group_intv (struct rate_ctr_group *grp)
static void rate_ctr_timer_cb (void *data)

Variables

uint64_t rate_ctr_per_intv::rate
 counter rate
struct rate_ctr_per_intv rate_ctr::intv [RATE_CTR_INTV_NUM]
 per-interval data
const char * rate_ctr_desc::description
 description of the counter
const char * rate_ctr_group_desc::group_description
 The human-readable description of the group.
const unsigned int rate_ctr_group_desc::num_ctr
 The number of counters in this group.
struct rate_ctr_descrate_ctr_group_desc::ctr_desc
 Pointer to array of counter names.
struct rate_ctr_group_descrate_ctr_group::desc
 Pointer to the counter group class.
unsigned int rate_ctr_group::idx
 The index of this ctr_group within its class.
struct rate_ctr rate_ctr_group::ctr [0]
 Actual counter structures below.
static void * tall_rate_ctr_ctx
static struct osmo_timer_list rate_ctr_timer
static uint64_t timer_ticks

Enumeration Type Documentation

Rate counter interval.

Enumerator:
RATE_CTR_INTV_SEC 

last second

RATE_CTR_INTV_MIN 

last minute

RATE_CTR_INTV_HOUR 

last hour

RATE_CTR_INTV_DAY 

last day


Function Documentation

struct rate_ctr_group * rate_ctr_group_alloc ( void *  ctx,
const struct rate_ctr_group_desc desc,
unsigned int  idx 
) [read]

Allocate a new group of counters according to description.

Parameters:
[in]ctxtalloc context
[in]descRate counter group description
[in]idxIndex of new counter group

References rate_ctr_group::desc, rate_ctr_group::idx, and rate_ctr_group::list.