[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
Tue Nov 29 06:15:47 UTC 2016


Review at  https://gerrit.osmocom.org/1345

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/rlc.cpp
M src/rlc.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M tests/types/TypesTest.cpp
8 files changed, 95 insertions(+), 7 deletions(-)


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

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..416a074 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -76,6 +76,27 @@
 		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(vty, " RLC Nacked=%d", dl_tbf->m_rlc_nacked);
+		if (tbf->ms()->mode() == GprsCodingScheme::GPRS) {
+			vty_out(vty, " CS1=%d CS2=%d CS3=%d CS4=%d",
+					dl_tbf->statistics.cs1,
+					dl_tbf->statistics.cs2,
+					dl_tbf->statistics.cs3,
+					dl_tbf->statistics.cs4);
+		} else {
+			vty_out(vty, " MCS1=%d MCS2=%d MCS3=%d MCS4=%d MCS5=%d",
+					dl_tbf->statistics.mcs1,
+					dl_tbf->statistics.mcs2,
+					dl_tbf->statistics.mcs3,
+					dl_tbf->statistics.mcs4,
+					dl_tbf->statistics.mcs5);
+			vty_out(vty, " MCS6=%d MCS7=%d MCS8=%d MCS9=%d",
+					dl_tbf->statistics.mcs6,
+					dl_tbf->statistics.mcs7,
+					dl_tbf->statistics.mcs8,
+					dl_tbf->statistics.mcs9);
+		}
 	}
 	vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE);
 }
@@ -176,11 +197,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 Kbits/sec %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/rlc.cpp b/src/rlc.cpp
index 2bffccb..5059e23 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -129,6 +129,7 @@
 			LOGP(DRLCMACDL, LOGL_DEBUG, "- got NACK for BSN=%d\n", bsn);
 			m_v_b.mark_nacked(bsn);
 			bts->rlc_nacked();
+			dl_tbf.m_rlc_nacked++;
 			*lost += 1;
 		}
 	}
@@ -153,6 +154,7 @@
 			LOGP(DRLCMACDL, LOGL_DEBUG, "- got NACK for BSN=%d\n", bsn);
 			m_v_b.mark_nacked(bsn);
 			bts->rlc_nacked();
+			dl_tbf.m_rlc_nacked++;
 			*lost += 1;
 		}
 	}
diff --git a/src/rlc.h b/src/rlc.h
index b2fcd95..14b8bbb 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -37,6 +37,7 @@
 
 struct BTS;
 struct gprs_rlc_v_n;
+struct gprs_rlcmac_dl_tbf;
 
 /* The state of a BSN in the send/receive window */
 enum gprs_rlc_ul_bsn_state {
@@ -318,8 +319,9 @@
 	uint16_t m_v_a;	/* ack state */
 
 	gprs_rlc_v_b m_v_b;
+	gprs_rlcmac_dl_tbf &dl_tbf;
 
-	gprs_rlc_dl_window();
+	gprs_rlc_dl_window(gprs_rlcmac_dl_tbf &tbf);
 };
 
 struct gprs_rlc_v_n {
@@ -498,9 +500,10 @@
 	return bsn & mod_sns();
 }
 
-inline gprs_rlc_dl_window::gprs_rlc_dl_window()
+inline gprs_rlc_dl_window::gprs_rlc_dl_window(gprs_rlcmac_dl_tbf &tbf)
 	: m_v_s(0)
 	, m_v_a(0)
+	, dl_tbf(tbf)
 {
 }
 
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 25209e4..46f8268 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -49,6 +49,23 @@
 	timerclear(&rssi_tv);
 }
 
+gprs_rlcmac_tbf::Statistics::Statistics() :
+	cs1(0),
+	cs2(0),
+	cs3(0),
+	cs4(0),
+	mcs1(0),
+	mcs2(0),
+	mcs3(0),
+	mcs4(0),
+	mcs5(0),
+	mcs6(0),
+	mcs7(0),
+	mcs8(0),
+	mcs9(0)
+{
+}
+
 gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir) :
 	state_flags(0),
 	direction(dir),
@@ -732,7 +749,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);
@@ -744,7 +762,8 @@
 	m_wait_confirm(0),
 	m_dl_ack_requested(false),
 	m_last_dl_poll_fn(0),
-	m_last_dl_drained_fn(0)
+	m_last_dl_drained_fn(0),
+	m_window(*this)
 {
 	memset(&m_llc_timer, 0, sizeof(m_llc_timer));
 }
diff --git a/src/tbf.h b/src/tbf.h
index 1e98a24..97bad1d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -225,6 +225,24 @@
 	uint8_t m_tfi;
 	time_t m_created_ts;
 
+	struct Statistics {
+		uint32_t cs1;
+		uint32_t cs2;
+		uint32_t cs3;
+		uint32_t cs4;
+		uint32_t mcs1;
+		uint32_t mcs2;
+		uint32_t mcs3;
+		uint32_t mcs4;
+		uint32_t mcs5;
+		uint32_t mcs6;
+		uint32_t mcs7;
+		uint32_t mcs8;
+		uint32_t mcs9;
+
+		Statistics();
+	} statistics;
+
 protected:
 	gprs_rlcmac_bts *bts_data() const;
 
@@ -395,10 +413,12 @@
 	bool m_dl_ack_requested;
 	int32_t m_last_dl_poll_fn;
 	int32_t m_last_dl_drained_fn;
+	int32_t m_rlc_nacked;
 
 	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..9dfffa3 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1342,45 +1342,58 @@
 		switch (coding_scheme) {
 		case GprsCodingScheme::CS1 :
 			bts->gprs_dl_cs1();
+			statistics.cs1++;
 			break;
 		case GprsCodingScheme::CS2 :
 			bts->gprs_dl_cs2();
+			statistics.cs2++;
 			break;
 		case GprsCodingScheme::CS3 :
 			bts->gprs_dl_cs3();
+			statistics.cs3++;
 			break;
 		case GprsCodingScheme::CS4 :
 			bts->gprs_dl_cs4();
+			statistics.cs4++;
 			break;
 		}
 	} else {
 		switch (coding_scheme) {
 		case GprsCodingScheme::MCS1 :
 			bts->egprs_dl_mcs1();
+			statistics.mcs1++;
 			break;
 		case GprsCodingScheme::MCS2 :
 			bts->egprs_dl_mcs2();
+			statistics.mcs2++;
 			break;
 		case GprsCodingScheme::MCS3 :
 			bts->egprs_dl_mcs3();
+			statistics.mcs3++;
 			break;
 		case GprsCodingScheme::MCS4 :
 			bts->egprs_dl_mcs4();
+			statistics.mcs4++;
 			break;
 		case GprsCodingScheme::MCS5 :
 			bts->egprs_dl_mcs5();
+			statistics.mcs5++;
 			break;
 		case GprsCodingScheme::MCS6 :
 			bts->egprs_dl_mcs6();
+			statistics.mcs6++;
 			break;
 		case GprsCodingScheme::MCS7 :
 			bts->egprs_dl_mcs7();
+			statistics.mcs7++;
 			break;
 		case GprsCodingScheme::MCS8 :
 			bts->egprs_dl_mcs8();
+			statistics.mcs8++;
 			break;
 		case GprsCodingScheme::MCS9 :
 			bts->egprs_dl_mcs9();
+			statistics.mcs9++;
 			break;
 		}
 	}
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index ee1c817..58ecc60 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -21,6 +21,7 @@
  */
 #include "bts.h"
 #include "tbf.h"
+#include "rlc.h"
 #include "gprs_debug.h"
 #include "encoding.h"
 #include "decoding.h"
@@ -147,7 +148,9 @@
 static void test_rlc_dl_ul_basic()
 {
 	{
-		gprs_rlc_dl_window dl_win;
+		struct BTS BTS;
+		gprs_rlcmac_dl_tbf dl_tbf(&BTS);
+		gprs_rlc_dl_window dl_win(dl_tbf);
 		OSMO_ASSERT(dl_win.window_empty());
 		OSMO_ASSERT(!dl_win.window_stalled());
 		OSMO_ASSERT(dl_win.distance() == 0);
@@ -346,7 +349,8 @@
 		char show_rbb[65];
 		uint8_t bits_data[8];
 		BTS dummy_bts;
-		gprs_rlc_dl_window dl_win;
+		gprs_rlcmac_dl_tbf dl_tbf(&dummy_bts);
+		gprs_rlc_dl_window dl_win(dl_tbf);
 		bitvec bits;
 		int bsn_begin, bsn_end, num_blocks;
 		Ack_Nack_Description_t desc;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia95b0404989b00db0e7ba416bc40d09ef41fde1c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: sivasankari <Sivasankari.Theerthagiri at radisys.com>



More information about the gerrit-log mailing list