| 
    libosmocore 1.11.0.52-28973f
    
   Osmocom core library 
   | 
 
Configuration for osmo_time_cc. More...
#include <time_cc.h>
Data Fields | |
| uint64_t | gran_usec | 
| Granularity in microseconds: nr of microseconds that one rate_ctr increment represents.  More... | |
| uint64_t | round_threshold_usec | 
| Nr of microseconds above n * gran_usec at which to trigger a counter increment.  More... | |
| uint64_t | forget_sum_usec | 
| Forget counted sub-gran time after the flag was false for this long.  More... | |
| struct rate_ctr * | rate_ctr | 
| Rate counter to report to, or NULL to not use it.  More... | |
| int | T_gran | 
| Update gran_usec from this T timer value, or zero to not use any T timer.  More... | |
| int | T_round_threshold | 
| Update round_threshold_usec from this T timer value, or zero to not use any T timer.  More... | |
| int | T_forget_sum | 
| Update forget_sum_usec from this T timer value, or zero to not use any T timer.  More... | |
| struct osmo_tdef * | T_defs | 
| Look up T_gran and T_forget_sum in this list of timers, or NULL to not use any T timers.  More... | |
Configuration for osmo_time_cc.
Report the cumulative counter of time for which a flag is true as rate counter. For example, for each second that the flag is true, increment a rate counter.
The flag to be monitored is reported by osmo_time_cc_set_flag().
The granularity defines how much time one rate counter increment represents: the default configuration is gran_usec = 1000000, i.e. one rate counter increment represents one second.
Reporting as rate counter is configurable by round_threshold_usec and forget_sum_usec, examples:
round_threshold_usec:
forget_sum_usec: This is a tradeoff between the accuracy of the reported rate counter and making sure that the events reported are not irrelevantly long ago.
Reporting modes in detail:
The rate_ctr increments when the cumulative counter passes round_threshold_usec (default: half of gran_usec).
                   sum ^
                       |                                          ________
                       |                                         /
                       |                                        /
                       |                                       /
              3*gran --+--------------------------------------+
                       |                                     /:
                       |                                    / :
                       | - - - - - - - - - - - - - - - - - /  :
                       |                                  /.  :
                       |                                 / .  :
              2*gran --+--------------------------------+  .  :
                       |                               /:  .  :
                       |                              / :  .  :
                       | - - - - - - - - - -_________/  :  .  :
                       |                   /         .  :  .  :
                       |                  /          .  :  .  :
              1*gran --+-----------------+           .  :  .  :
                       |                /:           .  :  .  :
                       |               / :           .  :  .  :
                       | - - - - - - -/  :           .  :  .  :
                       |             /.  :           .  :  .  :
                       | ....-------' .  :           .  :  .  :
                    0  +------------------------------------------------------------------------> elapsed time
                                      .  :           .  :  .  :
                          _   _      _______         ____________
              flag:    __| |_| |____| .  :  |_______|.  :  .  :  |__________
                       f t f t f    t .  :  f       t.  :  .  :  f
round_threshold_usec : . : . : . : = 1 usec: 0 1 . :2 . :3 . :4 = "ceil()" = 0 == gran_usec/2: 0 1 : 2 : 3 : = "round()" >= gran_usec: 0 1 2 3 = "floor()"
| uint64_t osmo_time_cc_cfg::forget_sum_usec | 
Forget counted sub-gran time after the flag was false for this long.
| uint64_t osmo_time_cc_cfg::gran_usec | 
Granularity in microseconds: nr of microseconds that one rate_ctr increment represents.
A typical value is gran_usec = 1000000, meaning one rate counter increment represents one second. When zero, use 1000000.
| struct rate_ctr* osmo_time_cc_cfg::rate_ctr | 
Rate counter to report to, or NULL to not use it.
| uint64_t osmo_time_cc_cfg::round_threshold_usec | 
Nr of microseconds above n * gran_usec at which to trigger a counter increment.
When zero, use half a gran_usec.
| struct osmo_tdef* osmo_time_cc_cfg::T_defs | 
Look up T_gran and T_forget_sum in this list of timers, or NULL to not use any T timers.
| int osmo_time_cc_cfg::T_forget_sum | 
Update forget_sum_usec from this T timer value, or zero to not use any T timer.
| int osmo_time_cc_cfg::T_gran | 
Update gran_usec from this T timer value, or zero to not use any T timer.
| int osmo_time_cc_cfg::T_round_threshold | 
Update round_threshold_usec from this T timer value, or zero to not use any T timer.