Commit 59e10dc8 authored by Robert Schmidt's avatar Robert Schmidt

Clean up MAC stats: don't show timing stats in console log, only file

parent f2bc364b
...@@ -117,8 +117,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -117,8 +117,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
protocol_ctxt_t ctxt={0}; protocol_ctxt_t ctxt={0};
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
char stats_output[16384];
gNB_MAC_INST *gNB = RC.nrmac[module_idP]; gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = gNB->common_channels; NR_COMMON_channels_t *cc = gNB->common_channels;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
...@@ -180,9 +178,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -180,9 +178,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if ((slot == 0) && (frame & 127) == 0) { if ((slot == 0) && (frame & 127) == 0) {
stats_output[0]='\0'; char stats_output[16384];
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384,true); stats_output[0] = '\0';
LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output); dump_mac_stats(RC.nrmac[module_idP], stats_output, sizeof(stats_output), true);
LOG_I(NR_MAC, "Frame.Slot %d.%d\n%s\n", frame, slot, stats_output);
} }
nr_mac_update_timers(module_idP, frame, slot); nr_mac_update_timers(module_idP, frame, slot);
......
...@@ -534,7 +534,7 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options, ...@@ -534,7 +534,7 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP); void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP);
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp); size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp);
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl); void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
......
...@@ -45,25 +45,30 @@ ...@@ -45,25 +45,30 @@
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
#define MACSTATSSTRLEN 16384 #define MACSTATSSTRLEN 65536
void *nrmac_stats_thread(void *arg) { void *nrmac_stats_thread(void *arg) {
gNB_MAC_INST *gNB = (gNB_MAC_INST *)arg; gNB_MAC_INST *gNB = (gNB_MAC_INST *)arg;
char output[MACSTATSSTRLEN]; char output[MACSTATSSTRLEN] = {0};
memset(output,0,MACSTATSSTRLEN); FILE *file = fopen("nrMAC_stats.log","w");
FILE *fd=fopen("nrMAC_stats.log","w"); AssertFatal(file!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
while (oai_exit == 0) { while (oai_exit == 0) {
dump_mac_stats(gNB,output,MACSTATSSTRLEN,false); size_t stroff = 0;
fprintf(fd,"%s\n",output); stroff += dump_mac_stats(gNB, output, MACSTATSSTRLEN, false);
fflush(fd); stroff += snprintf(output + stroff, MACSTATSSTRLEN - stroff, "\n");
usleep(200000); stroff += print_meas_log(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL, output + stroff);
fseek(fd,0,SEEK_SET); stroff += print_meas_log(&gNB->schedule_dlsch, "dlsch scheduler", NULL, NULL, output + stroff);
stroff += print_meas_log(&gNB->rlc_data_req, "rlc_data_req", NULL, NULL, output + stroff);
stroff += print_meas_log(&gNB->rlc_status_ind, "rlc_status_ind", NULL, NULL, output + stroff);
fwrite(output, stroff, 1, file);
fflush(file);
sleep(1);
fseek(file,0,SEEK_SET);
} }
fclose(fd); fclose(file);
return NULL; return NULL;
} }
...@@ -73,7 +78,7 @@ void clear_mac_stats(gNB_MAC_INST *gNB) { ...@@ -73,7 +78,7 @@ void clear_mac_stats(gNB_MAC_INST *gNB) {
} }
} }
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp) size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp)
{ {
int num = 1; int num = 1;
...@@ -138,10 +143,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp ...@@ -138,10 +143,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp
} }
} }
pthread_mutex_unlock(&gNB->UE_info.mutex); pthread_mutex_unlock(&gNB->UE_info.mutex);
print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); return stroff;
print_meas(&gNB->schedule_dlsch,"dlsch scheduler",NULL,NULL);
print_meas(&gNB->rlc_data_req, "rlc_data_req",NULL,NULL);
print_meas(&gNB->rlc_status_ind,"rlc_status_ind",NULL,NULL);
} }
......
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