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];
|
char output[L1STATSSTRLEN];
|
||||||
memset(output,0,L1STATSSTRLEN);
|
memset(output,0,L1STATSSTRLEN);
|
||||||
wait_sync("L1_stats_thread");
|
wait_sync("L1_stats_thread");
|
||||||
FILE *fd;
|
FILE *fd=fopen("nrL1_stats.log","w");
|
||||||
fd=fopen("nrL1_stats.log","w");
|
if (!fd) {
|
||||||
AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n");
|
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->phy_proc_tx);
|
||||||
reset_meas(&gNB->dlsch_encoding_stats);
|
reset_meas(&gNB->dlsch_encoding_stats);
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ void *nrmac_stats_thread(void *arg) {
|
|||||||
char output[MACSTATSSTRLEN] = {0};
|
char output[MACSTATSSTRLEN] = {0};
|
||||||
const char *end = output + MACSTATSSTRLEN;
|
const char *end = output + MACSTATSSTRLEN;
|
||||||
FILE *file = fopen("nrMAC_stats.log","w");
|
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) {
|
while (oai_exit == 0) {
|
||||||
char *p = output;
|
char *p = output;
|
||||||
|
|||||||
@@ -2481,13 +2481,13 @@ static const char *get_pdusession_status_text(pdu_session_status_t status)
|
|||||||
return "illegal";
|
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";
|
const char *filename = "nrRRC_stats.log";
|
||||||
FILE *f = fopen(filename, "w");
|
FILE *f = fopen(filename, "w");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
LOG_E(NR_RRC, "cannot open %s for writing\n", filename);
|
LOG_W(NR_RRC, "cannot open %s for writing: %d, %s\n", filename, errno, strerror(errno));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
@@ -2538,6 +2538,7 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
|
|||||||
dump_du_info(rrc, f);
|
dump_du_info(rrc, f);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *rrc_gnb_task(void *args_p) {
|
void *rrc_gnb_task(void *args_p) {
|
||||||
@@ -2576,10 +2577,12 @@ void *rrc_gnb_task(void *args_p) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TIMER_HAS_EXPIRED:
|
case TIMER_HAS_EXPIRED:
|
||||||
if (TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id)
|
if (TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id) {
|
||||||
write_rrc_stats(RC.nrrrc[0]);
|
if (!write_rrc_stats(RC.nrrrc[0]))
|
||||||
else
|
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() */
|
itti_send_msg_to_task(TASK_RRC_GNB, 0, TIMER_HAS_EXPIRED(msg_p).arg); /* see rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() */
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F1AP_INITIAL_UL_RRC_MESSAGE:
|
case F1AP_INITIAL_UL_RRC_MESSAGE:
|
||||||
|
|||||||
Reference in New Issue
Block a user