pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/23234 )
Change subject: stats: add BTS uptime counter ...................................................................... Patch Set 5: (1 comment) https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c File src/osmo-bsc/bts.c: https://gerrit.osmocom.org/c/osmo-bsc/+/23234/4/src/osmo-bsc/bts.c@586 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 https://gerrit.osmocom.org/c/osmo-bsc/+/23234 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c Gerrit-Change-Number: 23234 Gerrit-PatchSet: 5 Gerrit-Owner: iedemam <[email protected]> Gerrit-Assignee: daniel <[email protected]> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <[email protected]> Gerrit-Reviewer: laforge <[email protected]> Gerrit-Reviewer: pespin <[email protected]> Gerrit-CC: dexter <[email protected]> Gerrit-Comment-Date: Fri, 30 Apr 2021 12:38:38 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: iedemam <[email protected]> Comment-In-Reply-To: pespin <[email protected]> Gerrit-MessageType: comment
