Attention is currently required from: fixeria, laforge, neels.
Hello Jenkins Builder, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/36538?usp=email
to look at the new patch set (#3).
Change subject: add osmo_stats_report_lock api
......................................................................
add osmo_stats_report_lock api
Allow multi-threaded access to reported stats:
- enable use of a stats mutex with osmo_stats_report_use_lock(true).
- lock/unlock externally with osmo_stats_report_lock(true/false).
Rationale:
A mutex lock around stats reporting is a very basic and very powerful
tool. It allows a multi-threaded application to decide which stats
updates will always be in sync.
For example, what if the main thread reports rate counters at exactly
the time a second thread updates rate counter values?
- is writing to stats atomic on a data type level?
- do applications need stats to be "atomic" as a whole?
We probably have (or can make) int64_t atomic, so that individual
counters will always be reported correctly.
But often, separate stats correspond to each other, which should not be
reported out of sync with each other. The simplest way to manage stats
sync in all cases is a mutex around the stats reporting.
But such a mutex isn't needed in most programs, with stats happening in
a single thread only. To completely avoid any overhead the mutex may
bring, make using a mutex optional with a global flag.
Related: SYS#6773
Related: osmo-hnbgw I9dc54e6bc94c553f45adfa71ae8ad70be4afbc8f
Change-Id: Ib335bea7d2a440ca284e6c439066f96456bf2c2d
---
M include/osmocom/core/stats.h
M src/core/libosmocore.map
M src/core/stats.c
M src/vty/stats_vty.c
4 files changed, 126 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/36538/3
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/36538?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib335bea7d2a440ca284e6c439066f96456bf2c2d
Gerrit-Change-Number: 36538
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset