Change in osmo-bsc[master]: stats: add BTS uptime counter

iedemam gerrit-no-reply at
Fri Apr 30 11:50:18 UTC 2021

iedemam has posted comments on this change. ( )

Change subject: stats: add BTS uptime counter

Patch Set 4:


Hi Pepsin,

Thanks for the review. I've addressed the first two items. The third has hopefully been explained better now but I'm open to suggestions.

File src/osmo-bsc/bts.c: 
PS4, Line 571: 	if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) {
> osmo_clock_gettime
Oops, sorry. I missed this from a previous comment. Fixed now. 
PS4, Line 580: 	if (uptime_seconds < 0) {
> This cannot happen with a monotonic clock? Unless you run for crazy amount of years without reboot w […]
True. My consideration was that there may be scheduling jitter between reading uptime and setting the last_uptime_read state. I forgot we're running in a single thread though and this will never happen. Removed. 
PS4, Line 586: 	int downtime_seconds = BTS_DOWNTIME_SAMPLE_INTERVAL - uptime_seconds;
> There's something here I'm not really following. […]
Yes, hopefully we always see very nearly zero downtime. :-) The last_uptime_read variable is also updated outside of this loop when a connection is reestablished. Let's say that happens half-way between calls to this timer loop. Now instead of seeing 10 seconds of elapsed uptime, we will only see 5 seconds of "new" uptime. This gives us 5 seconds which were interrupted in some way, signaling downtime.

Testing this locally by disrupting the BTS<->BSC connection results in seemingly accurate downtime numbers. It could perhaps be improved but I'm satisfied with the result so far. Suggestions welcome.

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c
Gerrit-Change-Number: 23234
Gerrit-PatchSet: 4
Gerrit-Owner: iedemam <michael at>
Gerrit-Assignee: daniel <dwillmann at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at>
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-CC: dexter <pmaier at>
Gerrit-Comment-Date: Fri, 30 Apr 2021 11:50:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin at>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list