Commit 6a1c7e57 authored by Robert Schmidt's avatar Robert Schmidt

fix: if old throughput, reinitialize to 0

parent 2285aae9
...@@ -118,6 +118,12 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -118,6 +118,12 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt)
UE_iterator((NR_UE_info_t **)mac->UE_info.list, it) { UE_iterator((NR_UE_info_t **)mac->UE_info.list, it) {
nr_rlc_statistics_t rlc = {0}; nr_rlc_statistics_t rlc = {0};
nr_rlc_get_statistics(it->rnti, srb_flag, rb_id, &rlc); nr_rlc_get_statistics(it->rnti, srb_flag, rb_id, &rlc);
// static var last_total: we might have old data, larger than what
// reports RLC, leading to a huge number -> cut off to zero
if (last_total[i].dl > rlc.txpdu_bytes)
last_total[i].dl = rlc.txpdu_bytes;
if (last_total[i].ul > rlc.rxpdu_bytes)
last_total[i].ul = rlc.rxpdu_bytes;
thr[i].dl = (rlc.txpdu_bytes - last_total[i].dl) * 8 / diff_msec; thr[i].dl = (rlc.txpdu_bytes - last_total[i].dl) * 8 / diff_msec;
thr[i].ul = (rlc.rxpdu_bytes - last_total[i].ul) * 8 / diff_msec; thr[i].ul = (rlc.rxpdu_bytes - last_total[i].ul) * 8 / diff_msec;
last_total[i].dl = rlc.txpdu_bytes; last_total[i].dl = rlc.txpdu_bytes;
...@@ -187,7 +193,7 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -187,7 +193,7 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt)
int i = 0; int i = 0;
UE_iterator((NR_UE_info_t **)mac->UE_info.list, it) { UE_iterator((NR_UE_info_t **)mac->UE_info.list, it) {
if (!first) { prnt(", "); } if (!first) { prnt(", "); }
prnt(" {\"rnti\": %d, \"dl\": %d, \"ul\": %d}\n", it->rnti, thr[i].dl, thr[i].ul); prnt(" {\"rnti\": %d, \"dl\": %ld, \"ul\": %ld}\n", it->rnti, thr[i].dl, thr[i].ul);
i++; i++;
first = false; first = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment