Commit e04b8241 authored by Cedric Roux's avatar Cedric Roux
Browse files

Merge remote-tracking branch 'origin/develop_integration_2018_w31' into develop

Summary of changes:
- bug fixes in various places
parents 35ff6111 1cbd60e9
......@@ -897,7 +897,7 @@ set(UTIL_SRC
${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
${OPENAIR2_DIR}/UTIL/LISTS/list.c
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
${OPENAIR2_DIR}/UTIL/LOG/log.c
${OPENAIR_DIR}/common/utils/LOG/log.c
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
......@@ -1214,7 +1214,12 @@ set(PHY_MEX_UE
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
${OPENAIR2_DIR}/UTIL/LOG/log.c
${OPENAIR_DIR}/common/utils/LOG/log.c
${OPENAIR_DIR}/common/utils/T/T.c
${OPENAIR_DIR}/common/utils/T/local_tracer.c
${OPENAIR_DIR}/common/config/config_cmdline.c
${OPENAIR_DIR}/common/config/config_userapi.c
${OPENAIR_DIR}/common/config/config_load_configmodule.c
)
add_library(PHY_MEX ${PHY_MEX_UE})
......@@ -2175,14 +2180,14 @@ if (${T_TRACER})
#all "add_executable" definitions (except tests, rb_tool, updatefw)
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
pdcchsim pucchsim prachsim syncsim
pdcchsim pucchsim prachsim syncsim ulsim
#all "add_library" definitions
ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB)
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()
......
......@@ -508,7 +508,9 @@ function main() {
lte_exec=lte-uesoftmodem
fi
fi
if [ "$T_TRACER" = "False" ] ; then
lte_build_dir=${lte_build_dir}_noLOG
fi
# configuration module libraries, one currently available, using libconfig
config_libconfig_shlib=params_libconfig
......
......@@ -37,6 +37,35 @@
#include <errno.h>
#include "config_userapi.h"
void parse_stringlist(paramdef_t *cfgoptions, char *val)
{
char *atoken;
char *tokctx;
char *tmpval=strdup(val);
int numelt=0;
cfgoptions->numelt=0;
atoken=strtok_r(tmpval, ",",&tokctx);
while(atoken != NULL) {
numelt++ ;
atoken=strtok_r(NULL, ",",&tokctx);
}
free(tmpval);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
cfgoptions->numelt=numelt;
atoken=strtok_r(val, ",",&tokctx);
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
atoken=strtok_r(NULL, ",",&tokctx);
}
cfgoptions->numelt=numelt;
}
int processoption(paramdef_t *cfgoptions, char *value)
{
char *tmpval = value;
......@@ -66,6 +95,7 @@ char defbool[2]="1";
break;
case TYPE_STRINGLIST:
parse_stringlist(cfgoptions,tmpval);
break;
case TYPE_UINT32:
case TYPE_INT32:
......@@ -140,7 +170,7 @@ char *cfgpath;
exit_fun("[CONFIG] Exiting after displaying help\n");
}
} else {
pp=strtok_r(NULL, "_",&tokctx);
pp=strtok_r(NULL, " ",&tokctx);
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
printf ("Help for %s section:\n",prefix);
config_printhelp(cfgoptions,numoptions);
......@@ -167,17 +197,19 @@ char *cfgpath;
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) {
char *valptr=NULL;
int ret;
pp = config_get_if()->argv[i+1];
if (pp != NULL && c > 1) {
ret = strlen(pp);
if (ret > 0 ) {
if (pp[0] != '-')
valptr=pp;
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
valptr=pp;
}
if (c > 0) {
pp = config_get_if()->argv[i+1];
if (pp != NULL ) {
ret = strlen(pp);
if (ret > 0 ) {
if (pp[0] != '-')
valptr=pp;
else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) )
valptr=pp;
}
}
}
j += processoption(&(cfgoptions[n]), pp);
j += processoption(&(cfgoptions[n]), valptr);
if ( valptr != NULL ) {
i++;
c--;
......
......@@ -52,7 +52,7 @@
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include "T.h"
/*----------------------------------------------------------------------------*/
#ifdef __cplusplus
......@@ -73,8 +73,7 @@ extern "C" {
* @ingroup _macro
* @brief the macros that describe the maximum length of LOG
* @{*/
#define MAX_LOG_ITEM 100 /*!< \brief the maximum length of a LOG item, what is LOG_ITEM ??? */
#define MAX_LOG_INFO 1000 /*!< \brief the maximum length of a log */
#define MAX_LOG_TOTAL 1500 /*!< \brief the maximum length of a log */
/* @}*/
......@@ -82,18 +81,15 @@ extern "C" {
* @ingroup _macro
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
* @{*/
# define LOG_EMERG 0 /*!< \brief system is unusable */
# define LOG_ALERT 1 /*!< \brief action must be taken immediately */
# define LOG_CRIT 2 /*!< \brief critical conditions */
# define LOG_ERR 3 /*!< \brief error conditions */
# define LOG_WARNING 4 /*!< \brief warning conditions */
# define LOG_NOTICE 5 /*!< \brief normal but significant condition */
# define LOG_INFO 6 /*!< \brief informational */
# define LOG_DEBUG 7 /*!< \brief debug-level messages */
# define LOG_FILE 8 /*!< \brief message sequence chart -level */
# define LOG_TRACE 9 /*!< \brief trace-level messages */
# define LOG_MATLAB 10 /*!< \brief output to matlab file */
#define NUM_LOG_LEVEL 11 /*!< \brief the number of message levels users have with LOG */
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
# define OAILOG_FILE 1 /*!< \brief important informational messages, but everything OK */
# define OAILOG_WARNING 2 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG */
/* @}*/
......@@ -104,7 +100,7 @@ extern "C" {
/* .log_format = 0x13 uncolored standard messages
* .log_format = 0x93 colored standard messages */
/* keep white space in first position; switching it to 0 allows colors to be disabled*/
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
......@@ -118,34 +114,37 @@ extern "C" {
* @ingroup _macro
* @brief Macros used to write lines (local/remote) in syslog.conf
* @{*/
#define LOG_LOCAL 0x01
#define LOG_REMOTE 0x02
#define FLAG_COLOR 0x001 /*!< \brief defaults */
#define FLAG_PID 0x002 /*!< \brief defaults */
#define FLAG_COMP 0x004
#define FLAG_THREAD 0x008 /*!< \brief all : 255/511 */
#define FLAG_LEVEL 0x010
#define FLAG_FUNCT 0x020
#define FLAG_FILE_LINE 0x040
#define FLAG_TIME 0x100
#define LOG_NONE 0x00
#define LOG_LOW 0x5
#define LOG_MED 0x15
#define LOG_HIGH 0x35
#define LOG_FULL 0x75
#define OAI_OK 0 /*!< \brief all ok */
#define OAI_ERR 1 /*!< \brief generic error */
#define OAI_ERR_READ_ONLY 2 /*!< \brief tried to write to read-only item */
#define OAI_ERR_NOTFOUND 3 /*!< \brief something wasn't found */
/* @}*/
//static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_BLUE, "", "", "", LOG_GREEN}; /*!< \brief Optional start-format strings for highlighting */
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
#define FLAG_FUNCT 0x0020
#define FLAG_FILE_LINE 0x0040
#define FLAG_TIME 0x0100
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
/** @defgroup macros to identify a debug entity
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
* it allows to dynamically activate or not blocks of code
* @brief
* @{*/
#define DEBUG_PRACH (1<<0)
#define DEBUG_RU (1<<1)
#define DEBUG_UE_PHYPROC (1<<2)
#define DEBUG_LTEESTIM (1<<3)
#define DEBUG_CTRLSOCKET (1<<10)
#define UE_TIMING (1<<20)
#define SET_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask | O)
#define CLEAR_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask & (~O))
#define SET_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask | O)
#define CLEAR_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask & (~O))
//static char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, "", "", "", LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
typedef enum {
MIN_LOG_COMPONENTS = 0,
......@@ -193,60 +192,40 @@ comp_name_t;
#define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
//#define msg printf
typedef struct {
char *name; /*!< \brief string name of item */
int value; /*!< \brief integer value of mapping */
} mapping;
typedef int(*log_write_func_t)(FILE *stream, const char *format, va_list ap );
typedef struct {
const char *name;
int level;
int flag;
int interval;
int fd;
int filelog;
char *filelog_name;
const char *name;
int level;
int flag;
int interval;
int filelog;
char *filelog_name;
FILE *stream;
log_write_func_t fwrite;
/* SR: make the log buffer component relative */
char log_buffer[MAX_LOG_TOTAL];
char log_buffer[MAX_LOG_TOTAL];
} log_component_t;
typedef struct {
unsigned int remote_ip;
unsigned int audit_ip;
int remote_level;
int facility;
int audit_facility;
int format;
} log_config_t;
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
log_config_t config;
char* level2string[NUM_LOG_LEVEL];
int level;
int onlinelog;
int flag;
int syslog;
int filelog;
char* filelog_name;
int async; // asynchronous mode, via dedicated log thread + log buffer
uint64_t debug_mask;
uint64_t matlab_mask;
} log_t;
typedef struct LOG_params {
const char *file;
const char *func;
int line;
int comp;
int level;
const char *format;
char l_buff_info [MAX_LOG_INFO];
int len;
} LOG_params;
#if defined(ENABLE_ITTI)
typedef enum log_instance_type_e {
......@@ -258,10 +237,6 @@ typedef enum log_instance_type_e {
void log_set_instance_type (log_instance_type_t instance);
#endif
#define LOG_MEM_SIZE 100*1024*1024
#define LOG_MEM_FILE "./logmem.log"
int logInit_log_mem(void);
void output_log_mem(void);
#ifdef LOG_MAIN
log_t *g_log;
......@@ -279,28 +254,20 @@ extern log_t *g_log;
/*----------------------------------------------------------------------------*/
int logInit (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void logRecord(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
int set_comp_log(int component, int level, int verbosity, int interval);
int set_log(int component, int level, int interval);
void set_glog(int level, int verbosity);
void set_log_syslog(int enable);
void set_glog(int level);
void set_glog_onlinelog(int enable);
void set_glog_filelog(int enable);
void set_component_filelog(int comp);
int map_str_to_int(mapping *map, const char *str);
char *map_int_to_str(mapping *map, int val);
void logClean (void);
int is_newline( char *str, int size);
void *log_thread_function(void * list);
int register_log_component(char *name, char *fext, int compidx);
/** @defgroup _logIt logIt function
* @ingroup _macro
* @brief Macro used to call tr_log_full_ex with file, function and line information
* @{*/
#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
int register_log_component(char *name, char *fext, int compidx);
/* @}*/
......@@ -319,24 +286,34 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define CONFIG_STRING_LOG_PREFIX "log_config"
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
#define LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY "global_log_verbosity"
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
#define LOG_CONFIG_STRING_GLOBAL_LOG_INFILE "global_log_infile"
#define LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS "global_log_options"
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
#define LOG_CONFIG_VERBOSITY_FORMAT "%s_log_verbosity"
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
#define LOG_CONFIG_DEBUG_FORMAT "%s_debug"
#define LOG_CONFIG_MATLAB_FORMAT "%s_matlab"
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
" nocolor: disable color usage in log messages\n"\
" level: add log level indication in log messages\n"\
" thread: add threads names in log messages\n"
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG globalconfiguration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG globalconfiguration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, NULL, 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL, 0, strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, NULL, 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_INFILE, NULL, 0, iptr:&(g_log->filelog), defintval:0, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
}
#define LOG_OPTIONS_IDX 2
/*----------------------------------------------------------------------------------*/
/** @defgroup _debugging debugging macros
* @ingroup _macro
......@@ -344,32 +321,46 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
* @{*/
// debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
# if T_TRACER
# include "T.h"
# define LOG_I(c, x...) do { if (T_stdout) { logIt(c, LOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { logIt(c, LOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_E(c, x...) do { if (T_stdout) { logIt(c, LOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { logIt(c, LOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { logIt(c, LOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_G(c, x...) do { if (T_stdout) { logIt(c, LOG_EMERG, x) ;}} while (0) /* */
# define LOG_A(c, x...) do { if (T_stdout) { logIt(c, LOG_ALERT, x) ;}} while (0) /* */
# define LOG_C(c, x...) do { if (T_stdout) { logIt(c, LOG_CRIT, x) ;}} while (0) /* */
# define LOG_N(c, x...) do { if (T_stdout) { logIt(c, LOG_NOTICE, x) ;}} while (0) /* */
# define LOG_F(c, x...) do { if (T_stdout) { logIt(c, LOG_FILE, x) ;}} while (0) /* */
# define LOG_M(file, vector, data, len, dec, format) write_file_matlab(file, vector, data, len, dec, format)/* */
# else /* T_TRACER */
# if T_TRACER
/* per component, level dependant macros */
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_F(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_FILE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_FILE, x) ;}} while (0) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUG_BEGIN(D) if (g_log->debug_mask & D) {
# define LOG_DEBUG_END }
/* bitmask dependant macros, to generate matlab files */
# define LOG_M_BEGIN(D) if (g_log->matlab_mask & D) {
# define LOG_M_END }
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
/* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
# define LOG_I(c, x...) /* */
# define LOG_W(c, x...) /* */
# define LOG_E(c, x...) /* */
# define LOG_D(c, x...) /* */
# define LOG_T(c, x...) /* */
# define LOG_G(c, x...) /* */
# define LOG_A(c, x...) /* */
# define LOG_C(c, x...) /* */
# define LOG_N(c, x...) /* */
# define LOG_F(c, x...) /* */
# define LOG_M(file, vector, data, len, dec, format) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
# define LOG_DEBUG_BEGIN(D) if (0) {
# define LOG_DEBUG_END }
# define LOG_M_BEGIN(D) if (0) {
# define LOG_M_END }
# define LOG_M(file, vector, data, len, dec, format)
# define LOG_VAR(A,B)
# endif /* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define LOG_USEDINLOG_VAR(A,B) __attribute__((unused)) A B
/* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
/* @}*/
......
......@@ -23,15 +23,8 @@
extern log_t *g_log;
#if !defined(LOG_NO_THREAD)
extern LOG_params log_list[2000];
extern pthread_mutex_t log_lock;
extern pthread_cond_t log_notify;
extern int log_shutdown;
#endif
extern mapping log_level_names[];
extern mapping log_verbosity_names[];
extern mapping log_options[];
extern mapping log_maskmap[];
extern int log_mem_flag;
extern char * log_mem_filename;
......@@ -749,7 +749,6 @@ ID = LEGACY_OSA_TRACE
DESC = OSA legacy logs - trace level
GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_SIM_INFO
DESC = SIM legacy logs - info level
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
......@@ -770,7 +769,6 @@ ID = LEGACY_SIM_TRACE
DESC = SIM legacy logs - trace level
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor
......
......@@ -174,7 +174,8 @@ void usage(void)
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n"
" -b <event> <arg> <vcd name> trace as binary (0 off, anything else on)\n"
" -l <event> <arg> <vcd name> trace as uint64_t\n",
" -l <event> <arg> <vcd name> trace as uint64_t\n"
" -vcd trace all VCD variables and functions\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
......@@ -192,6 +193,20 @@ void force_stop(int x)
run = 0;
}
vcd_vars *add_var(vcd_vars *vars, int nvars,
char *event, char *arg, char *vcd_name, int is_boolean)
{
if (nvars % 64 == 0) {
vars = realloc(vars, (nvars+64) * sizeof(vcd_vars));
if (vars == NULL) abort();
}
vars[nvars].event = event;
vars[nvars].arg = arg;
vars[nvars].vcd_name = vcd_name;
vars[nvars].boolean = is_boolean;
return vars;
}
int main(int n, char **v)
{
char *output_filename = NULL;
......@@ -202,11 +217,12 @@ int main(int n, char **v)
int *is_on;
int number_of_events;
int i;
vcd_vars vars[n];
vcd_vars *vars = NULL;
int nvars = 0;
view *vcd_view;
event_handler *h;
logger *textlog;
int all_vcd = 0;
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
......@@ -221,19 +237,22 @@ int main(int n, char **v)
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-b")) { if(i>n-4)usage();
vars[nvars].event = v[++i];
vars[nvars].arg = v[++i];
vars[nvars].vcd_name = v[++i];
vars[nvars++].boolean = 1;
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 1);
nvars++;
continue;
}
if (!strcmp(v[i], "-l")) { if(i>n-4)usage();
vars[nvars].event = v[++i];
vars[nvars].arg = v[++i];
vars[nvars].vcd_name = v[++i];
vars[nvars++].boolean = 0;
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 0);
nvars++;
continue;
}
if (!strcmp(v[i], "-vcd")) { all_vcd = 1; continue; }
usage();
}
......@@ -260,11 +279,32 @@ int main(int n, char **v)
/* create the view */
vcd_view = new_view_vcd();
if (all_vcd) {
/* activate all VCD traces */
for (i = 0; i < number_of_events; i++) {
int is_boolean;
int prefix_length;
char *name = event_name_from_id(database, i);
char *var_prefix = "VCD_VARIABLE_";
char *fun_prefix = "VCD_FUNCTION_";
if (!strncmp(name, var_prefix, strlen(var_prefix))) {
prefix_length = strlen(var_prefix);
is_boolean = 0;
} else if (!strncmp(name, fun_prefix, strlen(fun_prefix))) {
prefix_length = strlen(fun_prefix);
is_boolean = 1;
} else
continue;
vars = add_var(vars, nvars,
name, "value", name+prefix_length, is_boolean);
nvars++;
}