libosmocore 1.11.0.26-c59d.202505072026
Osmocom core library
|
Common routines regarding counter handling. More...
#include <osmocom/core/defs.h>
Go to the source code of this file.
Data Structures | |
struct | osmo_counter |
Structure representing a single counter. More... | |
Common routines regarding counter handling.
struct osmo_counter * osmo_counter_alloc | ( | const char * | name | ) |
Allocate a new counter with given name.
Allocates from tall_ctr_ctx
[in] | name | Human-readable string name for the counter |
References osmo_counter::list, llist_add_tail(), osmo_counter::name, name, and tall_ctr_ctx.
|
inlinestatic |
Decrement given counter by one.
[in] | ctr | Counter that's to be decremented |
int osmo_counter_difference | ( | struct osmo_counter * | ctr | ) |
Compute difference between current and previous counter value.
[in] | ctr | Counter of which the difference is to be computed |
References osmo_counter::previous, and osmo_counter::value.
Referenced by handle_counter().
void osmo_counter_free | ( | struct osmo_counter * | ctr | ) |
Release/Destroy a given counter.
[in] | ctr | Counter to be destroyed |
References osmo_counter::list, and llist_del().
|
inlinestatic |
Get current value of counter.
struct osmo_counter * osmo_counter_get_by_name | ( | const char * | name | ) |
Find a counter by its name.
[in] | name | Name used to look-up/search counter |
References osmo_counter::list, llist_for_each_entry, osmo_counter::name, and name.
|
inlinestatic |
Increment counter by one.
[in] | Counter | that's to be incremented |
|
inlinestatic |
Reset current value of counter to 0.
Iterate over all counters; call handle_cunter call-back for each.
[in] | handle_counter | Call-back to be called for each counter; aborts if rc < 0 |
[in] | data | Opaque data passed through to handle_counter function |
References data, osmo_counter::list, and llist_for_each_entry.
Referenced by osmo_stats_report().