This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18109 ) Change subject: stats: report a number of configured BTS to a stats gauge. ...................................................................... stats: report a number of configured BTS to a stats gauge. It's useful to know how many BTS are actually configured to compare it to a number of connected BTS's. Change-Id: I41cb60f9cb962003227e4a7b63db05acbcdb6f4c --- M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_init.c M src/osmo-bsc/bsc_vty.c 3 files changed, 26 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 545019b..8173506 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1562,6 +1562,11 @@ bsc_ctr_description, }; +/* Constants for the BSC stats */ +enum { + BSC_STAT_NUM_BTS_TOTAL, +}; + struct gsm_tz { int override; /* if 0, use system's time zone instead. */ int hr; /* hour */ @@ -1588,7 +1593,9 @@ struct osmo_timer_list congestion_check_timer; } hodec2; + /* structures for keeping rate counters and gauge stats */ struct rate_ctr_group *bsc_ctrs; + struct osmo_stat_item_group *bsc_statg; unsigned int num_bts; struct llist_head bts_list; diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index 18776f3..d08e9c8 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -44,6 +44,18 @@ #include <limits.h> #include <stdbool.h> +static const struct osmo_stat_item_desc bsc_stat_desc[] = { + { "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 }, +}; + +static const struct osmo_stat_item_group_desc bsc_statg_desc = { + .group_name_prefix = "bsc", + .group_description = "base station controller", + .class_id = OSMO_STATS_CLASS_GLOBAL, + .num_items = ARRAY_SIZE(bsc_stat_desc), + .item_desc = bsc_stat_desc, +}; + int bsc_shutdown_net(struct gsm_network *net) { struct gsm_bts *bts; @@ -268,6 +280,12 @@ talloc_free(net); return NULL; } + net->bsc_statg = osmo_stat_item_group_alloc(net, &bsc_statg_desc, 0); + if (!net->bsc_statg) { + rate_ctr_group_free(net->bsc_ctrs); + talloc_free(net); + return NULL; + } INIT_LLIST_HEAD(&net->bts_rejected); gsm_net_update_ctype(net); diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index f8bcee9..0fd462f 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -2077,6 +2077,7 @@ /* allocate a new one */ bts = bsc_bts_alloc_register(gsmnet, GSM_BTS_TYPE_UNKNOWN, HARDCODED_BSIC); + osmo_stat_item_inc(gsmnet->bsc_statg->items[BSC_STAT_NUM_BTS_TOTAL], 1); /* * Initialize bts->acc_ramp here. Else we could segfault while * processing a configuration file with ACC ramping settings. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18109 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I41cb60f9cb962003227e4a7b63db05acbcdb6f4c Gerrit-Change-Number: 18109 Gerrit-PatchSet: 4 Gerrit-Owner: ipse <Alexander.Chemeris at gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200509/8ce4e776/attachment.htm>