libosmocore 1.10.0.57-8972
Osmocom core library
|
Report the cumulative counter of time for which a flag is true as rate counter. More...
#include <time_cc.h>
Data Fields | |
struct osmo_time_cc_cfg | cfg |
bool | flag_state |
uint64_t | total_sum |
Overall cumulative sum. More... | |
struct osmo_timer_list | timer |
uint64_t | start_time |
CLOCK_MONOTONIC reading in microseconds, at the time when the osmo_time_cc instance started counting. More... | |
uint64_t | last_counted_time |
CLOCK_MONOTONIC reading in microseconds, at the time when the osmo_time_cc last evaluated the flag state and possibly added to the cumulated sum. More... | |
uint64_t | sum |
Internal cumulative counter of time that flag_state was true. More... | |
uint64_t | reported_sum |
The amount of time that already reported cfg.rate_ctr increments account for. More... | |
Report the cumulative counter of time for which a flag is true as rate counter.
See also osmo_time_cc_cfg for details on configuring.
Usage:
struct my_obj { struct osmo_time_cc flag_cc; }; void my_obj_init(struct my_obj *my_obj) { osmo_time_cc_init(&my_obj->flag_cc); my_obj->flag_cc.cfg = (struct osmo_time_cc_cfg){ .gran_usec = 1000000, .forget_sum_usec = 60000000, .rate_ctr = rate_ctr_group_get_ctr(my_ctrg, MY_CTR_IDX), }; // optional: set initial flag state, default is 'false': // osmo_time_cc_set_flag(&my_obj->flag_cc, false); } void my_obj_event(struct my_obj *my_obj, bool flag) { osmo_time_cc_set_flag(&my_obj->flag_cc, flag); } void my_obj_destruct(struct my_obj *my_obj) { osmo_time_cc_cleanup(&my_obj->flag_cc); }
struct osmo_time_cc_cfg osmo_time_cc::cfg |
bool osmo_time_cc::flag_state |
uint64_t osmo_time_cc::last_counted_time |
CLOCK_MONOTONIC reading in microseconds, at the time when the osmo_time_cc last evaluated the flag state and possibly added to the cumulated sum.
uint64_t osmo_time_cc::reported_sum |
The amount of time that already reported cfg.rate_ctr increments account for.
This may be ahead of or behind 'sum', depending on cfg.round_threshold_usec.
uint64_t osmo_time_cc::start_time |
CLOCK_MONOTONIC reading in microseconds, at the time when the osmo_time_cc instance started counting.
uint64_t osmo_time_cc::sum |
Internal cumulative counter of time that flag_state was true.
It may get reset to zero regularly, depending on cfg.forget_sum_usec. This is the basis for incrementing cfg.rate_ctr.
struct osmo_timer_list osmo_time_cc::timer |
uint64_t osmo_time_cc::total_sum |
Overall cumulative sum.
Does not get reset for the entire lifetime of an osmo_time_cc. (Informational only, not used by the osmo_time_cc implementation.)