libosmocore 1.13.1.1-afb4 Osmocom core library

Files | Data Structures | Macros | Enumerations | Functions | Variables
Statistics reporting

This module implements periodic reporting of statistics / counters. More...

## Files
file | stats.h
file | stats.c
file | stats_statsd.c
file | stats_tcp.c

## Data Structures
struct | osmo_stats_reporter
| One statistics reporter instance. More...
struct | osmo_stats_config

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

## Enumerations
enum | osmo_stats_class { OSMO_STATS_CLASS_UNKNOWN , OSMO_STATS_CLASS_GLOBAL , OSMO_STATS_CLASS_PEER , OSMO_STATS_CLASS_SUBSCRIBER }
| Statistics Class definitions. More...
enum | osmo_stats_reporter_type { OSMO_STATS_REPORTER_LOG , OSMO_STATS_REPORTER_STATSD }
| Statistics Reporter Type. More...

## Functions
void | vty_out_stat_item_group2 (struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg, bool skip_zero)
void | vty_out_stat_item_group (struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg)
void | osmo_stats_init (void *ctx)
| Initialize the stats reporting module; call this once in your program. More...
int | osmo_stats_report (void)
int | osmo_stats_set_interval (int interval)
| Set the reporting interval (common for all reporters) More...
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. More...
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. More...
int | osmo_stats_reporter_set_remote_addr (struct osmo_stats_reporter *srep, const char *addr)
int | osmo_stats_reporter_set_remote_port (struct osmo_stats_reporter *srep, int port)
int | osmo_stats_reporter_set_local_addr (struct osmo_stats_reporter *srep, const char *addr)
int | osmo_stats_reporter_set_mtu (struct osmo_stats_reporter *srep, int mtu)
int | osmo_stats_reporter_set_max_class (struct osmo_stats_reporter *srep, enum osmo_stats_class class_id)
int | osmo_stats_reporter_set_name_prefix (struct osmo_stats_reporter *srep, const char *prefix)
| Set the name prefix of a given stats_reporter. More...
int | osmo_stats_reporter_enable (struct osmo_stats_reporter *srep)
| Enable the given stats_reporter. More...
int | osmo_stats_reporter_disable (struct osmo_stats_reporter *srep)
| Disable the given stats_reporter. More...
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. More...
struct osmo_stats_reporter * | osmo_stats_reporter_create_log (const char *name)
| Create a stats_reporter that logs via libosmocore logging. More...
struct osmo_stats_reporter * | osmo_stats_reporter_create_statsd (const char *name)
| Create a stats_reporter reporting to statsd. More...
int | osmo_stats_reporter_send (struct osmo_stats_reporter *srep, const char *data, int data_len)
int | osmo_stats_reporter_send_buffer (struct osmo_stats_reporter *srep)
int | osmo_stats_reporter_udp_open (struct osmo_stats_reporter *srep)
int | osmo_stats_reporter_udp_close (struct osmo_stats_reporter *srep)
| 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)
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)
static int | osmo_stats_reporter_statsd_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_statsd_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 void | osmo_stats_reporter_sanitize_name (char *buf)
| Replace all illegal ':' in the stats name, but not when used as value seperator. More...
static int | osmo_stats_reporter_statsd_send (struct osmo_stats_reporter *srep, const char *name1, const char *index1, const char *name2, int64_t value, const char *unit)
int | osmo_stats_tcp_osmo_fd_register (const struct osmo_fd *fd, const char *name)
int | osmo_stats_tcp_osmo_fd_unregister (const struct osmo_fd *fd)
int | osmo_stats_tcp_set_interval (int interval)

## Variables
struct llist_head | osmo_stats_reporter_list
struct osmo_stats_config * | osmo_stats_config
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 }
static struct osmo_tcp_stats_config | s_tcp_stats_config
struct osmo_tcp_stats_config * | osmo_tcp_stats_config = &s_tcp_stats_config

## Detailed Description

This module implements periodic reporting of statistics / counters.

It supports the notion of multiple osmo_stats_reporter objects which independently of each other can report statistics at different configurable intervals to different destinations.

In order to use this facility, you have to call osmo_stats_init() once at application start-up and then create one or more osmo_stats_reporter, either using the direct API functions or by using the optional VTY bindings:

- reporting to any of the libosmocore log targets osmo_stats_reporter_create_log() creates a new stats_reporter which reports to the libosmcoore Osmocom logging framework subsystem.
- reporting to statsd (a front-end proxy for the Graphite/Carbon metrics server osmo_stats_reporter_create_statsd() creates a new stats_reporter which reports via UDP to statsd.

You can either use the above API functions directly to create osmo_stats_reporter instances, or you can use the VTY support contained in libosmovty. See the "stats" configuration node installed by osmo_stats_vty_Add_cmds().

An osmo_stats_reporter reports statistics on all of the following libosmocore internal counter/statistics objects:

- osmo_counter
- Rate counters
- Statistics value item

You do not need to do anything in particular to expose a given counter or stat_item, they are all exported automatically via any osmo_stats_reporter. If you have multiple osmo_stats_reporter, they will each report all counters/stat_items.

## Macro Definition Documentation

## ◆ STATS_DEFAULT_BUFLEN

#define STATS_DEFAULT_BUFLEN 256

## ◆ STATS_DEFAULT_INTERVAL

#define STATS_DEFAULT_INTERVAL 5 /* secs */

## ◆ TRACE

#define TRACE | ( |  | probe | ) |

## ◆ TRACE_ENABLED

#define TRACE_ENABLED | ( |  | probe | ) | (0)

## Enumeration Type Documentation

## ◆ osmo_stats_class

enum osmo_stats_class

Statistics Class definitions.

Enumerator
OSMO_STATS_CLASS_UNKNOWN | unknown class
OSMO_STATS_CLASS_GLOBAL | global counter/stat_item
OSMO_STATS_CLASS_PEER | peer in a communications link
OSMO_STATS_CLASS_SUBSCRIBER | subscriber

## ◆ osmo_stats_reporter_type

enum osmo_stats_reporter_type

Statistics Reporter Type.

Enumerator
OSMO_STATS_REPORTER_LOG | libosmocore logging
OSMO_STATS_REPORTER_STATSD | statsd backend

## Function Documentation

## ◆ flush_all_reporters()

static void flush_all_reporters | ( | void |  | ) |
| static

References osmo_stats_reporter::flush_period, osmo_stats_reporter::flush_period_counter, osmo_stats_reporter::force_single_flush, list, llist_for_each_entry, osmo_stats_reporter_list, osmo_stats_reporter_send_buffer(), and osmo_stats_reporter::running.

Referenced by osmo_stats_report().

## ◆ handle_counter()

static int handle_counter | ( | struct osmo_counter * | counter,
|  | void * | sctx_
| ) |  |
| static

References osmo_counter::description, osmo_stats_reporter::force_single_flush, list, llist_for_each_entry, osmo_counter::name, osmo_counter_difference(), osmo_stats_reporter_list, osmo_stats_reporter_send_counter(), osmo_stats_reporter::running, and osmo_counter::value.

Referenced by osmo_stats_report().

## ◆ LLIST_HEAD()

LLIST_HEAD | ( | osmo_stats_reporter_list |  | ) |

## ◆ osmo_stat_item_group_handler()

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

References osmo_stat_item_for_each_item(), and osmo_stat_item_handler().

Referenced by osmo_stats_report().

## ◆ osmo_stat_item_handler()

static 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_group::desc, osmo_stat_item::desc, osmo_stats_reporter::force_single_flush, osmo_stat_item_group::idx, 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.

Referenced by osmo_stat_item_group_handler().

## ◆ osmo_stats_init()

void osmo_stats_init | ( | void * | ctx | ) |

Initialize the stats reporting module; call this once in your program.

Parameters

  [in] | ctx | Talloc context from which stats related memory is allocated

References osmo_tcp_stats_config::interval, is_initialised, osmo_stats_ctx, osmo_stats_tcp_set_interval(), and start_timer().

## ◆ osmo_stats_report()

int osmo_stats_report | ( | void |  | ) |

References flush_all_reporters(), handle_counter(), osmo_counters_for_each(), osmo_stat_item_for_each_group(), osmo_stat_item_group_handler(), rate_ctr_for_each_group(), rate_ctr_group_handler(), and TRACE.

Referenced by osmo_stats_timer_cb().

## ◆ osmo_stats_reporter_alloc()

struct osmo_stats_reporter * osmo_stats_reporter_alloc | ( | enum osmo_stats_reporter_type | type,
|  | const char * | name
| ) |  |

References osmo_stats_reporter::fd, osmo_stats_reporter::list, llist_add_tail(), name, osmo_stats_reporter::name, osmo_stats_ctx, osmo_stats_reporter_list, type, and osmo_stats_reporter::type.

Referenced by osmo_stats_reporter_create_log(), and osmo_stats_reporter_create_statsd().

## ◆ osmo_stats_reporter_check_config()

static int osmo_stats_reporter_check_config | ( | struct osmo_stats_reporter * | srep,
|  | unsigned int | index,
|  | int | class_id
| ) |  |
| static

References osmo_stats_reporter::max_class, OSMO_STATS_CLASS_GLOBAL, OSMO_STATS_CLASS_SUBSCRIBER, and OSMO_STATS_CLASS_UNKNOWN.

Referenced by osmo_stat_item_handler(), and rate_ctr_handler().

## ◆ osmo_stats_reporter_create_log()

struct osmo_stats_reporter * osmo_stats_reporter_create_log | ( | const char * | name | ) |

Create a stats_reporter that logs via libosmocore logging.

A stats_reporter created via this function will simply print the statistics via the libosmocore logging framework, using DLSTATS subsystem and LOGL_INFO priority. The configuration of the libosmocore log targets define where this information will end up (ignored, text file, stderr, syslog, ...).

Parameters

  [in] | name | Name of the to-be-created stats_reporter

Returns
  stats_reporter on success; NULL on error

References osmo_stats_reporter::have_net_config, name, osmo_stats_reporter_alloc(), OSMO_STATS_REPORTER_LOG, osmo_stats_reporter_log_send_counter(), osmo_stats_reporter_log_send_item(), osmo_stats_reporter::send_counter, and osmo_stats_reporter::send_item.

## ◆ osmo_stats_reporter_create_statsd()

struct osmo_stats_reporter * osmo_stats_reporter_create_statsd | ( | const char * | name | ) |

Create a stats_reporter reporting to statsd.

This creates a stats_reporter instance which reports the related statistics data to statsd.

Parameters

  [in] | name | Name of the to-be-created stats_reporter

Returns
  stats_reporter on success; NULL on error

References osmo_stats_reporter::close, osmo_stats_reporter::have_net_config, name, osmo_stats_reporter::open, osmo_stats_reporter_alloc(), OSMO_STATS_REPORTER_STATSD, osmo_stats_reporter_statsd_send_counter(), osmo_stats_reporter_statsd_send_item(), osmo_stats_reporter_udp_close(), osmo_stats_reporter_udp_open(), osmo_stats_reporter::send_counter, and osmo_stats_reporter::send_item.

## ◆ osmo_stats_reporter_disable()

int osmo_stats_reporter_disable | ( | struct osmo_stats_reporter * | srep | ) |

Disable the given stats_reporter.

Parameters

  [in] | srep | stats_reporter who is to be disabled

Returns
  0 on success; negative on error

References osmo_stats_reporter::enabled, and update_srep_config().

Referenced by osmo_stats_reporter_free().

## ◆ osmo_stats_reporter_enable()

int osmo_stats_reporter_enable | ( | struct osmo_stats_reporter * | srep | ) |

Enable the given stats_reporter.

Parameters

  [in] | srep | stats_reporter who is to be enabled

Returns
  0 on success; negative on error

References osmo_stats_reporter::enabled, and update_srep_config().

## ◆ osmo_stats_reporter_find()

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.

Parameters

  [in] | type | Type of stats_reporter to find
  [in] | name | Name of stats_reporter to find

Returns
  stats_reporter matching type and name; NULL otherwise

References list, llist_for_each_entry, name, osmo_stats_reporter::name, osmo_stats_reporter_list, type, and osmo_stats_reporter::type.

## ◆ osmo_stats_reporter_free()

void osmo_stats_reporter_free | ( | struct osmo_stats_reporter * | srep | ) |

Destroy a given stats_reporter.

Takes care of first disabling it.

Parameters

  [in] | srep | stats_reporter that shall be disabled + destroyed

References osmo_stats_reporter::list, llist_del(), and osmo_stats_reporter_disable().

## ◆ osmo_stats_reporter_log_send()

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

References DLSTATS, LOGL_INFO, LOGP, osmo_stats_reporter::name_prefix, and type.

Referenced by osmo_stats_reporter_log_send_counter(), and osmo_stats_reporter_log_send_item().

## ◆ osmo_stats_reporter_log_send_counter()

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

References rate_ctr_group::desc, rate_ctr_group_desc::group_name_prefix, rate_ctr_group::idx, and osmo_stats_reporter_log_send().

Referenced by osmo_stats_reporter_create_log().

## ◆ osmo_stats_reporter_log_send_item()

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

References osmo_stat_item_group::desc, osmo_stat_item_group_desc::group_name_prefix, osmo_stat_item_group::idx, and osmo_stats_reporter_log_send().

Referenced by osmo_stats_reporter_create_log().

## ◆ osmo_stats_reporter_sanitize_name()

static void osmo_stats_reporter_sanitize_name | ( | char * | buf | ) |
| static

Replace all illegal ':' in the stats name, but not when used as value seperator.

':' is used as seperator between the name and the value in the statsd protocol.

Parameters

  [in,out] | buf | is a null terminated string containing name, value, unit.

Referenced by osmo_stats_reporter_statsd_send().

## ◆ osmo_stats_reporter_send()

int osmo_stats_reporter_send | ( | struct osmo_stats_reporter * | srep,
|  | const char * | data,
|  | int | data_len
| ) |  |

## ◆ osmo_stats_reporter_send_buffer()

int osmo_stats_reporter_send_buffer | ( | struct osmo_stats_reporter * | srep | ) |

Referenced by flush_all_reporters(), and osmo_stats_reporter_statsd_send().

## ◆ osmo_stats_reporter_send_counter()

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

References osmo_stats_reporter::send_counter.

Referenced by handle_counter(), and rate_ctr_handler().

## ◆ osmo_stats_reporter_send_item()

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

References osmo_stats_reporter::send_item.

Referenced by osmo_stat_item_handler().

## ◆ osmo_stats_reporter_set_flush_period()

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.

Send all stats even if they have not changed (i.e. force the flush) every N-th reporting interval. Set to 0 to disable regular flush, set to 1 to flush every time, set to 2 to flush every 2nd time, etc.

Parameters

  [in] | srep | stats_reporter to set flush period for
  [in] | period | Reporting interval in seconds

Returns
  0 on success; negative on error

References osmo_stats_reporter::flush_period, osmo_stats_reporter::flush_period_counter, and osmo_stats_reporter::force_single_flush.

## ◆ osmo_stats_reporter_set_local_addr()

int osmo_stats_reporter_set_local_addr | ( | struct osmo_stats_reporter * | srep,
|  | const char * | addr
| ) |  |

## ◆ osmo_stats_reporter_set_max_class()

int osmo_stats_reporter_set_max_class | ( | struct osmo_stats_reporter * | srep,
|  | enum osmo_stats_class | class_id
| ) |  |

References osmo_stats_reporter::max_class, and OSMO_STATS_CLASS_UNKNOWN.

## ◆ osmo_stats_reporter_set_mtu()

int osmo_stats_reporter_set_mtu | ( | struct osmo_stats_reporter * | srep,
|  | int | mtu
| ) |  |

## ◆ osmo_stats_reporter_set_name_prefix()

int osmo_stats_reporter_set_name_prefix | ( | struct osmo_stats_reporter * | srep,
|  | const char * | prefix
| ) |  |

Set the name prefix of a given stats_reporter.

Parameters

  [in] | srep | stats_reporter whose name prefix is to be set
  [in] | prefix | Name prefix to pre-pend for any reported value

Returns
  0 on success; negative on error

References osmo_stats_reporter::name_prefix, and update_srep_config().

## ◆ osmo_stats_reporter_set_remote_addr()

int osmo_stats_reporter_set_remote_addr | ( | struct osmo_stats_reporter * | srep,
|  | const char * | addr
| ) |  |

## ◆ osmo_stats_reporter_set_remote_port()

int osmo_stats_reporter_set_remote_port | ( | struct osmo_stats_reporter * | srep,
|  | int | port
| ) |  |

## ◆ osmo_stats_reporter_statsd_send()

static int osmo_stats_reporter_statsd_send | ( | struct osmo_stats_reporter * | srep,
|  | const char * | name1,
|  | const char * | index1,
|  | const char * | name2,
|  | int64_t | value,
|  | const char * | unit
| ) |  |
| static

References osmo_stats_reporter::agg_enabled, osmo_stats_reporter::buffer, msgb_length(), msgb_put(), msgb_put_u8(), msgb_tailroom(), msgb_trim(), osmo_stats_reporter::name_prefix, osmo_stats_reporter_sanitize_name(), and osmo_stats_reporter_send_buffer().

Referenced by osmo_stats_reporter_statsd_send_counter(), and osmo_stats_reporter_statsd_send_item().

## ◆ osmo_stats_reporter_statsd_send_counter()

static int osmo_stats_reporter_statsd_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

References rate_ctr_group::desc, rate_ctr_group_desc::group_name_prefix, rate_ctr_group::idx, rate_ctr_group::name, and osmo_stats_reporter_statsd_send().

Referenced by osmo_stats_reporter_create_statsd().

## ◆ osmo_stats_reporter_statsd_send_item()

static int osmo_stats_reporter_statsd_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

References osmo_stat_item_group::desc, osmo_stat_item_group_desc::group_name_prefix, osmo_stat_item_group::idx, osmo_stat_item_group::name, and osmo_stats_reporter_statsd_send().

Referenced by osmo_stats_reporter_create_statsd().

## ◆ osmo_stats_reporter_udp_close()

int osmo_stats_reporter_udp_close | ( | struct osmo_stats_reporter * | srep | ) |

Referenced by osmo_stats_reporter_create_statsd().

## ◆ osmo_stats_reporter_udp_open()

int osmo_stats_reporter_udp_open | ( | struct osmo_stats_reporter * | srep | ) |

Referenced by osmo_stats_reporter_create_statsd().

## ◆ osmo_stats_set_interval()

int osmo_stats_set_interval | ( | int | interval | ) |

Set the reporting interval (common for all reporters)

Parameters

  [in] | interval | Reporting interval in seconds

Returns
  0 on success; negative on error

References osmo_stats_config::interval, is_initialised, and start_timer().

## ◆ osmo_stats_tcp_osmo_fd_register()

int osmo_stats_tcp_osmo_fd_register | ( | const struct osmo_fd * | fd,
|  | const char * | name
| ) |  |

References ENOTSUP.

## ◆ osmo_stats_tcp_osmo_fd_unregister()

int osmo_stats_tcp_osmo_fd_unregister | ( | const struct osmo_fd * | fd | ) |

References ENOTSUP.

## ◆ osmo_stats_tcp_set_interval()

int osmo_stats_tcp_set_interval | ( | int | interval | ) |

References ENOTSUP.

Referenced by osmo_stats_init().

## ◆ osmo_stats_timer_cb()

static int osmo_stats_timer_cb | ( | struct osmo_fd * | ofd,
|  | unsigned int | what
| ) |  |
| static

References DLSTATS, osmo_fd::fd, llist_empty(), LOGL_NOTICE, LOGP, OSMO_ASSERT, OSMO_FD_READ, osmo_stats_report(), and osmo_stats_reporter_list.

Referenced by start_timer().

## ◆ rate_ctr_group_handler()

static int rate_ctr_group_handler | ( | struct rate_ctr_group * | ctrg,
|  | void * | sctx_
| ) |  |
| static

References rate_ctr_for_each_counter(), and rate_ctr_handler().

Referenced by osmo_stats_report().

## ◆ rate_ctr_handler()

static int rate_ctr_handler | ( | struct rate_ctr_group * | ctrg,
|  | struct rate_ctr * | ctr,
|  | const struct rate_ctr_desc * | desc,
|  | void * | sctx_
| ) |  |
| static

References rate_ctr_group_desc::class_id, rate_ctr::current, rate_ctr_group::desc, osmo_stats_reporter::force_single_flush, rate_ctr_group::idx, list, llist_for_each_entry, osmo_stats_reporter_check_config(), osmo_stats_reporter_list, osmo_stats_reporter_send_counter(), rate_ctr_difference(), and osmo_stats_reporter::running.

Referenced by rate_ctr_group_handler().

## ◆ start_timer()

static int start_timer | ( | void |  | ) |
| static

References DLSTATS, osmo_fd::fd, osmo_stats_config::interval, is_initialised, LOGL_ERROR, LOGL_INFO, LOGP, osmo_stats_timer, osmo_stats_timer_cb(), osmo_timerfd_disable(), osmo_timerfd_schedule(), and osmo_timerfd_setup().

Referenced by osmo_stats_init(), and osmo_stats_set_interval().

## ◆ update_srep_config()

static int update_srep_config | ( | struct osmo_stats_reporter * | srep | ) |
| static

References osmo_stats_reporter::close, osmo_stats_reporter::enabled, osmo_stats_reporter::force_single_flush, osmo_stats_reporter::open, and osmo_stats_reporter::running.

Referenced by osmo_stats_reporter_disable(), osmo_stats_reporter_enable(), and osmo_stats_reporter_set_name_prefix().

## Variable Documentation

## ◆ is_initialised

int is_initialised = 0
| static

Referenced by osmo_stats_init(), osmo_stats_set_interval(), and start_timer().

## ◆ osmo_stats_config [1/2]

struct osmo_stats_config* osmo_stats_config
| extern

## ◆ osmo_stats_config [2/2]

struct osmo_stats_config* osmo_stats_config = &s_stats_config

## ◆ osmo_stats_ctx

void* osmo_stats_ctx = NULL
| static

Referenced by osmo_stats_init(), and osmo_stats_reporter_alloc().

## ◆ osmo_stats_reporter_list

struct llist_head osmo_stats_reporter_list
| extern

Referenced by flush_all_reporters(), handle_counter(), osmo_stat_item_handler(), osmo_stats_reporter_alloc(), osmo_stats_reporter_find(), osmo_stats_timer_cb(), and rate_ctr_handler().

## ◆ osmo_stats_timer

struct osmo_fd osmo_stats_timer = { .fd = -1 }
| static

Referenced by start_timer().

## ◆ osmo_tcp_stats_config

struct osmo_tcp_stats_config* osmo_tcp_stats_config = &s_tcp_stats_config

## ◆ s_stats_config

struct osmo_stats_config s_stats_config
| static

Initial value:
= {
.interval = STATS_DEFAULT_INTERVAL,
}
STATS_DEFAULT_INTERVAL
#define STATS_DEFAULT_INTERVAL
Definition: stats.c:103

## ◆ s_tcp_stats_config

struct osmo_tcp_stats_config s_tcp_stats_config
| static

Initial value:
= {
.interval = TCP_STATS_DEFAULT_INTERVAL,
}
TCP_STATS_DEFAULT_INTERVAL
#define TCP_STATS_DEFAULT_INTERVAL
Definition: stats_tcp.h:3