Commit 43e22429 authored by luis_pereira87's avatar luis_pereira87

Change variable types in statistics to accommodate more bytes and to avoid negative values

parent cfbfd90f
...@@ -420,9 +420,9 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t ...@@ -420,9 +420,9 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
return old_mcs; // no update return old_mcs; // no update
// last update is longer than x frames ago // last update is longer than x frames ago
const int dtx = stats->dlsch_rounds[0] - bler_stats->dlsch_rounds[0]; const int dtx = (int)(stats->dlsch_rounds[0] - bler_stats->dlsch_rounds[0]);
const int dretx = stats->dlsch_rounds[1] - bler_stats->dlsch_rounds[1]; const int dretx = (int)(stats->dlsch_rounds[1] - bler_stats->dlsch_rounds[1]);
const int dretx2 = stats->dlsch_rounds[2] - bler_stats->dlsch_rounds[2]; const int dretx2 = (int)(stats->dlsch_rounds[2] - bler_stats->dlsch_rounds[2]);
const float bler_window = dtx > 0 ? (float) dretx / dtx : bler_stats->bler; const float bler_window = dtx > 0 ? (float) dretx / dtx : bler_stats->bler;
const float rd2_bler_wnd = dtx > 0 ? (float) dretx2 / dtx : bler_stats->rd2_bler; const float rd2_bler_wnd = dtx > 0 ? (float) dretx2 / dtx : bler_stats->rd2_bler;
bler_stats->bler = BLER_FILTER * bler_stats->bler + (1 - BLER_FILTER) * bler_window; bler_stats->bler = BLER_FILTER * bler_stats->bler + (1 - BLER_FILTER) * bler_window;
......
...@@ -582,7 +582,7 @@ static void handle_dl_harq(module_id_t mod_id, ...@@ -582,7 +582,7 @@ static void handle_dl_harq(module_id_t mod_id,
harq->ndi ^= 1; harq->ndi ^= 1;
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
stats->dlsch_errors++; stats->dlsch_errors++;
LOG_D(NR_MAC, "retransmission error for UE %d (total %d)\n", UE_id, stats->dlsch_errors); LOG_D(NR_MAC, "retransmission error for UE %d (total %"PRIu64")\n", UE_id, stats->dlsch_errors);
} else { } else {
add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid); add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid);
harq->round++; harq->round++;
......
...@@ -94,36 +94,36 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen) ...@@ -94,36 +94,36 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen)
avg_rsrp, avg_rsrp,
stats->num_rsrp_meas); stats->num_rsrp_meas);
stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, pucch0_DTX %d, BLER %.5f MCS %d\n", stroff+=sprintf(output+stroff,"UE %d: dlsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", dlsch_errors %"PRIu64", pucch0_DTX %d, BLER %.5f MCS %d\n",
UE_id, UE_id,
stats->dlsch_rounds[0], stats->dlsch_rounds[1], stats->dlsch_rounds[0], stats->dlsch_rounds[1],
stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_rounds[2], stats->dlsch_rounds[3],
stats->dlsch_errors, stats->dlsch_errors,
stats->pucch0_DTX, stats->pucch0_DTX,
sched_ctrl->dl_bler_stats.bler, sched_ctrl->dl_bler_stats.bler,
sched_ctrl->dl_bler_stats.mcs); sched_ctrl->dl_bler_stats.mcs);
stats->num_rsrp_meas = 0; stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0 ; stats->cumul_rsrp = 0 ;
stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %"PRIu64"\n", UE_id, stats->dlsch_total_bytes);
stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n", stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", ulsch_DTX %d, ulsch_errors %"PRIu64"\n",
UE_id, UE_id,
stats->ulsch_rounds[0], stats->ulsch_rounds[1], stats->ulsch_rounds[0], stats->ulsch_rounds[1],
stats->ulsch_rounds[2], stats->ulsch_rounds[3], stats->ulsch_rounds[2], stats->ulsch_rounds[3],
stats->ulsch_DTX, stats->ulsch_DTX,
stats->ulsch_errors); stats->ulsch_errors);
stroff+=sprintf(output+stroff, stroff+=sprintf(output+stroff,
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", "UE %d: ulsch_total_bytes_scheduled %"PRIu64", ulsch_total_bytes_received %"PRIu64"\n",
UE_id, UE_id,
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx); stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
for (int lc_id = 0; lc_id < 63; lc_id++) { for (int lc_id = 0; lc_id < 63; lc_id++) {
if (stats->lc_bytes_tx[lc_id] > 0) { if (stats->lc_bytes_tx[lc_id] > 0) {
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]); LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes TX\n", UE_id, lc_id, stats->lc_bytes_tx[lc_id]);
} }
if (stats->lc_bytes_rx[lc_id] > 0) { if (stats->lc_bytes_rx[lc_id] > 0) {
stroff+=sprintf(output+stroff, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); stroff+=sprintf(output+stroff, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
LOG_D(NR_MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); LOG_D(NR_MAC, "UE %d: LCID %d: %"PRIu64" bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]);
} }
} }
} }
......
...@@ -427,7 +427,7 @@ typedef struct NR_DL_bler_stats { ...@@ -427,7 +427,7 @@ typedef struct NR_DL_bler_stats {
float bler; float bler;
float rd2_bler; float rd2_bler;
uint8_t mcs; uint8_t mcs;
int dlsch_rounds[8]; uint64_t dlsch_rounds[8];
} NR_DL_bler_stats_t; } NR_DL_bler_stats_t;
// //
...@@ -618,19 +618,19 @@ typedef struct { ...@@ -618,19 +618,19 @@ typedef struct {
} NRUEcontext_t; } NRUEcontext_t;
typedef struct { typedef struct {
int lc_bytes_tx[64]; uint64_t lc_bytes_tx[64];
int lc_bytes_rx[64]; uint64_t lc_bytes_rx[64];
int dlsch_rounds[8]; uint64_t dlsch_rounds[8];
int dlsch_errors; uint64_t dlsch_errors;
int dlsch_total_bytes; uint64_t dlsch_total_bytes;
int dlsch_current_bytes; int dlsch_current_bytes;
int ulsch_rounds[8]; uint64_t ulsch_rounds[8];
int ulsch_errors; uint64_t ulsch_errors;
int ulsch_DTX; uint32_t ulsch_DTX;
int ulsch_total_bytes_scheduled; uint64_t ulsch_total_bytes_scheduled;
int ulsch_total_bytes_rx; uint64_t ulsch_total_bytes_rx;
int ulsch_current_bytes; int ulsch_current_bytes;
int pucch0_DTX; uint32_t pucch0_DTX;
int cumul_rsrp; int cumul_rsrp;
uint8_t num_rsrp_meas; uint8_t num_rsrp_meas;
} NR_mac_stats_t; } NR_mac_stats_t;
......
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