Commit 71608f5f authored by Eurecom's avatar Eurecom

modifications to statistics gathering for NR

parent 6eea5b9c
......@@ -358,6 +358,7 @@ void *nrL1_stats_thread(void *param) {
fd=fopen("nrL1_stats.log","w");
AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n");
dump_nr_I0_stats(fd,gNB);
dump_pdsch_stats(fd,gNB);
dump_pusch_stats(fd,gNB);
// nr_dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
fclose(fd);
......
......@@ -87,7 +87,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
if (i%25 == 24) fprintf(fd,"\n");
}
fprintf(fd,"\n");
fprintf(fd,"max_IO = %d (%d), min_I0 = %d (%d), avg_I0 = %d dB\n",max_I0,amax,min_I0,amin,gNB->measurements.n0_subband_power_avg_dB);
fprintf(fd,"PRACH I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
......
......@@ -526,15 +526,17 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
return 0;
}
void dump_pdsch_stats(PHY_VARS_gNB *gNB) {
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++)
if (gNB->dlsch_stats[i].rnti > 0)
LOG_D(PHY,"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n",
if (gNB->dlsch_stats[i].rnti > 0 && gNB->dlsch_stats[i].frame != gNB->dlsch_stats[i].dump_frame) {
gNB->dlsch_stats[i].dump_frame = gNB->dlsch_stats[i].frame;
fprintf(fd,"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n",
gNB->dlsch_stats[i].rnti,
gNB->dlsch_stats[i].current_Qm,
gNB->dlsch_stats[i].current_RI,
gNB->dlsch_stats[i].total_bytes_tx);
}
}
......
......@@ -98,7 +98,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
void init_dlsch_tpool(uint8_t nun_dlsch_threads);
void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size);
void dump_pdsch_stats(PHY_VARS_gNB *gNB);
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB);
void clear_pdsch_stats(PHY_VARS_gNB *gNB);
......
......@@ -137,27 +137,23 @@ void nr_ulsch_unscrambling_optim(int16_t* llr,
#endif
}
#define STATSTRLEN 16384
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
char output[16384];
int stroff=0;
for (int i=0;i<gNB->number_of_nr_ulsch_max;i++) {
if (gNB->ulsch_stats[i].rnti>0) {
if (gNB->ulsch_stats[i].rnti>0 && gNB->ulsch_stats[i].frame != gNB->ulsch_stats[i].dump_frame) {
gNB->ulsch_stats[i].dump_frame = gNB->ulsch_stats[i].frame;
for (int aa=0;aa<gNB->frame_parms.nb_antennas_rx;aa++)
if (aa==0) stroff+=sprintf(output+stroff,"ULSCH RNTI %4x: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n",
gNB->ulsch_stats[i].rnti,
if (aa==0) fprintf(fd,"ULSCH RNTI %4x, %d.%d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d\n",
gNB->ulsch_stats[i].rnti,gNB->ulsch_stats[i].frame,gNB->ulsch_stats[i].dump_frame,
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
else stroff+=sprintf(output+stroff," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
else fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n");
stroff+=sprintf(output+stroff," round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n",
fprintf(fd," round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n",
gNB->ulsch_stats[i].round_trials[0],
(double)gNB->ulsch_stats[i].round_trials[1]/gNB->ulsch_stats[i].round_trials[0],
gNB->ulsch_stats[i].round_trials[1],
......@@ -172,7 +168,6 @@ void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
gNB->ulsch_stats[i].total_bytes_tx);
}
}
fprintf(fd,"%s",output);
}
void clear_pusch_stats(PHY_VARS_gNB *gNB) {
......
......@@ -556,6 +556,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
}
if (stats) {
stats->frame = frame;
stats->rnti = ulsch->rnti;
stats->round_trials[harq_process->round]++;
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
......
......@@ -127,6 +127,8 @@ typedef struct {
} NR_gNB_UL_PDCCH_t;
typedef struct {
int frame;
int dump_frame;
uint16_t rnti;
int round_trials[8];
int total_bytes_tx;
......
......@@ -196,7 +196,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
if (do_meas==1) stop_meas(&gNB->phy_proc_tx);
if ((frame&127) == 0) dump_pdsch_stats(gNB);
// if ((frame&127) == 0) dump_pdsch_stats(gNB);
//apply the OFDM symbol rotation here
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
......
......@@ -74,8 +74,11 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
memset(output,0,MACSTATSSTRLEN);
int stroff=0;
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
stroff = sprintf(output,"UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs);
LOG_I(NR_MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n",
stroff = sprintf(output,"UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs,
UE_info->UE_sched_ctrl[UE_id].ph,
UE_info->UE_sched_ctrl[UE_id].pcmax);
LOG_D(NR_MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n",
UE_id,
UE_info->rnti[UE_id],
num++,
......@@ -89,7 +92,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
stats->dlsch_rounds[0], stats->dlsch_rounds[1],
stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors,
avg_rsrp, stats->num_rsrp_meas);
LOG_I(NR_MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n",
LOG_D(NR_MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n",
UE_id,
stats->dlsch_rounds[0], stats->dlsch_rounds[1],
stats->dlsch_rounds[2], stats->dlsch_rounds[3], stats->dlsch_errors,
......@@ -107,14 +110,14 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
UE_id,
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
LOG_D(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
LOG_D(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
UE_id,
stats->ulsch_rounds[0], stats->ulsch_rounds[1],
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
stats->ulsch_DTX,
stats->ulsch_errors);
LOG_I(NR_MAC,
LOG_D(NR_MAC,
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
UE_id,
stats->ulsch_total_bytes_scheduled, stats->ulsch_total_bytes_rx);
......@@ -402,7 +405,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
}
// if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]);
// This schedules MIB
......
......@@ -1034,6 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
pucchres0->format.choice.format0->startingSymbolIndex=13;
ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0);
if (0) {
// configure Scheduling request
// 40 slot period
pucch_Config->schedulingRequestResourceToAddModList = calloc(1,sizeof(*pucch_Config->schedulingRequestResourceToAddModList));
......@@ -1043,7 +1044,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40;
// note: make sure that there is no issue here. Later choose the RNTI accordingly.
// Here we would be limited to 8 UEs on this resource (2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 8,9,18,19,28,29,38,39).
// Here we would be limited to 3 UEs on this resource (1 1/2 Frames 30 kHz SCS, 5 ms TDD periodicity => slots 7,8,9).
// This should be a temporary resource until the first RRCReconfiguration gives new pucch resources.
// Check for above configuration and exit for now if it is not the case
AssertFatal(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing==NR_SubcarrierSpacing_kHz30,
......@@ -1051,11 +1052,11 @@ void fill_initial_SpCellConfig(rnti_t rnti,
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity==NR_TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5,
"TDD period != 5ms : %ld\n",scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity);
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = 10*((rnti>>1)&3) + (rnti&2);
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl40 = (10*(rnti&3));//(10*((rnti>>1)&3)) + (rnti&1);
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
*schedulingRequestResourceConfig->resource = 0;
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
}
SpCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->initialDownlinkBWP));
NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP;
bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp_Dedicated->pdcch_Config));
......@@ -1241,6 +1242,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
/* mac CellGroup Config */
if (1) {
mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig));
if (0) {
mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig));
mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList));
struct NR_SchedulingRequestToAddMod *schedulingrequestlist;
......@@ -1250,6 +1252,7 @@ void fill_initial_cellGroupConfig(rnti_t rnti,
*(schedulingrequestlist->sr_ProhibitTimer) = 0;
schedulingrequestlist->sr_TransMax = 0;
ASN_SEQUENCE_ADD(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist);
}
mac_CellGroupConfig->bsr_Config = calloc(1, sizeof(*mac_CellGroupConfig->bsr_Config));
mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10;
mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf80;
......
......@@ -1032,7 +1032,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
schedulingRequestResourceConfig->schedulingRequestID = 0;
schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));
schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10;
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl10 = 7;
schedulingRequestResourceConfig->periodicityAndOffset->choice.sl10 = 2;
schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource));
*schedulingRequestResourceConfig->resource = 1;
ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig);
......
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