bts-trx: Introduce rate counter for scheduler timerfd missed FNs

This should provide a quick way to check if the system is frequently
overloaded over time and hence downlink FNs are scheduled later than
expected.

Change-Id: I0051b9ab18ebc9f92db11374d856de94f155efa4
This commit is contained in:
Pau Espin 2020-07-02 14:36:44 +02:00
parent 4dfd43bb51
commit aba8354ed3
3 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,8 @@
#ifndef L1_IF_H_TRX
#define L1_IF_H_TRX
#include <osmocom/core/rate_ctr.h>
#include <osmo-bts/scheduler.h>
#include <osmo-bts/phy_link.h>
#include "trx_if.h"
@ -24,6 +26,11 @@
* send burst data for the missing frame numbers.
*/
/* bts-trx specific rate counters */
enum {
BTSTRX_CTR_SCHED_DL_MISS_FN,
};
/*! clock state of a given TRX */
struct osmo_trx_clock_state {
/*! number of FN periods without TRX clock indication */
@ -47,6 +54,7 @@ struct osmo_trx_clock_state {
/* gsm_bts->model_priv, specific to osmo-bts-trx */
struct bts_trx_priv {
struct osmo_trx_clock_state clk_s;
struct rate_ctr_group *ctrs; /* bts-trx specific rate counters */
};
struct trx_config {

View File

@ -43,6 +43,8 @@
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/bits.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/stats.h>
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/phy_link.h>
@ -59,6 +61,18 @@
#include "l1_if.h"
#include "trx_if.h"
static const struct rate_ctr_desc btstrx_ctr_desc[] = {
[BTSTRX_CTR_SCHED_DL_MISS_FN] = {"trx_clk:sched_dl_miss_fn",
"Downlink frames scheduled later than expected due to missed timerfd event (due to high system load)"},
};
static const struct rate_ctr_group_desc btstrx_ctrg_desc = {
"bts-trx",
"osmo-bts-trx specific counters",
OSMO_STATS_CLASS_GLOBAL,
ARRAY_SIZE(btstrx_ctr_desc),
btstrx_ctr_desc
};
/* dummy, since no direct dsp support */
uint32_t trx_get_hlayer1(struct gsm_bts_trx *trx)
{
@ -99,6 +113,7 @@ int bts_model_init(struct gsm_bts *bts)
{
struct bts_trx_priv *bts_trx = talloc_zero(bts, struct bts_trx_priv);
bts_trx->clk_s.fn_timer_ofd.fd = -1;
bts_trx->ctrs = rate_ctr_group_alloc(bts_trx, &btstrx_ctrg_desc, 0);
bts->model_priv = bts_trx;
bts->variant = BTS_OSMO_TRX;

View File

@ -158,7 +158,8 @@ static int trx_fn_timer_cb(struct osmo_fd *ofd, unsigned int what)
if (expire_count > 1) {
LOGP(DL1C, LOGL_NOTICE, "FN timer expire_count=%"PRIu64": We missed %"PRIu64" timers\n",
expire_count, expire_count-1);
expire_count, expire_count - 1);
rate_ctr_add(&bts_trx->ctrs->ctr[BTSTRX_CTR_SCHED_DL_MISS_FN], expire_count - 1);
}
/* check if transceiver is still alive */