Commit c3a9d018 authored by Raymond Knopp's avatar Raymond Knopp

PDCP statistics logs, ulsim updates after recent changes

parent cef18a8f
......@@ -32,6 +32,30 @@
int32_t rx_power_avg_eNB[3];
void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB) {
int min_I0=1000,max_I0=0;
int amin=0,amax=0;
for (int i=0; i<eNB->frame_parms.N_RB_UL; i++) {
if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
if (eNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amin=i;}
if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
}
for (int i=0; i<eNB->frame_parms.N_RB_UL; i++) {
fprintf(fd,"%2d.",eNB->measurements.n0_subband_power_tot_dB[i]-eNB->measurements.n0_subband_power_avg_dB);
if (i%25 == 24) fprintf(fd,"\n");
}
fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
fprintf(fd,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
}
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
int subframe,
module_id_t eNB_id,
......@@ -87,7 +111,7 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
nb_rb++;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
measurements->n0_subband_power[aarx][rb] = 0;
for (int s=0;s<14-(frame_parms->Ncp<<1);s++) {
for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) {
// select the 7th symbol in an uplink subframe
offset = offset0 + (s*frame_parms->ofdm_symbol_size);
ul_ch = &common_vars->rxdataF[aarx][offset];
......
......@@ -53,12 +53,11 @@
//#undef LOG_D
//#define LOG_D(A,B...) printf(B)
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i);
AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i);
LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index);
......@@ -78,12 +77,11 @@ int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
}
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
AssertFatal(eNB->ulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i);
if ((eNB->ulsch[i]->harq_mask >0) &&
......@@ -1955,7 +1953,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
if(frame_parms->frame_type == TDD) {
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
if(UE_id != -1) {
if(UE_id >=0 -1 || UE_id < NUMBER_OF_ULSCH_MAX) {
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
}
}
......
......@@ -690,11 +690,11 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding,
uint32_t N_RB_DL,
uint32_t *rb_alloc);
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
......
......@@ -37,12 +37,11 @@
//#define DEBUG_UCI 1
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
int first_free_index=-1;
AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UCI_MAX; i++) {
for (int i=0; i<NUMBER_OF_UCI_MAX; i++) {
if ((eNB->uci_vars[i].active >0) &&
(eNB->uci_vars[i].rnti==rnti) &&
(eNB->uci_vars[i].frame==frame) &&
......
......@@ -1147,8 +1147,7 @@ void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) {
eNB->ulsch_stats[i].total_bytes_rx,
eNB->ulsch_stats[i].total_bytes_tx);
}
if (fd) fprintf(fd,"%s",output);
else printf("%s",output);
fprintf(fd,"%s",output);
}
void clear_ulsch_stats(PHY_VARS_eNB *eNB) {
......
......@@ -1416,6 +1416,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
for (i = 0; i < NUMBER_OF_ULSCH_MAX; i++) {
ulsch = eNB->ulsch[i];
if (!ulsch) continue;
if (ulsch->ue_type > 0) harq_pid = 0;
else harq_pid=harq_pid0;
......@@ -1424,10 +1425,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n",
i, harq_pid, frame,subframe,i,ulsch->rnti,
ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
if ((ulsch) &&
(ulsch->rnti>0) &&
if ((ulsch->rnti>0) &&
(ulsch_harq->status == ACTIVE) &&
((ulsch_harq->frame == frame) || (ulsch_harq->repetition_number >1) ) &&
((ulsch_harq->subframe == subframe) || (ulsch_harq->repetition_number >1) ) &&
......@@ -2168,19 +2168,6 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
}
lte_eNB_I0_measurements (eNB, subframe, 0, eNB->first_run_I0_measurements);
int min_I0=1000,max_I0=0;
int amin=0,amax=0;
if ((frame==0) && (subframe==3)) {
for (int i=0; i<eNB->frame_parms.N_RB_UL; i++) {
if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
if (eNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amin=i;}
if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
}
LOG_I (PHY, "max_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
}
// clear unused statistics after 2 seconds
for (int i=0;i<NUMBER_OF_SCH_STATS_MAX;i++) {
......@@ -2215,13 +2202,7 @@ void release_rnti_of_phy(module_id_t mod_id) {
eNB_PHY = RC.eNB[mod_id][CC_id];
rnti = release_rntis.ue_release_request_TLVs_list[i].rnti;
for (j=0; j<NUMBER_OF_ULSCH_MAX; j++) {
ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch);
}
for (j=0; j<NUMBER_OF_DLSCH_MAX; j++) {
dlsch = eNB_PHY->dlsch[j][0];
......@@ -2231,13 +2212,15 @@ void release_rnti_of_phy(module_id_t mod_id) {
}
}
ulsch = eNB_PHY->ulsch[j];
for (j=0;j<NUMBER_OF_ULSCH_MAX; j++) {
ulsch = eNB_PHY->ulsch[j];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch);
for (j=0;j<NUMBER_OF_ULSCH_MAX;j++)
if (eNB_PHY->ulsch_stats[j].rnti == rnti) {eNB_PHY->ulsch_stats[j].rnti=0; break;}
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti);
clean_eNb_ulsch(ulsch);
for (j=0;j<NUMBER_OF_ULSCH_MAX;j++)
if (eNB_PHY->ulsch_stats[j].rnti == rnti) {eNB_PHY->ulsch_stats[j].rnti=0; break;}
}
}
for(j=0; j<NUMBER_OF_UCI_MAX; j++) {
......
......@@ -186,7 +186,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
else {
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((avg_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
if (frame==0) LOG_D(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
}
......
......@@ -1214,6 +1214,9 @@ int main(int argc, char **argv) {
eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL);
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
dump_I0_stats(stdout,eNB);
dump_ulsch_stats(stdout,eNB,0);
exit(-1);
}
......@@ -1300,7 +1303,7 @@ int main(int argc, char **argv) {
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
}
dump_ulsch_stats(eNB,0);
dump_ulsch_stats(NULL,eNB,0);
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %u dB, delta_IF %d [ (%d,%d) dB / (%u,%u) dB ]**************************\n",
nb_rb,mcs,SNR,SNR2,
tx_lev_dB,
......
......@@ -2646,7 +2646,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
tbs = get_TBS_UL(mcs,rb_table[rb_table_index]);
tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0);
}
if (rb_table[rb_table_index]>40) LOG_I(MAC,"bytes_to_schedule %d, nb_rb %d tx_power %d PHR %d\n",
if (rb_table[rb_table_index]>40) LOG_D(MAC,"bytes_to_schedule %d, nb_rb %d tx_power %d PHR %d\n",
bytes_to_schedule,rb_table[rb_table_index],
estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0),
UE_template->phr_info);
......
......@@ -57,7 +57,7 @@
#include "openair2/RRC/NAS/nas_config.h"
#include "intertask_interface.h"
#include "openair3/S1AP/s1ap_eNB.h"
#include <pthread.h>
# include "gtpv1u_eNB_task.h"
# include "gtpv1u.h"
......@@ -87,6 +87,51 @@ hash_table_t *pdcp_coll_p = NULL;
/* pdcp module parameters and related functions*/
static pdcp_params_t pdcp_params= {0,NULL};
extern volatile int oai_exit;
pthread_t pdcp_stats_thread_desc;
void *pdcp_stats_thread(void *param) {
FILE *fd;
while (!oai_exit) {
sleep(1);
fd=fopen("PDCP_stats.log","w+");
AssertFatal(fd!=NULL,"Cannot open MAC_stats.log\n");
int drb_id=3;
for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (pdcp_enb[0].rnti[UE_id]>0) {
fprintf(fd,"UE CRNTI %x: tx_window %dms, tx_bytes %d, tx_bytes_w %d, tx_bytes_tmp_w %d\n",
pdcp_enb[0].rnti[UE_id],
Pdcp_stats_tx_window_ms[0][UE_id],
Pdcp_stats_tx_bytes[0][UE_id][drb_id],
Pdcp_stats_tx_bytes_w[0][UE_id][drb_id],
Pdcp_stats_tx_bytes_tmp_w[0][UE_id][drb_id]);
fprintf(fd," tx %d, tx_w %d, tx_tmp_w %d, tx_sn %d, tx throughput %d\n",
Pdcp_stats_tx[0][UE_id][drb_id],
Pdcp_stats_tx_w[0][UE_id][drb_id],
Pdcp_stats_tx_tmp_w[0][UE_id][drb_id],
Pdcp_stats_tx_sn[0][UE_id][drb_id],
Pdcp_stats_tx_throughput_w[0][UE_id][drb_id]);
fprintf(fd," rx_window %dms, rx_bytes %d, rx_bytes_w %d, rx_bytes_tmp_w %d\n",
Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB],
Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX],
Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX],
Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]);
fprintf(fd," rx %d, rx_w %d, rx_tmp_w %d, rx_sn %d, rx goodput %d\n",
Pdcp_stats_rx[0][UE_id][drb_id],
Pdcp_stats_rx_w[0][UE_id][drb_id],
Pdcp_stats_rx_tmp_w[0][UE_id][drb_id],
Pdcp_stats_rx_sn[0][UE_id][drb_id],
Pdcp_stats_rx_goodput_w[0][UE_id][drb_id]);
}
}
}
}
uint64_t get_pdcp_optmask(void) {
return pdcp_params.optmask;
}
......
......@@ -4641,7 +4641,6 @@ rrc_eNB_process_MeasurementReport(
case 7:
LOG_D(RRC, "NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
printf("NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe);
break;
default:
......
......@@ -854,6 +854,7 @@ void *L1_stats_thread(void *param) {
sleep(1);
fd=fopen("L1_stats.log","w");
AssertFatal(fd!=NULL,"Cannot open L1_stats.log\n");
dump_I0_stats(fd,eNB);
dump_ulsch_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
fclose(fd);
......
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