aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-07-02 14:36:44 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-07-05 18:14:07 +0200
commitaba8354ed3150c1c098ba4aa2c5e5eefa23e766b (patch)
treeca5b627c66d86233126ebace7c4b3a64e7855736
parent4dfd43bb5190dadaaf91a31a881098296bda3584 (diff)
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
-rw-r--r--src/osmo-bts-trx/l1_if.h8
-rw-r--r--src/osmo-bts-trx/main.c15
-rw-r--r--src/osmo-bts-trx/scheduler_trx.c3
3 files changed, 25 insertions, 1 deletions
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 3fda726f..7f60ca36 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -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 {
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 0d2a1f74..d8cbbaa2 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -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;
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 472bae8b..fcd1eeef 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -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 */