Loading...
Searching...
No Matches
stats.c File Reference
Statistics reporting
`#include "config.h"`
`#include <osmocom/core/byteswap.h>`
`#include <osmocom/core/stats.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <stdint.h>`
`#include <errno.h>`
`#include <stdio.h>`
`#include <sys/types.h>`
`#include <inttypes.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/rate_ctr.h>`
`#include <osmocom/core/stat_item.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/core/counter.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/core/stats_tcp.h>`
`#include <stat_item_internal.h>`

## Macros

#define | TRACE(probe)
#define | TRACE_ENABLED(probe)
#define | STATS_DEFAULT_INTERVAL 5 /* secs */
#define | STATS_DEFAULT_BUFLEN 256

## Functions

| LLIST_HEAD (osmo_stats_reporter_list)
static int | osmo_stats_reporter_log_send_counter (struct osmo_stats_reporter *srep, const struct rate_ctr_group *ctrg, const struct rate_ctr_desc *desc, int64_t value, int64_t delta)
static int | osmo_stats_reporter_log_send_item (struct osmo_stats_reporter *srep, const struct osmo_stat_item_group *statg, const struct osmo_stat_item_desc *desc, int64_t value)
static int | update_srep_config (struct osmo_stats_reporter *srep)
static int | osmo_stats_timer_cb (struct osmo_fd *ofd, unsigned int what)
static int | start_timer (void)
struct osmo_stats_reporter * | osmo_stats_reporter_alloc (enum osmo_stats_reporter_type type, const char *name)
void | osmo_stats_reporter_free (struct osmo_stats_reporter *srep)
| Destroy a given stats_reporter.
void | osmo_stats_init (void *ctx)
| Initialize the stats reporting module; call this once in your program.
struct osmo_stats_reporter * | osmo_stats_reporter_find (enum osmo_stats_reporter_type type, const char *name)
| Find a stats_reporter of given type and name.
int | osmo_stats_reporter_set_max_class (struct osmo_stats_reporter *srep, enum osmo_stats_class class_id)
int | osmo_stats_set_interval (int interval)
| Set the reporting interval (common for all reporters).
int | osmo_stats_reporter_set_flush_period (struct osmo_stats_reporter *srep, unsigned int period)
| Set the regular flush period for a given stats_reporter.
int | osmo_stats_reporter_set_name_prefix (struct osmo_stats_reporter *srep, const char *prefix)
| Set the name prefix of a given stats_reporter.
int | osmo_stats_reporter_enable (struct osmo_stats_reporter *srep)
| Enable the given stats_reporter.
int | osmo_stats_reporter_disable (struct osmo_stats_reporter *srep)
| Disable the given stats_reporter.
struct osmo_stats_reporter * | osmo_stats_reporter_create_log (const char *name)
| Create a stats_reporter that logs via libosmocore logging.
static int | osmo_stats_reporter_log_send (struct osmo_stats_reporter *srep, const char *type, const char *name1, unsigned int index1, const char *name2, int value, const char *unit)
static int | osmo_stats_reporter_check_config (struct osmo_stats_reporter *srep, unsigned int index, int class_id)
static int | osmo_stats_reporter_send_counter (struct osmo_stats_reporter *srep, const struct rate_ctr_group *ctrg, const struct rate_ctr_desc *desc, int64_t value, int64_t delta)
static int | rate_ctr_handler (struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *sctx_)
static int | rate_ctr_group_handler (struct rate_ctr_group *ctrg, void *sctx_)
static int | osmo_stats_reporter_send_item (struct osmo_stats_reporter *srep, const struct osmo_stat_item_group *statg, const struct osmo_stat_item_desc *desc, int32_t value)
static int | osmo_stat_item_handler (struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_)
static int | osmo_stat_item_group_handler (struct osmo_stat_item_group *statg, void *sctx_)
static int | handle_counter (struct osmo_counter *counter, void *sctx_)
static void | flush_all_reporters (void)
int | osmo_stats_report (void)

## Variables

static void * | osmo_stats_ctx = NULL
static int | is_initialised = 0
static struct osmo_stats_config | s_stats_config
struct osmo_stats_config * | osmo_stats_config = &s_stats_config
static struct osmo_fd | osmo_stats_timer = { .fd = -1 }

## Function Documentation

## osmo_stat_item_group_handler()

int osmo_stat_item_group_handler | ( | struct osmo_stat_item_group * | statg,
|  | void * | sctx_ )

static

References osmo_stat_item_for_each_item().

## osmo_stat_item_handler()

int osmo_stat_item_handler | ( | struct osmo_stat_item_group * | statg,
|  | struct osmo_stat_item * | item,
|  | void * | sctx_ )

static

References osmo_stat_item_group_desc::class_id, osmo_stat_item::desc, osmo_stat_item_group::desc, osmo_stats_reporter::force_single_flush, osmo_stat_item_group::idx, osmo_stats_reporter::list, llist_for_each_entry, osmo_stat_item_period::max, osmo_stat_item_flush(), osmo_stats_reporter_check_config(), osmo_stats_reporter_list, osmo_stats_reporter_send_item(), osmo_stat_item::reported, osmo_stats_reporter::running, and osmo_stat_item::value.