Commit ef1d5079 authored by laurent's avatar laurent

stats display with 5G flag

parent 2de56bf3
......@@ -313,7 +313,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
return(0);
}
static void *L1_thread_tx(void *param) {
L1_proc_t *eNB_proc = (L1_proc_t *)param;
L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx;
......@@ -811,35 +810,19 @@ static void *eNB_thread_prach_br( void *param ) {
return &eNB_thread_prach_status;
}
extern void init_td_thread(PHY_VARS_eNB *);
extern void init_te_thread(PHY_VARS_eNB *);
extern void kill_td_thread(PHY_VARS_eNB *);
extern void kill_te_thread(PHY_VARS_eNB *);
static void print_opp_meas(PHY_VARS_eNB *eNB);
static void reset_opp_meas(PHY_VARS_eNB *eNB);
static void *process_stats_thread(void *param) {
PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param;
wait_sync("process_stats_thread");
reset_opp_meas(eNB);
while (!oai_exit) {
sleep(1);
if (opp_enabled == 1) {
if ( eNB->ulsch_decoding_stats.trials>0)
print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL);
if (eNB->dlsch_encoding_stats.trials >0) {
print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL);
print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL);
print_meas(&eNB->dlsch_turbo_encoding_stats,"turbo_encoding",NULL,NULL);
print_meas(&eNB->dlsch_interleaving_stats,"turbo_interleaving",NULL,NULL);
print_meas(&eNB->dlsch_rate_matching_stats,"turbo_rate_matching",NULL,NULL);
}
print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL);
}
print_opp_meas(eNB);
if (RC.mac)
lte_dump_mac_stats(RC.mac[0], stdout);
if (time(NULL) % 10)
reset_opp_meas(eNB);
}
return(NULL);
......@@ -918,11 +901,6 @@ void init_eNB_proc(int inst) {
pthread_cond_init( &proc->cond_prach_br, NULL);
pthread_attr_init( &proc->attr_prach_br);
if(get_thread_worker_conf() == WORKER_ENABLE) {
init_te_thread(eNB);
init_td_thread(eNB);
}
LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag);
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
......@@ -954,8 +932,10 @@ void init_eNB_proc(int inst) {
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
pthread_create(&proc->L1_stats_thread,NULL,L1_stats_thread,(void*)eNB);
if (opp_enabled == 1)
threadCreate(&proc->process_stats_thread, process_stats_thread, (void *)eNB, "opp stats", -1, sched_get_priority_min(SCHED_OAI));
if (!IS_SOFTMODEM_NOSTATS_BIT)
threadCreate(&proc->L1_stats_thread, L1_stats_thread, (void *)eNB, "L1 stats", -1, sched_get_priority_min(SCHED_OAI));
}
//for multiple CCs: setup master and slaves
......@@ -997,11 +977,6 @@ void kill_eNB_proc(int inst) {
L1_proc = &proc->L1_proc;
L1_proc_tx = &proc->L1_proc_tx;
if(get_thread_worker_conf() == WORKER_ENABLE) {
kill_td_thread(eNB);
kill_te_thread(eNB);
}
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
......@@ -1060,30 +1035,43 @@ void kill_eNB_proc(int inst) {
}
}
void reset_opp_meas(void) {
int sfn;
static void reset_opp_meas(PHY_VARS_eNB *eNB)
{
reset_meas(&softmodem_stats_mt);
reset_meas(&softmodem_stats_hw);
for (sfn=0; sfn < 10; sfn++) {
reset_meas(&softmodem_stats_rxtx_sf);
reset_meas(&softmodem_stats_rx_sf);
}
reset_meas(&softmodem_stats_rxtx_sf);
reset_meas(&softmodem_stats_rx_sf);
reset_meas(&eNB->ulsch_decoding_stats);
reset_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
reset_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
reset_meas(&eNB->dlsch_encoding_stats);
reset_meas(&eNB->dlsch_turbo_encoding_stats);
reset_meas(&eNB->dlsch_interleaving_stats);
reset_meas(&eNB->dlsch_rate_matching_stats);
reset_meas(&eNB->dlsch_modulation_stats);
}
void print_opp_meas(void) {
int sfn=0;
static void print_opp_meas(PHY_VARS_eNB *eNB)
{
print_meas(&softmodem_stats_mt, "Main ENB Thread", NULL, NULL);
print_meas(&softmodem_stats_hw, "HW Acquisation", NULL, NULL);
for (sfn=0; sfn < 10; sfn++) {
print_meas(&softmodem_stats_rxtx_sf,"[eNB][total_phy_proc_rxtx]",NULL, NULL);
print_meas(&softmodem_stats_rx_sf,"[eNB][total_phy_proc_rx]",NULL,NULL);
}
}
if (eNB->ulsch_decoding_stats.trials > 0)
print_meas(&eNB->ulsch_decoding_stats, "ulsch_decoding", NULL, NULL);
if (eNB->dlsch_encoding_stats.trials > 0) {
print_meas(&eNB->dlsch_turbo_encoding_preperation_stats, "dlsch_coding_crc", NULL, NULL);
print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats, "dlsch_segmentation", NULL, NULL);
print_meas(&eNB->dlsch_encoding_stats, "dlsch_encoding", NULL, NULL);
print_meas(&eNB->dlsch_turbo_encoding_stats, "turbo_encoding", NULL, NULL);
print_meas(&eNB->dlsch_interleaving_stats, "turbo_interleaving", NULL, NULL);
print_meas(&eNB->dlsch_rate_matching_stats, "turbo_rate_matching", NULL, NULL);
}
print_meas(&eNB->dlsch_modulation_stats, "dlsch_modulation", NULL, NULL);
}
void free_transport(PHY_VARS_eNB *eNB) {
for (int i=0; i<NUMBER_OF_DLSCH_MAX; i++) {
......@@ -1279,7 +1267,6 @@ void init_eNB(int single_thread_flag,
eNB->prach_energy_counter = 0;
}
}
LOG_I(PHY,"[lte-softmodem.c] eNB structure allocated\n");
}
......
......@@ -2335,17 +2335,18 @@ void init_RU_proc(RU_t *ru) {
init_feptx_thread(ru, NULL);
}
if (opp_enabled == 1) pthread_create(&ru->ru_stats_thread,NULL,ru_stats_thread,(void *)ru);
/*
if (ru->function == eNodeB_3GPP) {
usleep(10000);
LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d,send_dmrs %d) is ready in state %s\n",ru->idx,ru->is_slave,ru->generate_dmrs_sync,ru_states[ru->state]);
AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret);
*ru->ru_mask &= ~(1<<ru->idx);
pthread_cond_signal(ru->ru_cond);
AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret);
}
*/
if (opp_enabled == 1)
pthread_create(&ru->ru_stats_thread, NULL, ru_stats_thread, (void *)ru);
/*
if (ru->function == eNodeB_3GPP) {
usleep(10000);
LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d,send_dmrs %d) is ready in state %s\n",ru->idx,ru->is_slave,ru->generate_dmrs_sync,ru_states[ru->state]);
AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret);
*ru->ru_mask &= ~(1<<ru->idx);
pthread_cond_signal(ru->ru_cond);
AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret);
}
*/
}
......
......@@ -156,10 +156,6 @@ void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *
RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond);
int transmission_mode=1;
......@@ -452,10 +448,6 @@ int main ( int argc, char **argv )
set_taus_seed (0);
printf("configuring for RAU/RRU\n");
if (opp_enabled ==1) {
reset_opp_meas();
}
cpuf=get_cpu_freq_GHz();
printf("ITTI init, useMME: %i\n",EPC_MODE_ENABLED);
itti_init(TASK_MAX, tasks_info);
......
......@@ -179,14 +179,6 @@ extern void init_UE(int nb_inst,
extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char *name);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern void init_td_thread(PHY_VARS_eNB *);
extern void init_te_thread(PHY_VARS_eNB *);
extern void kill_td_thread(PHY_VARS_eNB *);
extern void kill_te_thread(PHY_VARS_eNB *);
extern void init_ocm(void);
extern void init_ue_devices(PHY_VARS_UE *);
......
......@@ -241,10 +241,6 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
}
}
void *te_thread(void *param) {
return(NULL);
}
static void TPencode(void * arg) {
turboEncode_t * rdata=(turboEncode_t *) arg;
unsigned char harq_pid = rdata->harq_pid;
......
......@@ -248,6 +248,7 @@ void processULSegment(void * arg) {
if(ulsch_harq->repetition_number == 1) {
memset(ulsch_harq->pusch_rep_buffer[r],0,(sizeof(int32_t)*3*(6144+64))) ; // reset the buffer every new repetitions
}
if(ulsch_harq->total_number_of_repetitions > 1) {
if (ulsch_harq->rvidx==1) {
LOG_E(PHY,"Adding HARQ data for segment: %d\n", r);
......@@ -267,28 +268,21 @@ void processULSegment(void * arg) {
soft_bits+96,
ulsch_harq->w[r]);
stop_meas(&eNB->ulsch_deinterleaving_stats);
rdata->decodeIterations = rdata->function( soft_bits+96,
NULL,
rdata->decoded_bytes,
NULL,
rdata->Kr,
rdata->maxIterations,
rdata->nbSegments == 1 ? CRC24_A: CRC24_B,
rdata->Fbits,
&eNB->ulsch_tc_init_stats,
&eNB->ulsch_tc_alpha_stats,
&eNB->ulsch_tc_beta_stats,
&eNB->ulsch_tc_gamma_stats,
&eNB->ulsch_tc_ext_stats,
&eNB->ulsch_tc_intl1_stats,
&eNB->ulsch_tc_intl2_stats);
stop_meas(&eNB->ulsch_turbo_decoding_stats);
}
void *td_thread(void *param) {
return(NULL);
rdata->decodeIterations = rdata->function(soft_bits + 96,
NULL,
rdata->decoded_bytes,
NULL,
rdata->Kr,
rdata->maxIterations,
rdata->nbSegments == 1 ? CRC24_A : CRC24_B,
rdata->Fbits,
&eNB->ulsch_tc_init_stats,
&eNB->ulsch_tc_alpha_stats,
&eNB->ulsch_tc_beta_stats,
&eNB->ulsch_tc_gamma_stats,
&eNB->ulsch_tc_ext_stats,
&eNB->ulsch_tc_intl1_stats,
&eNB->ulsch_tc_intl2_stats);
}
int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc,
......@@ -1097,6 +1091,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
LOG_D(PHY,"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d\n",frame,subframe,ulsch_harq->O_ACK,ulsch_harq->o_ACK[0],ulsch_harq->o_ACK[1],ulsch_harq->o_ACK[2],ulsch_harq->o_ACK[3]);
// Do ULSCH Decoding for data portion
start_meas(&eNB->ulsch_turbo_decoding_stats);
ret = ulsch_decoding_data(eNB, proc, UE_id, harq_pid, llr8_flag);
return(ret);
}
......
......@@ -1447,23 +1447,23 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
rx_ulsch(eNB,proc, i);
stop_meas(&eNB->ulsch_demodulation_stats);
start_meas(&eNB->ulsch_decoding_stats);
ulsch_decoding(eNB,proc,
i,
0, // control_only_flag
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb>20 ? 1 : 0);
stop_meas(&eNB->ulsch_decoding_stats);
/*
int ulsch_id=-1;
for (ulsch_id=0;ulsch_id<NUMBER_OF_ULSCH_MAX;ulsch_id++)
if (ulsch->rnti == eNB->ulsch_stats[ulsch_id].rnti) break;
AssertFatal(ulsch_id>=0,"no ulsch_id found\n");
if (eNB->ulsch_stats[ulsch_id].round_trials[0]>100) {
dump_ulsch(eNB,frame,subframe,i,ulsch_harq->round);
AssertFatal(1==0,"exiting\n");
}
*/
ulsch_decoding(eNB,
proc,
i,
0, // control_only_flag
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb > 20 ? 1 : 0);
/*
int ulsch_id=-1;
for (ulsch_id=0;ulsch_id<NUMBER_OF_ULSCH_MAX;ulsch_id++)
if (ulsch->rnti == eNB->ulsch_stats[ulsch_id].rnti) break;
AssertFatal(ulsch_id>=0,"no ulsch_id found\n");
if (eNB->ulsch_stats[ulsch_id].round_trials[0]>100) {
dump_ulsch(eNB,frame,subframe,i,ulsch_harq->round);
AssertFatal(1==0,"exiting\n");
}
*/
}
else if ((ulsch) &&
(ulsch->rnti>0) &&
......@@ -1478,7 +1478,8 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
LOG_W (PHY, "Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)\n", ulsch->rnti, harq_pid, ulsch->harq_mask);
}
} // for (i=0; i<NUMBER_OF_ULSCH_MAX; i++)
const bool decode = proc->nbDecode;
while (proc->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool);
if (req == NULL)
......@@ -1486,62 +1487,13 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
postDecode(proc, req);
delNotifiedFIFO_elt(req);
}
}
extern int oai_exit;
extern void *td_thread (void *);
void init_td_thread(PHY_VARS_eNB *eNB) {
/*
L1_proc_t *proc = &eNB->proc;
proc->tdp.eNB = eNB;
proc->instance_cnt_td = -1;
threadCreate(&proc->pthread_td, td_thread, (void *)&proc->tdp, "TD", -1, OAI_PRIORITY_RT);
*/
}
void kill_td_thread(PHY_VARS_eNB *eNB) {
/*
L1_proc_t *proc = &eNB->proc;
proc->instance_cnt_td = 0;
pthread_cond_signal(&proc->cond_td);
pthread_join(proc->pthread_td, NULL);
pthread_mutex_destroy( &proc->mutex_td );
pthread_cond_destroy( &proc->cond_td );
*/
}
extern void *te_thread (void *);
void init_te_thread(PHY_VARS_eNB *eNB) {
/*
L1_proc_t *proc = &eNB->proc;
for(int i=0; i<3 ; i++) {
proc->tep[i].eNB = eNB;
proc->tep[i].instance_cnt_te = -1;
LOG_I(PHY,"Creating te_thread %d\n",i);
char txt[128];
sprintf(txt,"TE_%d", i);
threadCreate(&proc->tep[i].pthread_te, te_thread, (void *)&proc->tep[i], txt, -1, OAI_PRIORITY_RT);
if (decode) {
stop_meas(&eNB->ulsch_decoding_stats);
stop_meas(&eNB->ulsch_turbo_decoding_stats);
}
*/
}
void kill_te_thread(PHY_VARS_eNB *eNB) {
/*
L1_proc_t *proc = &eNB->proc;
for(int i=0; i<3 ; i++) {
proc->tep[i].instance_cnt_te = 0;
pthread_cond_signal(&proc->tep[i].cond_te);
pthread_join(proc->tep[i].pthread_te, NULL);
pthread_mutex_destroy( &proc->tep[i].mutex_te);
pthread_cond_destroy( &proc->tep[i].cond_te);
}
*/
}
extern int oai_exit;
void fill_rx_indication(PHY_VARS_eNB *eNB,
int ULSCH_id,
......
......@@ -990,13 +990,6 @@ int main(int argc, char **argv) {
eNB->mac_enabled=1;
if(get_thread_worker_conf() == WORKER_ENABLE) {
extern void init_td_thread(PHY_VARS_eNB *);
extern void init_te_thread(PHY_VARS_eNB *);
init_td_thread(eNB);
init_te_thread(eNB);
}
// callback functions required for phy_procedures_tx
// eNB_id_i = UE->n_connected_eNB;
printf("Setting mcs1 = %d\n",mcs1);
......
......@@ -1109,14 +1109,6 @@ int main(int argc, char **argv) {
eNB->frame_parms.Nid_cell_mbsfn=0;
#endif
if(get_thread_worker_conf() == WORKER_ENABLE) {
extern void init_td_thread(PHY_VARS_eNB *);
extern void init_te_thread(PHY_VARS_eNB *);
init_td_thread(eNB);
init_te_thread(eNB);
}
// callback functions required for phy_procedures_tx
// eNB_id_i = UE->n_connected_eNB;
printf("Setting mcs1 = %d\n",mcs1);
......
......@@ -744,9 +744,7 @@ int main(int argc, char **argv) {
if(get_thread_worker_conf() == WORKER_ENABLE) {
extern void init_fep_thread(RU_t *, pthread_attr_t *);
extern void init_td_thread(PHY_VARS_eNB *);
init_fep_thread(ru,NULL);
init_td_thread(eNB);
init_fep_thread(ru, NULL);
}
// Create transport channel structures for 2 transport blocks (MIMO)
......@@ -1379,13 +1377,12 @@ int main(int argc, char **argv) {
printStatIndent2(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" );
printStatIndent2(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" );
printStatIndent2(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" );
printf(" |__ turbo_decoder(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n",
eNB->ulsch[0]->harq_processes[harq_pid]->Cminus ?
eNB->ulsch[0]->harq_processes[harq_pid]->Kminus :
eNB->ulsch[0]->harq_processes[harq_pid]->Kplus,
eNB->ulsch_tc_intl1_stats.trials/(double)eNB->ulsch_tc_init_stats.trials,
(double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials*timeBase,
(int)((double)eNB->ulsch_turbo_decoding_stats.diff/eNB->ulsch_turbo_decoding_stats.trials),
printf(" |__ harqID: %d turbo_decoder(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n",
harq_pid,
eNB->ulsch[0]->harq_processes[harq_pid]->Cminus ? eNB->ulsch[0]->harq_processes[harq_pid]->Kminus : eNB->ulsch[0]->harq_processes[harq_pid]->Kplus,
eNB->ulsch_tc_intl1_stats.trials / (double)eNB->ulsch_tc_init_stats.trials,
(double)eNB->ulsch_turbo_decoding_stats.diff / eNB->ulsch_turbo_decoding_stats.trials * timeBase,
(int)((double)eNB->ulsch_turbo_decoding_stats.diff / eNB->ulsch_turbo_decoding_stats.trials),
eNB->ulsch_turbo_decoding_stats.trials);
printStatIndent3(&eNB->ulsch_tc_init_stats,"init");
printStatIndent3(&eNB->ulsch_tc_alpha_stats,"alpha");
......
......@@ -56,6 +56,7 @@ extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern mac_rlc_am_muilist_t rlc_am_mui;
extern SCHEDULER_MODES global_scheduler_mode;
void lte_dump_mac_stats(eNB_MAC_INST *mac, FILE *fd);
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
......
......@@ -1025,10 +1025,6 @@ uint8_t ul_subframe2_k_phich(COMMON_channels_t *cc, sub_frame_t ul_subframe);
unsigned char ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,unsigned char subframe);
int to_rbg(int dl_Bandwidth);
int to_prb(int dl_Bandwidth);
uint8_t get_Msg3harqpid(COMMON_channels_t *cc,
frame_t frame, sub_frame_t current_subframe);
......
......@@ -45,41 +45,38 @@
extern RAN_CONTEXT_t RC;
extern int oai_exit;
void *mac_stats_thread(void *param) {
eNB_MAC_INST *mac = (eNB_MAC_INST *)param;
FILE *fd;
UE_info_t *UE_info = &(mac->UE_info);
while (!oai_exit) {
sleep(1);
fd=fopen("MAC_stats.log","w+");
AssertFatal(fd!=NULL,"Cannot open MAC_stats.log\n");
for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_info->active[UE_id]) {
int rnti = UE_RNTI(mac->Mod_id, UE_id);
int CC_id = UE_PCCID(mac->Mod_id, UE_id);
UE_sched_ctrl_t *UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
double total_bler;
if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) {
total_bler = 0;
}
else {
total_bler = (double)UE_scheduling_control->pusch_rx_error_num[CC_id] / (double)(UE_scheduling_control->pusch_rx_error_num[CC_id] + UE_scheduling_control->pusch_rx_num[CC_id]) * 100;
}
fprintf(fd,"MAC UE rnti %x : %s, PHR %d DLCQI %d PUSCH %d PUCCH %d RLC disc %d UL-stat rcv %lu err %lu bler %lf (%lf/%lf) total_bler %lf mcsoff %d pre_allocated nb_rb %d, mcs %d, bsr %u sched %u tbs %lu cnt %u , DL-stat tbs %lu cnt %u rb %u buf %u 1st %u ret %u ri %d inactivity timer %d\n",
void lte_dump_mac_stats(eNB_MAC_INST *mac, FILE *fd)
{
UE_info_t *UE_info = &(mac->UE_info);
for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_info->active[UE_id]) {
int rnti = UE_RNTI(mac->Mod_id, UE_id);
int CC_id = UE_PCCID(mac->Mod_id, UE_id);
UE_sched_ctrl_t *UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
double total_bler;
if (UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) {
total_bler = 0;
} else {
total_bler = (double)UE_scheduling_control->pusch_rx_error_num[CC_id] / (double)(UE_scheduling_control->pusch_rx_error_num[CC_id] + UE_scheduling_control->pusch_rx_num[CC_id]) * 100;
}
fprintf(fd,
"MAC UE rnti %x : %s, PHR %d DLCQI %d PUSCH %d PUCCH %d RLC disc %d UL-stat rcv %lu err %lu bler %lf (%lf/%lf) total_bler %lf mcsoff %d pre_allocated nb_rb %d, mcs %d, bsr %u sched %u "
"tbs %lu cnt %u , DL-stat tbs %lu cnt %u rb %u buf %u 1st %u ret %u ri %d inactivity timer %d\n",
rnti,
UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync",
UE_info->UE_template[CC_id][UE_id].phr_info,
UE_scheduling_control->dl_cqi[CC_id],
UE_scheduling_control->pusch_snr/*_avg*/[CC_id],
UE_scheduling_control->pusch_snr /*_avg*/[CC_id],
UE_scheduling_control->pucch1_snr[CC_id],
UE_scheduling_control->rlc_out_of_resources_cnt,
UE_scheduling_control->pusch_rx_num[CC_id],
UE_scheduling_control->pusch_rx_error_num[CC_id],
UE_scheduling_control->pusch_bler[CC_id],
mac->bler_lower,mac->bler_upper,total_bler,
mac->bler_lower,
mac->bler_upper,
total_bler,
UE_scheduling_control->mcs_offset[CC_id],
UE_info->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul,
UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul,
......@@ -98,8 +95,7 @@ void *mac_stats_thread(void *param) {
UE_scheduling_control->first_cnt[CC_id],
UE_scheduling_control->ret_cnt[CC_id],
UE_scheduling_control->aperiodic_ri_received[CC_id],
UE_scheduling_control->ul_inactivity_timer
);
UE_scheduling_control->ul_inactivity_timer);
fprintf(fd," ULSCH rounds %d/%d/%d/%d, DLSCH rounds %d/%d/%d/%d, ULSCH errors %d, DLSCH errors %d\n",
UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0],
UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[1],
......@@ -111,13 +107,24 @@ void *mac_stats_thread(void *param) {
UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[3],
UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_errors,
UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_errors);
}
}
return;
}
void *mac_stats_thread(void *param)
{
eNB_MAC_INST *mac = (eNB_MAC_INST *)param;
FILE *fd;
}
}
while (!oai_exit) {
sleep(1);
fd = fopen("MAC_stats.log", "w+");
AssertFatal(fd != NULL, "Cannot open MAC_stats.log\n");
lte_dump_mac_stats(mac, fd);
fclose(fd);
}
return(NULL);
return NULL;
}
void init_UE_info(UE_info_t *UE_info)
......@@ -206,8 +213,8 @@ void mac_top_init_eNB(void)
rrc_init_global_param();
for (i=0;i<RC.nb_macrlc_inst; i++) pthread_create(&mac[i]->mac_stats_thread,NULL,mac_stats_thread,(void*)mac[i]);
for (i = 0; i < RC.nb_macrlc_inst; i++)
threadCreate(&mac[i]->mac_stats_thread, mac_stats_thread, (void *)mac[i], "mac stats", -1, sched_get_priority_min(SCHED_OAI));
}
void mac_init_cell_params(int Mod_idP, int CC_idP)
......
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