2021-08-29 11:18:40 +00:00
|
|
|
/* 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <osmocom/core/rate_ctr.h>
|
|
|
|
|
|
|
|
struct osmo_stat_item_group_desc;
|
2021-08-29 11:31:05 +00:00
|
|
|
struct gsm_network;
|
fix performance for chan_counts and all_allocated stats
The all_allocated_update_bsc() does inefficient iterating to count
active/inactive lchans, which scales badly for high numbers of TRX
managed by osmo-bsc.
We need to update the all_allocated flags immediately (periodic counting
alone would suffer from undersampling), so, until now, we are calling
this inefficient function every time a channel state changes.
Instead of iterating all channels for any chan state changes anywhere,
keep global state of the current channel counts, and on channel state
change only update those ts, trx, bts counts that actually change.
A desirable side effect: for connection stats and handover decision 2,
we can now also use the globally updated channel counts and save a bunch
of inefficient iterations.
To get accurate channel counts at all times, spread around some
chan_counts_ts_update() calls in pivotal places. It re-counts the given
timeslot and cascades counter changes, iff required.
Just in case I missed some channel accounting, still run an inefficient
iterating count regularly that detects errors, logs them and fixes them.
No real harm done if such error appears. None show in ttcn3 BSC_Tests.
It is fine to do the inefficient iteration once per second; channel
state changes can realistically happen hundreds of times per second.
Related: SYS#5976
Change-Id: I580bfae329aac8d4552723164741536af6512011
2022-05-30 00:39:17 +00:00
|
|
|
struct gsm_bts;
|
2021-08-29 11:18:40 +00:00
|
|
|
|
|
|
|
/* OsmoBSC rate_ctr indexes */
|
|
|
|
enum {
|
|
|
|
BSC_CTR_ASSIGNMENT_ATTEMPTED,
|
|
|
|
BSC_CTR_ASSIGNMENT_COMPLETED,
|
|
|
|
BSC_CTR_ASSIGNMENT_STOPPED,
|
|
|
|
BSC_CTR_ASSIGNMENT_NO_CHANNEL,
|
|
|
|
BSC_CTR_ASSIGNMENT_TIMEOUT,
|
|
|
|
BSC_CTR_ASSIGNMENT_FAILED,
|
|
|
|
BSC_CTR_ASSIGNMENT_ERROR,
|
|
|
|
BSC_CTR_HANDOVER_ATTEMPTED,
|
|
|
|
BSC_CTR_HANDOVER_COMPLETED,
|
|
|
|
BSC_CTR_HANDOVER_STOPPED,
|
|
|
|
BSC_CTR_HANDOVER_NO_CHANNEL,
|
|
|
|
BSC_CTR_HANDOVER_TIMEOUT,
|
|
|
|
BSC_CTR_HANDOVER_FAILED,
|
|
|
|
BSC_CTR_HANDOVER_ERROR,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_ATTEMPTED,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_COMPLETED,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_STOPPED,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_NO_CHANNEL,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_TIMEOUT,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_FAILED,
|
|
|
|
BSC_CTR_INTRA_CELL_HO_ERROR,
|
|
|
|
BSC_CTR_INTRA_BSC_HO_ATTEMPTED,
|
|
|
|
BSC_CTR_INTRA_BSC_HO_COMPLETED,
|
|
|
|
BSC_CTR_INTRA_BSC_HO_STOPPED,
|
|
|
|
BSC_CTR_INTRA_BSC_HO_NO_CHANNEL,
|
|
|
|
BSC_CTR_INTRA_BSC_HO_TIMEOUT,
|
|
|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CR_NO_MSC,
|
|
|
|
BSC_CTR_MSCPOOL_EMERG_FORWARDED,
|
|
|
|
BSC_CTR_MSCPOOL_EMERG_LOST,
|
2021-09-27 06:56:20 +00:00
|
|
|
BSC_CTR_ALL_ALLOCATED_SDCCH,
|
2021-09-27 06:56:20 +00:00
|
|
|
BSC_CTR_ALL_ALLOCATED_STATIC_SDCCH,
|
2021-09-27 06:56:20 +00:00
|
|
|
BSC_CTR_ALL_ALLOCATED_TCH,
|
2021-09-27 06:56:20 +00:00
|
|
|
BSC_CTR_ALL_ALLOCATED_STATIC_TCH,
|
2021-08-29 11:18:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct rate_ctr_desc bsc_ctr_description[];
|
|
|
|
extern const struct rate_ctr_group_desc bsc_ctrg_desc;
|
|
|
|
|
|
|
|
/* OsmoBSC stat_item indexes */
|
|
|
|
enum {
|
2021-08-29 11:31:05 +00:00
|
|
|
BSC_STAT_NUM_BTS_OML_CONNECTED,
|
|
|
|
BSC_STAT_NUM_BTS_ALL_TRX_RSL_CONNECTED,
|
2021-08-29 11:18:40 +00:00
|
|
|
BSC_STAT_NUM_BTS_TOTAL,
|
2021-08-29 11:31:05 +00:00
|
|
|
BSC_STAT_NUM_TRX_RSL_CONNECTED,
|
|
|
|
BSC_STAT_NUM_TRX_TOTAL,
|
2021-08-19 17:04:14 +00:00
|
|
|
BSC_STAT_NUM_MSC_CONNECTED,
|
|
|
|
BSC_STAT_NUM_MSC_TOTAL,
|
2021-08-29 11:18:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* BTS counter index if a BTS could not be found
|
|
|
|
* Currently we are limited to bts 0 - 255 in the VTY, but that might change in
|
|
|
|
* the future so use 2**16 */
|
|
|
|
#define BTS_STAT_IDX_UNKNOWN (UINT16_MAX + 1)
|
|
|
|
|
|
|
|
extern const struct osmo_stat_item_group_desc bsc_statg_desc;
|
2021-08-29 11:31:05 +00:00
|
|
|
|
|
|
|
void bsc_update_connection_stats(struct gsm_network *net);
|
2022-05-29 21:57:59 +00:00
|
|
|
|
fix performance for chan_counts and all_allocated stats
The all_allocated_update_bsc() does inefficient iterating to count
active/inactive lchans, which scales badly for high numbers of TRX
managed by osmo-bsc.
We need to update the all_allocated flags immediately (periodic counting
alone would suffer from undersampling), so, until now, we are calling
this inefficient function every time a channel state changes.
Instead of iterating all channels for any chan state changes anywhere,
keep global state of the current channel counts, and on channel state
change only update those ts, trx, bts counts that actually change.
A desirable side effect: for connection stats and handover decision 2,
we can now also use the globally updated channel counts and save a bunch
of inefficient iterations.
To get accurate channel counts at all times, spread around some
chan_counts_ts_update() calls in pivotal places. It re-counts the given
timeslot and cascades counter changes, iff required.
Just in case I missed some channel accounting, still run an inefficient
iterating count regularly that detects errors, logs them and fixes them.
No real harm done if such error appears. None show in ttcn3 BSC_Tests.
It is fine to do the inefficient iteration once per second; channel
state changes can realistically happen hundreds of times per second.
Related: SYS#5976
Change-Id: I580bfae329aac8d4552723164741536af6512011
2022-05-30 00:39:17 +00:00
|
|
|
void all_allocated_update_bts(struct gsm_bts *bts);
|
2022-11-03 10:50:48 +00:00
|
|
|
void all_allocated_update_bsc(void);
|