Commit cc95e226 authored by frtabu's avatar frtabu

A fix proposal for phy simulators compilation Pb.

parent 717720d8
......@@ -2771,6 +2771,7 @@ add_executable(nr_dlsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/executables/softmodem-common.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
......@@ -2779,6 +2780,7 @@ target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
add_executable(nr_prachsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c
......@@ -2807,6 +2809,7 @@ add_executable(nr_ulsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/executables/softmodem-common.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
......@@ -2815,7 +2818,7 @@ target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_COMMON PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
......@@ -2833,6 +2836,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
add_executable(test_epc_generate_scenario
......
......@@ -60,6 +60,66 @@ softmodem_params_t *get_softmodem_params(void) {
return &softmodem_params;
}
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
struct rusage usage;
struct timespec stop;
clock_gettime(CLOCK_BOOTTIME, &stop);
uint64_t elapse = (stop.tv_sec - start.tv_sec) ; // in seconds
int st = getrusage(RUSAGE_SELF,&usage);
if (!st) {
pf("\nRun time: %lluh %llus\n",(unsigned long long)elapse/3600,(unsigned long long)(elapse - (elapse/3600)));
pf("\tTime executing user inst.: %lds %ldus\n",(long)usage.ru_utime.tv_sec,(long)usage.ru_utime.tv_usec);
pf("\tTime executing system inst.: %lds %ldus\n",(long)usage.ru_stime.tv_sec,(long)usage.ru_stime.tv_usec);
pf("\tMax. Phy. memory usage: %ldkB\n",(long)usage.ru_maxrss);
pf("\tPage fault number (no io): %ld\n",(long)usage.ru_minflt);
pf("\tPage fault number (requiring io): %ld\n",(long)usage.ru_majflt);
pf("\tNumber of file system read: %ld\n",(long)usage.ru_inblock);
pf("\tNumber of filesystem write: %ld\n",(long)usage.ru_oublock);
pf("\tNumber of context switch (process origin, io...): %ld\n",(long)usage.ru_nvcsw);
pf("\tNumber of context switch (os origin, priority...): %ld\n",(long)usage.ru_nivcsw);
}
}
void signal_handler(int sig) {
void *array[10];
size_t size;
if (sig==SIGSEGV) {
// get void*'s for all entries on the stack
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, 2);
exit(-1);
} else {
if(sig==SIGINT ||sig==SOFTMODEM_RTSIGNAL)
softmodem_printresources(sig,(telnet_printfunc_t)printf);
if (sig != SOFTMODEM_RTSIGNAL) {
printf("Linux signal %s...\n",strsignal(sig));
exit_function(__FILE__, __FUNCTION__, __LINE__,"softmodem starting exit procedure\n");
}
}
}
void set_softmodem_sighandler(void) {
struct sigaction act,oldact;
clock_gettime(CLOCK_BOOTTIME, &start);
memset(&act,0,sizeof(act));
act.sa_handler=signal_handler;
sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact);
printf("Send signal %d to display resource usage...\n",SIGRTMIN+1);
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
}
#ifndef PHYSICAL_SIMULATOR
void get_common_options(void) {
uint32_t online_log_messages;
uint32_t glog_level ;
......@@ -123,63 +183,4 @@ void get_common_options(void) {
if(worker_config != NULL) set_worker_conf(worker_config);
}
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
struct rusage usage;
struct timespec stop;
clock_gettime(CLOCK_BOOTTIME, &stop);
uint64_t elapse = (stop.tv_sec - start.tv_sec) ; // in seconds
int st = getrusage(RUSAGE_SELF,&usage);
if (!st) {
pf("\nRun time: %lluh %llus\n",(unsigned long long)elapse/3600,(unsigned long long)(elapse - (elapse/3600)));
pf("\tTime executing user inst.: %lds %ldus\n",(long)usage.ru_utime.tv_sec,(long)usage.ru_utime.tv_usec);
pf("\tTime executing system inst.: %lds %ldus\n",(long)usage.ru_stime.tv_sec,(long)usage.ru_stime.tv_usec);
pf("\tMax. Phy. memory usage: %ldkB\n",(long)usage.ru_maxrss);
pf("\tPage fault number (no io): %ld\n",(long)usage.ru_minflt);
pf("\tPage fault number (requiring io): %ld\n",(long)usage.ru_majflt);
pf("\tNumber of file system read: %ld\n",(long)usage.ru_inblock);
pf("\tNumber of filesystem write: %ld\n",(long)usage.ru_oublock);
pf("\tNumber of context switch (process origin, io...): %ld\n",(long)usage.ru_nvcsw);
pf("\tNumber of context switch (os origin, priority...): %ld\n",(long)usage.ru_nivcsw);
}
}
void signal_handler(int sig) {
void *array[10];
size_t size;
if (sig==SIGSEGV) {
// get void*'s for all entries on the stack
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, 2);
exit(-1);
} else {
if(sig==SIGINT ||sig==SOFTMODEM_RTSIGNAL)
softmodem_printresources(sig,(telnet_printfunc_t)printf);
if (sig != SOFTMODEM_RTSIGNAL) {
printf("Linux signal %s...\n",strsignal(sig));
exit_function(__FILE__, __FUNCTION__, __LINE__,"softmodem starting exit procedure\n");
}
}
}
void set_softmodem_sighandler(void) {
struct sigaction act,oldact;
clock_gettime(CLOCK_BOOTTIME, &start);
memset(&act,0,sizeof(act));
act.sa_handler=signal_handler;
sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact);
printf("Send signal %d to display resource usage...\n",SIGRTMIN+1);
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
}
#endif
\ No newline at end of file
......@@ -109,7 +109,6 @@ void config_common(int Mod_idP,
NR_ServingCellConfigCommon_t *scc
);
uint64_t get_softmodem_optmask(void) {return 0;}
mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
......
......@@ -113,7 +113,6 @@ int generate_dlsch_header(unsigned char *mac_header,
unsigned char *ue_cont_res_id,
unsigned char short_padding,
unsigned short post_padding){return 0;}
uint64_t get_softmodem_optmask(void) {return 0;}
int rlc_module_init (int enb) {return(0);}
void pdcp_layer_init (void) {}
void pdcp_run (const protocol_ctxt_t *const ctxt_pP) { return;}
......
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