[PATCH] osmo-pcu[master]: Add statistics in the ms and tbf level.

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/.

sivasankari gerrit-no-reply at lists.osmocom.org
Mon Dec 5 10:34:50 UTC 2016


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1345

to look at the new patch set (#3).

Add statistics in the ms and tbf level.

Adds DL throughput in show ms imsi <imsi_value>.
Adds the number of coding schemes counter and rlc nacked counter at TBf level.

Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c
---
M src/gprs_rlcmac_meas.cpp
M src/pcu_vty_functions.cpp
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
5 files changed, 78 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/1345/3

diff --git a/src/gprs_rlcmac_meas.cpp b/src/gprs_rlcmac_meas.cpp
index 5a2e38e..d6bbc19 100644
--- a/src/gprs_rlcmac_meas.cpp
+++ b/src/gprs_rlcmac_meas.cpp
@@ -179,6 +179,8 @@
 	if (elapsed < 128)
 		return 0;
 
+	tbf->m_bw.dl_throughput = (tbf->m_bw.dl_bw_octets/elapsed);
+
 	LOGP(DRLCMACMEAS, LOGL_INFO, "DL Bandwitdh of IMSI=%s / TLLI=0x%08x: "
 		"%d KBits/s\n", tbf->imsi(), tbf->tlli(),
 		tbf->m_bw.dl_bw_octets / elapsed);
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index ca7f7ad..371a679 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -76,6 +76,8 @@
 		vty_out(vty, " V(A)=%d V(S)=%d nBSN=%d%s",
 			win->v_a(), win->v_s(), win->resend_needed(),
 			win->window_stalled() ? " STALLED" : "");
+		vty_out(vty, "%s", VTY_NEWLINE);
+		vty_out_rate_ctr_group(vty, " ", tbf->tbf_ctrs);
 	}
 	vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE);
 }
@@ -176,11 +178,15 @@
 			ms->ul_tbf()->tfi(),
 			ms->ul_tbf()->state_name(),
 			VTY_NEWLINE);
-	if (ms->dl_tbf())
+	if (ms->dl_tbf()) {
 		vty_out(vty, "  Downlink TBF:           TFI=%d, state=%s%s",
 			ms->dl_tbf()->tfi(),
 			ms->dl_tbf()->state_name(),
 			VTY_NEWLINE);
+		vty_out(vty, "  Current DL Throughput:  %d Kbps %s",
+			ms->dl_tbf()->m_bw.dl_throughput,
+			VTY_NEWLINE);
+	}
 
 	llist_for_each(i_tbf, &ms->old_tbfs())
 		vty_out(vty, "  Old %-19s TFI=%d, state=%s%s",
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 25209e4..40c0615 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -33,6 +33,7 @@
 extern "C" {
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
+#include <osmocom/core/stats.h>
 }
 
 #include <errno.h>
@@ -41,6 +42,31 @@
 extern void *tall_pcu_ctx;
 
 static void tbf_timer_cb(void *_tbf);
+
+static const struct rate_ctr_desc tbf_ctr_description[] = {
+        { "rlc.nacked",                     "RLC Nacked     " },
+        { "gprs.downlink.cs1",              "CS1 Downlink   " },
+        { "gprs.downlink.cs2",              "CS2 Downlink   " },
+        { "gprs.downlink.cs3",              "CS3 Downlink   " },
+        { "gprs.downlink.cs4",              "CS4 Downlink   " },
+        { "egprs.downlink.mcs1",            "MCS1 Downlink  " },
+        { "egprs.downlink.mcs2",            "MCS2 Downlink  " },
+        { "egprs.downlink.mcs3",            "MCS3 Downlink  " },
+        { "egprs.downlink.mcs4",            "MCS4 Downlink  " },
+        { "egprs.downlink.mcs5",            "MCS5 Downlink  " },
+        { "egprs.downlink.mcs6",            "MCS6 Downlink  " },
+        { "egprs.downlink.mcs7",            "MCS7 Downlink  " },
+        { "egprs.downlink.mcs8",            "MCS8 Downlink  " },
+        { "egprs.downlink.mcs9",            "MCS9 Downlink  " },
+};
+
+static const struct rate_ctr_group_desc tbf_ctrg_desc = {
+        "pcu.tbf",
+        "TBF Statistics",
+        OSMO_STATS_CLASS_UNKNOWN,
+        ARRAY_SIZE(tbf_ctr_description),
+        tbf_ctr_description,
+};
 
 gprs_rlcmac_tbf::Meas::Meas() :
 	rssi_sum(0),
@@ -325,6 +351,9 @@
 		if (tbf->state_is(GPRS_RLCMAC_FLOW))
 			tbf->bts->tbf_ul_aborted();
 	} else {
+		gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf);
+		rate_ctr_group_free(dl_tbf->tbf_ctrs);
+
 		tbf->bts->tbf_dl_freed();
 		if (tbf->state_is(GPRS_RLCMAC_FLOW))
 			tbf->bts->tbf_dl_aborted();
@@ -732,7 +761,8 @@
 gprs_rlcmac_dl_tbf::BandWidth::BandWidth() :
 	dl_bw_octets(0),
 	dl_loss_lost(0),
-	dl_loss_received(0)
+	dl_loss_received(0),
+	dl_throughput(0)
 {
 	timerclear(&dl_bw_tv);
 	timerclear(&dl_loss_tv);
@@ -814,6 +844,9 @@
 	gettimeofday(&tbf->m_bw.dl_bw_tv, NULL);
 	gettimeofday(&tbf->m_bw.dl_loss_tv, NULL);
 
+	tbf->tbf_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0);
+	rate_ctr_init(tbf);
+
 	return tbf;
 }
 
diff --git a/src/tbf.h b/src/tbf.h
index 1e98a24..41ae8b0 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -79,6 +79,23 @@
 	GPRS_RLCMAC_UL_TBF
 };
 
+enum tbf_counters {
+	TBF_CTR_RLC_NACKED,
+	TBF_CTR_GPRS_DL_CS1,
+	TBF_CTR_GPRS_DL_CS2,
+	TBF_CTR_GPRS_DL_CS3,
+	TBF_CTR_GPRS_DL_CS4,
+	TBF_CTR_EGPRS_DL_MCS1,
+	TBF_CTR_EGPRS_DL_MCS2,
+	TBF_CTR_EGPRS_DL_MCS3,
+	TBF_CTR_EGPRS_DL_MCS4,
+	TBF_CTR_EGPRS_DL_MCS5,
+	TBF_CTR_EGPRS_DL_MCS6,
+	TBF_CTR_EGPRS_DL_MCS7,
+	TBF_CTR_EGPRS_DL_MCS8,
+	TBF_CTR_EGPRS_DL_MCS9,
+};
+
 #define GPRS_RLCMAC_FLAG_CCCH		0 /* assignment on CCCH */
 #define GPRS_RLCMAC_FLAG_PACCH		1 /* assignment on PACCH */
 #define GPRS_RLCMAC_FLAG_UL_DATA	2 /* uplink data received */
@@ -224,6 +241,8 @@
 	 */
 	uint8_t m_tfi;
 	time_t m_created_ts;
+
+	struct rate_ctr_group *tbf_ctrs;
 
 protected:
 	gprs_rlcmac_bts *bts_data() const;
@@ -399,6 +418,7 @@
 	struct BandWidth {
 		struct timeval dl_bw_tv; /* timestamp for dl bw calculation */
 		uint32_t dl_bw_octets; /* number of octets since bw_tv */
+		uint32_t dl_throughput; /* throughput to be displayed in stats */
 
 		struct timeval dl_loss_tv; /* timestamp for loss calculation */
 		uint16_t dl_loss_lost; /* sum of lost packets */
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index c6f3945..48a8301 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -949,6 +949,7 @@
 		ms()->update_error_rate(this, error_rate);
 
 	m_window.update(bts, rbb, first_bsn, &lost, &received);
+	rate_ctr_add(&tbf_ctrs->ctr[TBF_CTR_RLC_NACKED], lost);
 
 	/* report lost and received packets */
 	gprs_rlcmac_received_lost(this, received, lost);
@@ -1007,6 +1008,7 @@
 
 	m_window.update(bts, show_rbb, ssn,
 			&lost, &received);
+	rate_ctr_add(&tbf_ctrs->ctr[TBF_CTR_RLC_NACKED], lost);
 
 	/* report lost and received packets */
 	gprs_rlcmac_received_lost(this, received, lost);
@@ -1342,45 +1344,58 @@
 		switch (coding_scheme) {
 		case GprsCodingScheme::CS1 :
 			bts->gprs_dl_cs1();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS1]);
 			break;
 		case GprsCodingScheme::CS2 :
 			bts->gprs_dl_cs2();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS2]);
 			break;
 		case GprsCodingScheme::CS3 :
 			bts->gprs_dl_cs3();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS3]);
 			break;
 		case GprsCodingScheme::CS4 :
 			bts->gprs_dl_cs4();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_GPRS_DL_CS4]);
 			break;
 		}
 	} else {
 		switch (coding_scheme) {
 		case GprsCodingScheme::MCS1 :
 			bts->egprs_dl_mcs1();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS1]);
 			break;
 		case GprsCodingScheme::MCS2 :
 			bts->egprs_dl_mcs2();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS2]);
 			break;
 		case GprsCodingScheme::MCS3 :
 			bts->egprs_dl_mcs3();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS3]);
 			break;
 		case GprsCodingScheme::MCS4 :
 			bts->egprs_dl_mcs4();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS4]);
 			break;
 		case GprsCodingScheme::MCS5 :
 			bts->egprs_dl_mcs5();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS5]);
 			break;
 		case GprsCodingScheme::MCS6 :
 			bts->egprs_dl_mcs6();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS6]);
 			break;
 		case GprsCodingScheme::MCS7 :
 			bts->egprs_dl_mcs7();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS7]);
 			break;
 		case GprsCodingScheme::MCS8 :
 			bts->egprs_dl_mcs8();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS8]);
 			break;
 		case GprsCodingScheme::MCS9 :
 			bts->egprs_dl_mcs9();
+			rate_ctr_inc(&tbf_ctrs->ctr[TBF_CTR_EGPRS_DL_MCS9]);
 			break;
 		}
 	}

-- 
To view, visit https://gerrit.osmocom.org/1345
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c
Gerrit-PatchSet: 3
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: sivasankari <Sivasankari.Theerthagiri at radisys.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list