Loading...
Searching...
No Matches
rate_ctr.h File Reference
Rate counters
`#include <stdint.h>`
`#include <osmocom/core/linuxlist.h>`

Go to the source code of this file.

## 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...

## Macros

#define | RATE_CTR_INTV_NUM 4
| Number of rate counter intervals.

## Typedefs

typedef int(* | rate_ctr_handler_t) (struct rate_ctr_group *, struct rate_ctr *, const struct rate_ctr_desc *, void *)
typedef int(* | rate_ctr_group_handler_t) (struct rate_ctr_group *, void *)

## 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_group * | rate_ctr_group_alloc (void *ctx, const struct rate_ctr_group_desc *desc, unsigned int idx)
| Allocate a new group of counters according to description.
static void | rate_ctr_group_upd_idx (struct rate_ctr_group *grp, unsigned int idx)
void | rate_ctr_group_set_name (struct rate_ctr_group *grp, const char *name)
| Set a name for the group of counters be used instead of index value at report time.
struct rate_ctr * | rate_ctr_group_get_ctr (struct rate_ctr_group *grp, unsigned int idx)
| Get rate counter from group, identified by index idx.
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)
| Increment the counter by inc.
static void | rate_ctr_add2 (struct rate_ctr_group *ctrg, unsigned int idx, int inc)
| Increment the counter by inc.
static void | rate_ctr_inc (struct rate_ctr *ctr)
| Increment the counter by 1.
static void | rate_ctr_inc2 (struct rate_ctr_group *ctrg, unsigned int idx)
| Increment the counter by 1.
int64_t | rate_ctr_difference (struct rate_ctr *ctr)
| Return the counter difference since the last call to this function.
int | rate_ctr_init (void *tall_ctx)
| Initialize the counter module.
struct rate_ctr_group * | rate_ctr_get_group_by_name_idx (const char *name, const unsigned int idx)
| Search for counter group based on group name and index.
const struct rate_ctr * | rate_ctr_get_by_name (const struct rate_ctr_group *ctrg, const char *name)
| Search for counter based on group + name.
int | rate_ctr_for_each_counter (struct rate_ctr_group *ctrg, rate_ctr_handler_t handle_counter, void *data)
| Iterate over each counter in group and call function.
int | rate_ctr_for_each_group (rate_ctr_group_handler_t handle_group, void *data)
| Iterate over all counter groups.
void | rate_ctr_reset (struct rate_ctr *ctr)
| Reset a rate counter back to zero.
void | rate_ctr_group_reset (struct rate_ctr_group *ctrg)
| Reset all counters in a group.