laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36251?usp=email )
Change subject: vty: Print the uptime during 'show hnb' output ......................................................................
vty: Print the uptime during 'show hnb' output
Change-Id: Ic414fe301b3fa5c357bd1cd8a7842b7d6333c709 --- M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/hnbgw.c M src/osmo-hnbgw/hnbgw_vty.c 3 files changed, 25 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/51/36251/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 9fb6d98..d44fc7f 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -437,3 +437,5 @@ struct msgb *hnbgw_ranap_msg_alloc(const char *name);
int hnbgw_peek_l3_ul(struct hnbgw_context_map *map, struct msgb *ranap_msg); + +unsigned long long hnb_get_updowntime(const struct hnb_context *ctx); diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 894f06c..9b15c7d 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -483,6 +483,13 @@ return difftime(tp.tv_sec, hnbp->updowntime); }
+unsigned long long hnb_get_updowntime(const struct hnb_context *ctx) +{ + if (!ctx->persistent) + return 0; + return hnbp_get_updowntime(ctx->persistent); +} + /* timer call-back: Update the HNB_STAT_UPTIME_SECONDS stat item of each hnb_persistent */ static void hnbgw_store_hnb_uptime(void *data) { diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 1870f5d..c5af249 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -204,6 +204,7 @@ struct hnbgw_context_map *map; unsigned int map_count[2] = {}; unsigned int state_count[2][MAP_S_NUM_STATES + 1] = {}; + unsigned long long sec;
vty_out(vty, "HNB "); vty_out_ofd_addr(vty, hnb->conn? osmo_stream_srv_get_ofd(hnb->conn) : NULL); @@ -218,6 +219,12 @@ } vty_dump_hnb_info__map_states(vty, "IuCS", map_count[0], state_count[0]); vty_dump_hnb_info__map_states(vty, "IuPS", map_count[1], state_count[1]); + + sec = hnb_get_updowntime(hnb); + if (sec) { + vty_out(vty, " Iuh Uptime: %llu days %llu hours %llu min. %llu sec.%s", + OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec), sec % 60, VTY_NEWLINE); + } }
static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue)