Attention is currently required from: laforge, neels.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36539?usp=email )
Change subject: per-HNB GTP-U traffic counters via nft ......................................................................
Patch Set 9:
(3 comments)
File src/osmo-hnbgw/nft_kpi.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36539/comment/ecacc0aa_de499b1f PS9, Line 626: /* From here on, until we receive the next NFT_THREAD_GET_COUNTERS in this thread, the Possible future improvement here is to use a double-buffer to fill next batch while the main thread is processing the previous one. Not needed for this first version though imo.
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36539/comment/fc710e64_d1eae1e4 PS9, Line 700: osmo_timer_setup(&g_hnbgw->nft_kpi.get_counters_timer, nft_kpi_get_counters_cb, NULL); possible idea for the future: keep interval tracking at the worker, use osmo_timerfd_*() here, this way we could easily track for instance how often the thread cannot cope with the expected counter update frequency.
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36539/comment/e549fb40_09414bc5 PS9, Line 994: nft_kpi_get_counters_schedule(); So you call nft_kpi_get_counters_schedule() once you receive + process the counters, which will then schedule a new counter update every X34 uS.
However, you are not account for the (long) time it took for the counters to be retrieved. Hence, in nft_kpi_get_counters_schedule(), you should store a last_ts = now() value, and subtract the processing time since last time you called it.
Otherwise, if you have X34 to let's say 1 second, but the counting takes 0.3 seconds, you are actually requesting counters every 1.3s (and actually getting them updated every 1.3+0.3s).