mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
File-based stats: abort writing if we can't write
There might be a number of reasons, such as read-only write system, erros, etc. Still gracefully continue instead of aborting the operation.
This commit is contained in:
@@ -267,9 +267,11 @@ void *nrL1_stats_thread(void *param) {
|
||||
char output[L1STATSSTRLEN];
|
||||
memset(output,0,L1STATSSTRLEN);
|
||||
wait_sync("L1_stats_thread");
|
||||
FILE *fd;
|
||||
fd=fopen("nrL1_stats.log","w");
|
||||
AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n");
|
||||
FILE *fd=fopen("nrL1_stats.log","w");
|
||||
if (!fd) {
|
||||
LOG_W(NR_PHY, "Cannot open nrL1_stats.log: %d, %s\n", errno, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
reset_meas(&gNB->phy_proc_tx);
|
||||
reset_meas(&gNB->dlsch_encoding_stats);
|
||||
|
||||
@@ -79,7 +79,10 @@ void *nrmac_stats_thread(void *arg) {
|
||||
char output[MACSTATSSTRLEN] = {0};
|
||||
const char *end = output + MACSTATSSTRLEN;
|
||||
FILE *file = fopen("nrMAC_stats.log","w");
|
||||
AssertFatal(file!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
|
||||
if (!file) {
|
||||
LOG_W(NR_MAC, "Cannot open nrMAC_stats.log: %d, %s\n", errno, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (oai_exit == 0) {
|
||||
char *p = output;
|
||||
|
||||
@@ -2481,13 +2481,13 @@ static const char *get_pdusession_status_text(pdu_session_status_t status)
|
||||
return "illegal";
|
||||
}
|
||||
|
||||
static void write_rrc_stats(const gNB_RRC_INST *rrc)
|
||||
static bool write_rrc_stats(const gNB_RRC_INST *rrc)
|
||||
{
|
||||
const char *filename = "nrRRC_stats.log";
|
||||
FILE *f = fopen(filename, "w");
|
||||
if (f == NULL) {
|
||||
LOG_E(NR_RRC, "cannot open %s for writing\n", filename);
|
||||
return;
|
||||
LOG_W(NR_RRC, "cannot open %s for writing: %d, %s\n", filename, errno, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
@@ -2538,6 +2538,7 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
|
||||
dump_du_info(rrc, f);
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void *rrc_gnb_task(void *args_p) {
|
||||
@@ -2576,10 +2577,12 @@ void *rrc_gnb_task(void *args_p) {
|
||||
break;
|
||||
|
||||
case TIMER_HAS_EXPIRED:
|
||||
if (TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id)
|
||||
write_rrc_stats(RC.nrrrc[0]);
|
||||
else
|
||||
if (TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id) {
|
||||
if (!write_rrc_stats(RC.nrrrc[0]))
|
||||
timer_remove(stats_timer_id);
|
||||
} else {
|
||||
itti_send_msg_to_task(TASK_RRC_GNB, 0, TIMER_HAS_EXPIRED(msg_p).arg); /* see rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() */
|
||||
}
|
||||
break;
|
||||
|
||||
case F1AP_INITIAL_UL_RRC_MESSAGE:
|
||||
|
||||
Reference in New Issue
Block a user