diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2021-08-29 13:18:40 +0200 |
---|---|---|
committer | neels <nhofmeyr@sysmocom.de> | 2021-08-30 16:18:52 +0000 |
commit | a5d3c9d0f2a572094d758fe375c87964af2ab51a (patch) | |
tree | 7267e95b2de8065015a8b3602b0acf4f767c1a96 /src | |
parent | f8bed50e05b22487f7f9b3f0425e0c001e76866e (diff) |
move BSC level stats and rate counters to new bsc_stats.[hc]
Instead of having static const structs in header files (which end up
duplicated in each and every compile unit!), have one .c file with the
rate_ctr and stat_item descriptions.
Related: SYS#5542
Change-Id: I8fd6380b5ae8ed2d3347e7cfbf674c30b6841ed9
Diffstat (limited to 'src')
-rw-r--r-- | src/osmo-bsc/Makefile.am | 1 | ||||
-rw-r--r-- | src/osmo-bsc/assignment_fsm.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_init.c | 13 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_stats.c | 122 | ||||
-rw-r--r-- | src/osmo-bsc/bts_ipaccess_nanobts.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/bts_vty.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/gsm_08_08.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/handover_fsm.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_main.c | 1 | ||||
-rw-r--r-- | src/osmo-bsc/paging.c | 1 |
11 files changed, 132 insertions, 12 deletions
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am index c149f47ef..899169713 100644 --- a/src/osmo-bsc/Makefile.am +++ b/src/osmo-bsc/Makefile.am @@ -39,6 +39,7 @@ libbsc_la_SOURCES = \ bsc_rf_ctrl.c \ bsc_rll.c \ bsc_sccp.c \ + bsc_stats.c \ bsc_subscr_conn_fsm.c \ bsc_subscriber.c \ bsc_vty.c \ diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c index 2c52d22d8..3c1f13bc9 100644 --- a/src/osmo-bsc/assignment_fsm.c +++ b/src/osmo-bsc/assignment_fsm.c @@ -36,6 +36,7 @@ #include <osmocom/bsc/lchan_select.h> #include <osmocom/bsc/abis_rsl.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/bsc/assignment_fsm.h> diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index 42acbbc4e..a85e76f09 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -38,6 +38,7 @@ #include <osmocom/bsc/neighbor_ident.h> #include <osmocom/bsc/bts.h> #include <osmocom/bsc/lb.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/bsc/smscb.h> #include <osmocom/gsm/protocol/gsm_48_049.h> @@ -46,18 +47,6 @@ #include <limits.h> #include <stdbool.h> -static const struct osmo_stat_item_desc bsc_stat_desc[] = { - [BSC_STAT_NUM_BTS_TOTAL] = { "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; diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c new file mode 100644 index 000000000..8fc4c38e1 --- /dev/null +++ b/src/osmo-bsc/bsc_stats.c @@ -0,0 +1,122 @@ +/* osmo-bsc statistics */ +/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/bsc/bsc_stats.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/stats.h> +#include <osmocom/core/stat_item.h> + +const struct rate_ctr_desc bsc_ctr_description[] = { + [BSC_CTR_ASSIGNMENT_ATTEMPTED] = {"assignment:attempted", "Assignment attempts"}, + [BSC_CTR_ASSIGNMENT_COMPLETED] = {"assignment:completed", "Assignment completed"}, + [BSC_CTR_ASSIGNMENT_STOPPED] = {"assignment:stopped", "Connection ended during Assignment"}, + [BSC_CTR_ASSIGNMENT_NO_CHANNEL] = {"assignment:no_channel", "Failure to allocate lchan for Assignment"}, + [BSC_CTR_ASSIGNMENT_TIMEOUT] = {"assignment:timeout", "Assignment timed out"}, + [BSC_CTR_ASSIGNMENT_FAILED] = {"assignment:failed", "Received Assignment Failure message"}, + [BSC_CTR_ASSIGNMENT_ERROR] = {"assignment:error", "Assignment failed for other reason"}, + + [BSC_CTR_HANDOVER_ATTEMPTED] = {"handover:attempted", "Intra-BSC handover attempts"}, + [BSC_CTR_HANDOVER_COMPLETED] = {"handover:completed", "Intra-BSC handover completed"}, + [BSC_CTR_HANDOVER_STOPPED] = {"handover:stopped", "Connection ended during HO"}, + [BSC_CTR_HANDOVER_NO_CHANNEL] = {"handover:no_channel", "Failure to allocate lchan for HO"}, + [BSC_CTR_HANDOVER_TIMEOUT] = {"handover:timeout", "Handover timed out"}, + [BSC_CTR_HANDOVER_FAILED] = {"handover:failed", "Received Handover Fail messages"}, + [BSC_CTR_HANDOVER_ERROR] = {"handover:error", "Re-assignment failed for other reason"}, + + [BSC_CTR_INTRA_CELL_HO_ATTEMPTED] = {"intra_cell_ho:attempted", "Intra-Cell handover attempts"}, + [BSC_CTR_INTRA_CELL_HO_COMPLETED] = {"intra_cell_ho:completed", "Intra-Cell handover completed"}, + [BSC_CTR_INTRA_CELL_HO_STOPPED] = {"intra_cell_ho:stopped", "Connection ended during HO"}, + [BSC_CTR_INTRA_CELL_HO_NO_CHANNEL] = {"intra_cell_ho:no_channel", "Failure to allocate lchan for HO"}, + [BSC_CTR_INTRA_CELL_HO_TIMEOUT] = {"intra_cell_ho:timeout", "Handover timed out"}, + [BSC_CTR_INTRA_CELL_HO_FAILED] = {"intra_cell_ho:failed", "Received Handover Fail messages"}, + [BSC_CTR_INTRA_CELL_HO_ERROR] = {"intra_cell_ho:error", "Re-assignment failed for other reason"}, + + [BSC_CTR_INTRA_BSC_HO_ATTEMPTED] = {"intra_bsc_ho:attempted", "Intra-BSC handover attempts"}, + [BSC_CTR_INTRA_BSC_HO_COMPLETED] = {"intra_bsc_ho:completed", "Intra-BSC handover completed"}, + [BSC_CTR_INTRA_BSC_HO_STOPPED] = {"intra_bsc_ho:stopped", "Connection ended during HO"}, + [BSC_CTR_INTRA_BSC_HO_NO_CHANNEL] = {"intra_bsc_ho:no_channel", "Failure to allocate lchan for HO"}, + [BSC_CTR_INTRA_BSC_HO_TIMEOUT] = {"intra_bsc_ho:timeout", "Handover timed out"}, + [BSC_CTR_INTRA_BSC_HO_FAILED] = {"intra_bsc_ho:failed", "Received Handover Fail messages"}, + [BSC_CTR_INTRA_BSC_HO_ERROR] = {"intra_bsc_ho:error", "Re-assignment failed for other reason"}, + + [BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED] = {"interbsc_ho_out:attempted", + "Attempts to handover to remote BSS"}, + [BSC_CTR_INTER_BSC_HO_OUT_COMPLETED] = {"interbsc_ho_out:completed", + "Handover to remote BSS completed"}, + [BSC_CTR_INTER_BSC_HO_OUT_STOPPED] = {"interbsc_ho_out:stopped", "Connection ended during HO"}, + [BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT] = {"interbsc_ho_out:timeout", "Handover timed out"}, + [BSC_CTR_INTER_BSC_HO_OUT_FAILED] = {"interbsc_ho_out:failed", "Received Handover Fail message"}, + [BSC_CTR_INTER_BSC_HO_OUT_ERROR] = {"interbsc_ho_out:error", + "Handover to remote BSS failed for other reason"}, + + [BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED] = {"interbsc_ho_in:attempted", + "Attempts to handover from remote BSS"}, + [BSC_CTR_INTER_BSC_HO_IN_COMPLETED] = {"interbsc_ho_in:completed", + "Handover from remote BSS completed"}, + [BSC_CTR_INTER_BSC_HO_IN_STOPPED] = {"interbsc_ho_in:stopped", "Connection ended during HO"}, + [BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL] = {"interbsc_ho_in:no_channel", + "Failure to allocate lchan for HO"}, + [BSC_CTR_INTER_BSC_HO_IN_TIMEOUT] = {"interbsc_ho_in:timeout", "Handover from remote BSS timed out"}, + [BSC_CTR_INTER_BSC_HO_IN_FAILED] = {"interbsc_ho_in:failed", "Received Handover Fail message"}, + [BSC_CTR_INTER_BSC_HO_IN_ERROR] = {"interbsc_ho_in:error", + "Handover from remote BSS failed for other reason"}, + + [BSC_CTR_SRVCC_ATTEMPTED] = {"srvcc:attempted", "Intra-BSC SRVCC attempts"}, + [BSC_CTR_SRVCC_COMPLETED] = {"srvcc:completed", "Intra-BSC SRVCC completed"}, + [BSC_CTR_SRVCC_STOPPED] = {"srvcc:stopped", "Connection ended during HO"}, + [BSC_CTR_SRVCC_NO_CHANNEL] = {"srvcc:no_channel", "Failure to allocate lchan for HO"}, + [BSC_CTR_SRVCC_TIMEOUT] = {"srvcc:timeout", "SRVCC timed out"}, + [BSC_CTR_SRVCC_FAILED] = {"srvcc:failed", "Received SRVCC Fail messages"}, + [BSC_CTR_SRVCC_ERROR] = {"srvcc:error", "Re-assignment failed for other reason"}, + + [BSC_CTR_PAGING_ATTEMPTED] = {"paging:attempted", "Paging attempts for a subscriber"}, + [BSC_CTR_PAGING_DETACHED] = {"paging:detached", "Paging request send failures because no responsible BTS was found"}, + [BSC_CTR_PAGING_RESPONDED] = {"paging:responded", "Paging attempts with successful response"}, + [BSC_CTR_PAGING_NO_ACTIVE_PAGING] = {"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)"}, + + [BSC_CTR_UNKNOWN_UNIT_ID] = {"abis:unknown_unit_id", "Connection attempts from unknown IPA CCM Unit ID"}, + + [BSC_CTR_MSCPOOL_SUBSCR_NO_MSC] = {"mscpool:subscr:no_msc", + "Complete Layer 3 requests lost because no connected MSC is found available"}, + [BSC_CTR_MSCPOOL_EMERG_FORWARDED] = {"mscpool:emerg:forwarded", + "Emergency call requests forwarded to an MSC (see also per-MSC counters"}, + [BSC_CTR_MSCPOOL_EMERG_LOST] = {"mscpool:emerg:lost", + "Emergency call requests lost because no MSC was found available"}, +}; + +const struct rate_ctr_group_desc bsc_ctrg_desc = { + "bsc", + "base station controller", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(bsc_ctr_description), + bsc_ctr_description, +}; + +static const struct osmo_stat_item_desc bsc_stat_desc[] = { + [BSC_STAT_NUM_BTS_TOTAL] = { "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 }, +}; + +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, +}; diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c index 27f6aeee5..8d2908f69 100644 --- a/src/osmo-bsc/bts_ipaccess_nanobts.c +++ b/src/osmo-bsc/bts_ipaccess_nanobts.c @@ -51,6 +51,7 @@ #include <osmocom/bsc/bts.h> #include <osmocom/bsc/bts_sm.h> #include <osmocom/bsc/nm_common_fsm.h> +#include <osmocom/bsc/bsc_stats.h> static int bts_model_nanobts_start(struct gsm_network *net); static void bts_model_nanobts_e1line_bind_ops(struct e1inp_line *line); diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c index 577feeca7..2b7b42b55 100644 --- a/src/osmo-bsc/bts_vty.c +++ b/src/osmo-bsc/bts_vty.c @@ -49,6 +49,7 @@ #include <osmocom/bsc/neighbor_ident.h> #include <osmocom/bsc/smscb.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> #include <inttypes.h> diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c index 1f6b38ef6..91c90fedd 100644 --- a/src/osmo-bsc/gsm_08_08.c +++ b/src/osmo-bsc/gsm_08_08.c @@ -26,6 +26,7 @@ #include <osmocom/bsc/gsm_08_08.h> #include <osmocom/bsc/codec_pref.h> #include <osmocom/bsc/lchan_fsm.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/bsc/gsm_04_08_rr.h> #include <osmocom/bsc/a_reset.h> diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index 797a336e8..255478f97 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -45,6 +45,7 @@ #include <osmocom/bsc/gsm_08_08.h> #include <osmocom/bsc/bts.h> #include <osmocom/bsc/lcs_loc_req.h> +#include <osmocom/bsc/bsc_stats.h> #define LOG_FMT_BTS "bts %u lac-ci %u-%u arfcn-bsic %d-%d" #define LOG_ARGS_BTS(bts) \ diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 6f0caa76d..d786ec6ff 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -34,6 +34,7 @@ #include <osmocom/bsc/abis_rsl.h> #include <osmocom/bsc/handover_fsm.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm0808.h> diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index b97c7a1b7..b3bd365f9 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -67,6 +67,7 @@ #include <osmocom/bsc/codec_pref.h> #include <osmocom/bsc/system_information.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/mgcp_client/mgcp_client.h> diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index d2dd5eade..04512be92 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -54,6 +54,7 @@ #include <osmocom/bsc/gsm_04_08_rr.h> #include <osmocom/bsc/bsc_subscr_conn_fsm.h> #include <osmocom/bsc/bts.h> +#include <osmocom/bsc/bsc_stats.h> void *tall_paging_ctx = NULL; |