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

pespin gerrit-no-reply at
Fri Apr 30 12:38:38 UTC 2021

pespin has posted comments on this change. ( )

Change subject: stats: add BTS uptime counter

Patch Set 5:

(1 comment) 
File src/osmo-bsc/bts.c: 
PS4, Line 586: 	int downtime_seconds = BTS_DOWNTIME_SAMPLE_INTERVAL - uptime_seconds;
> Yes, hopefully we always see very nearly zero downtime. […]
I'm still not getting it, I'm sorry. Or maybe I'm getting it but I still find it really strange.
So, the idea of the BTS_STAT_DOWNTIME counter, as you wrote it, is to:
* Be 0 or nearly 0 whenever the BTS is UP and running
* Be in the range [0, BTS_DOWNTIME_SAMPLE_INTERVAL] whenever the BTS is down

So being it a [0, BTS_DOWNTIME_SAMPLE_INTERVAL] range, I don't see much of a use regarding the value other than signalling Up vs DOWN state, at which point maybe having a 0-1 value is good enough.

In case we don't agree on the range being [0, BTS_DOWNTIME_SAMPLE_INTERVAL] per your implementation, let's, my assumptions reading the code are:
- bts_record_downtime() is called every BTS_DOWNTIME_SAMPLE_INTERVAL, and sets bts->last_uptime_read to now() every time, meaning that when bts_record_downtime() runs, bts->last_uptime_read will always contain at most now()-BTS_DOWNTIME_SAMPLE_INTERVAL.
- if BTS is up: downtime_seconds = BTS_DOWNTIME_SAMPLE_INTERVAL - uptime_seconds = 0.
- if BTS is down, it means bts->last_uptime_read was set to now() at some point in the last [0, BTS_DOWNTIME_SAMPLE_INTERVAL] interval (it cannot be less than now()-BTS_DOWNTIME_SAMPLE_INTERVAL because it would have already been updated by previous run of bts_record_downtime().

So please, if I'm wrong feel free to explain it to me.

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: 5
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 12:38:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: iedemam <michael at>
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