Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
f6656c69
Commit
f6656c69
authored
May 23, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhance log system
parent
c4fdf44d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
116 deletions
+95
-116
common/utils/LOG/log.c
common/utils/LOG/log.c
+29
-44
common/utils/LOG/log.h
common/utils/LOG/log.h
+56
-66
common/utils/system.c
common/utils/system.c
+2
-1
common/utils/system.h
common/utils/system.h
+4
-1
executables/gNBmain.c
executables/gNBmain.c
+2
-2
openair3/NAS/UE/ESM/PdnConnectivity.c
openair3/NAS/UE/ESM/PdnConnectivity.c
+1
-1
targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
.../GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+1
-1
No files found.
common/utils/LOG/log.c
View file @
f6656c69
...
...
@@ -68,7 +68,11 @@ mapping log_options[] = {
{
NULL
,
-
1
}
};
#define COMP_NAME(CoMP) #CoMP,
static
const
char
*
predef_names
[]
=
{
FOREACH_COMP
(
COMP_NAME
)
};
mapping
log_maskmap
[]
=
LOG_MASKMAP_INIT
;
char
*
log_level_highlight_start
[]
=
{
LOG_RED
,
LOG_ORANGE
,
""
,
LOG_BLUE
,
LOG_CYBL
};
/*!< \brief Optional start-format strings for highlighting */
...
...
@@ -248,12 +252,7 @@ void log_getconfig(log_t *g_log) {
memset
(
logparams_logfile
,
0
,
sizeof
(
paramdef_t
)
*
MAX_LOG_PREDEF_COMPONENTS
);
for
(
int
i
=
MIN_LOG_COMPONENTS
;
i
<
MAX_LOG_PREDEF_COMPONENTS
;
i
++
)
{
if
(
g_log
->
log_component
[
i
].
name
==
NULL
)
{
g_log
->
log_component
[
i
].
name
=
malloc
(
16
);
sprintf
((
char
*
)
g_log
->
log_component
[
i
].
name
,
"comp%i?"
,
i
);
logparams_logfile
[
i
].
paramflags
=
PARAMFLAG_DONOTREAD
;
logparams_level
[
i
].
paramflags
=
PARAMFLAG_DONOTREAD
;
}
AssertFatal
(
g_log
->
log_component
[
i
].
name
,
"Must have been intialized before
\n
"
);
sprintf
(
logparams_level
[
i
].
optname
,
LOG_CONFIG_LEVEL_FORMAT
,
g_log
->
log_component
[
i
].
name
);
sprintf
(
logparams_logfile
[
i
].
optname
,
LOG_CONFIG_LOGFILE_FORMAT
,
g_log
->
log_component
[
i
].
name
);
...
...
@@ -282,8 +281,8 @@ void log_getconfig(log_t *g_log) {
/* now set the log levels and infile option, according to what we read */
for
(
int
i
=
MIN_LOG_COMPONENTS
;
i
<
MAX_LOG_PREDEF_COMPONENTS
;
i
++
)
{
g_log
->
log_component
[
i
].
level
=
map_str
_to_int
(
log_level_names
,
*
(
logparams_level
[
i
].
strptr
));
set_log
(
i
,
g_log
->
log_component
[
i
].
level
);
int
level
=
map_str_nocase
_to_int
(
log_level_names
,
*
(
logparams_level
[
i
].
strptr
));
set_log
(
i
,
level
);
if
(
*
(
logparams_logfile
[
i
].
uptr
)
==
1
)
set_component_filelog
(
i
);
...
...
@@ -323,7 +322,7 @@ void log_getconfig(log_t *g_log) {
set_glog_onlinelog
(
consolelog
);
}
int
register_log_component
(
c
har
*
name
,
char
*
fext
,
int
compidx
)
{
int
register_log_component
(
c
onst
char
*
name
,
char
*
fext
,
const
int
compidx
)
{
int
computed_compidx
=
compidx
;
if
(
strlen
(
fext
)
>
3
)
{
...
...
@@ -345,6 +344,7 @@ int register_log_component(char *name, char *fext, int compidx) {
g_log
->
log_component
[
computed_compidx
].
filelog
=
0
;
g_log
->
log_component
[
computed_compidx
].
filelog_name
=
malloc
(
strlen
(
name
)
+
16
);
/* /tmp/<name>.%s */
sprintf
(
g_log
->
log_component
[
computed_compidx
].
filelog_name
,
"/tmp/%s.%s"
,
name
,
fext
);
set_log
(
computed_compidx
,
OAILOG_ERR
);
}
else
{
fprintf
(
stderr
,
"{LOG} %s %d Couldn't register componemt %s
\n
"
,
__FILE__
,
__LINE__
,
name
);
}
...
...
@@ -362,45 +362,18 @@ int logInit (void) {
}
memset
(
g_log
,
0
,
sizeof
(
log_t
));
register_log_component
(
"PHY"
,
"log"
,
PHY
);
register_log_component
(
"MAC"
,
"log"
,
MAC
);
register_log_component
(
"OPT"
,
"log"
,
OPT
);
register_log_component
(
"RLC"
,
"log"
,
RLC
);
register_log_component
(
"PDCP"
,
"log"
,
PDCP
);
register_log_component
(
"RRC"
,
"log"
,
RRC
);
for
(
int
i
=
MIN_LOG_COMPONENTS
;
i
<
MAX_LOG_PREDEF_COMPONENTS
;
i
++
)
{
register_log_component
(
predef_names
[
i
],
"log"
,
i
+
MIN_LOG_COMPONENTS
);
}
register_log_component
(
"OMG"
,
"csv"
,
OMG
);
register_log_component
(
"OTG"
,
"log"
,
OTG
);
register_log_component
(
"OTG_LATENCY"
,
"dat"
,
OTG_LATENCY
);
register_log_component
(
"OTG_LATENCY_BG"
,
"dat"
,
OTG_LATENCY_BG
);
register_log_component
(
"OTG_GP"
,
"dat"
,
OTG_GP
);
register_log_component
(
"OTG_GP_BG"
,
"dat"
,
OTG_GP_BG
);
register_log_component
(
"OTG_JITTER"
,
"dat"
,
OTG_JITTER
);
register_log_component
(
"OCG"
,
""
,
OCG
);
register_log_component
(
"PERF"
,
""
,
PERF
);
register_log_component
(
"OIP"
,
""
,
OIP
);
register_log_component
(
"CLI"
,
""
,
CLI
);
register_log_component
(
"MSC"
,
"log"
,
MSC
);
register_log_component
(
"OCM"
,
"log"
,
OCM
);
register_log_component
(
"HW"
,
""
,
HW
);
register_log_component
(
"OSA"
,
""
,
OSA
);
register_log_component
(
"eRAL"
,
""
,
RAL_ENB
);
register_log_component
(
"mRAL"
,
""
,
RAL_UE
);
register_log_component
(
"ENB_APP"
,
"log"
,
ENB_APP
);
register_log_component
(
"FLEXRAN_AGENT"
,
"log"
,
FLEXRAN_AGENT
);
register_log_component
(
"TMR"
,
""
,
TMR
);
register_log_component
(
"USIM"
,
"txt"
,
USIM
);
register_log_component
(
"SIM"
,
"txt"
,
SIM
);
/* following log component are used for the localization*/
register_log_component
(
"LOCALIZE"
,
"log"
,
LOCALIZE
);
register_log_component
(
"NAS"
,
"log"
,
NAS
);
register_log_component
(
"UDP"
,
""
,
UDP_
);
register_log_component
(
"GTPV1U"
,
""
,
GTPU
);
register_log_component
(
"S1AP"
,
""
,
S1AP
);
register_log_component
(
"X2AP"
,
""
,
X2AP
);
register_log_component
(
"SCTP"
,
""
,
SCTP
);
register_log_component
(
"X2AP"
,
""
,
X2AP
);
register_log_component
(
"LOADER"
,
"log"
,
LOADER
);
register_log_component
(
"ASN"
,
"log"
,
ASN
);
for
(
int
i
=
0
;
log_level_names
[
i
].
name
!=
NULL
;
i
++
)
g_log
->
level2string
[
i
]
=
toupper
(
log_level_names
[
i
].
name
[
0
]);
// uppercased first letter of level name
...
...
@@ -497,10 +470,8 @@ int set_log(int component, int level) {
component
,
MIN_LOG_COMPONENTS
,
MAX_LOG_COMPONENTS
);
DevCheck
((
level
<
NUM_LOG_LEVEL
)
&&
(
level
>=
OAILOG_DISABLE
),
level
,
NUM_LOG_LEVEL
,
OAILOG_ERR
);
if
(
g_log
->
log_component
[
component
].
level
!=
OAILOG_DISABLE
)
g_log
->
log_component
[
component
].
savedlevel
=
g_log
->
log_component
[
component
].
level
;
g_log
->
log_component
[
component
].
savedlevel
=
level
;
g_log
->
log_component
[
component
].
level
=
level
;
return
0
;
}
...
...
@@ -588,6 +559,20 @@ int map_str_to_int(mapping *map, const char *str) {
map
++
;
}
}
int
map_str_nocase_to_int
(
mapping
*
map
,
const
char
*
str
)
{
while
(
1
)
{
if
(
map
->
name
==
NULL
)
{
return
(
-
1
);
}
printf
(
"cmp: %s, %s, res %d
\n
"
,
map
->
name
,
str
,
strcasecmp
(
map
->
name
,
str
));
if
(
!
strcasecmp
(
map
->
name
,
str
))
{
printf
(
"found
\n
"
);
return
(
map
->
value
);
}
map
++
;
}
}
/* map an int to a string. Takes a mapping array and a value */
char
*
map_int_to_str
(
mapping
*
map
,
int
val
)
{
...
...
common/utils/LOG/log.h
View file @
f6656c69
...
...
@@ -176,56 +176,57 @@ extern "C" {
#define SET_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B))
#define FOREACH_COMP(COMP) \
COMP(PHY) \
COMP(MAC) \
COMP(EMU) \
COMP(SIM) \
COMP(OCG) \
COMP(OMG) \
COMP(OPT) \
COMP(OTG) \
COMP(OTG_LATENCY) \
COMP(OTG_LATENCY_BG) \
COMP(OTG_GP) \
COMP(OTG_GP_BG) \
COMP(OTG_JITTER) \
COMP(RLC) \
COMP(PDCP) \
COMP(RRC) \
COMP(NAS) \
COMP( PERF) \
COMP(OIP) \
COMP(CLI) \
COMP(MSC) \
COMP(OCM) \
COMP(UDP_) \
COMP(GTPU) \
COMP(SPGW) \
COMP(S1AP) \
COMP(SCTP) \
COMP(HW) \
COMP(OSA) \
COMP(RAL_ENB) \
COMP(RAL_UE) \
COMP(ENB_APP) \
COMP(FLEXRAN_AGENT) \
COMP(TMR) \
COMP(USIM) \
COMP(LOCALIZE) \
COMP(X2AP) \
COMP(GNB_APP) \
COMP(NR_RRC) \
COMP(NR_MAC) \
COMP(NR_PHY) \
COMP(LOADER) \
COMP(ASN)
#define COMP_ENUM(CoMP) CoMP,
#define MIN_LOG_COMPONENTS 0
typedef
enum
{
MIN_LOG_COMPONENTS
=
0
,
PHY
=
MIN_LOG_COMPONENTS
,
MAC
,
EMU
,
SIM
,
OCG
,
OMG
,
OPT
,
OTG
,
OTG_LATENCY
,
OTG_LATENCY_BG
,
OTG_GP
,
OTG_GP_BG
,
OTG_JITTER
,
RLC
,
PDCP
,
RRC
,
NAS
,
PERF
,
OIP
,
CLI
,
MSC
,
OCM
,
UDP_
,
GTPU
,
SPGW
,
S1AP
,
SCTP
,
HW
,
OSA
,
RAL_ENB
,
RAL_UE
,
ENB_APP
,
FLEXRAN_AGENT
,
TMR
,
USIM
,
LOCALIZE
,
X2AP
,
GNB_APP
,
NR_RRC
,
NR_MAC
,
NR_PHY
,
LOADER
,
ASN
,
MAX_LOG_PREDEF_COMPONENTS
,
}
comp_name_t
;
FOREACH_COMP
(
COMP_ENUM
)
MAX_LOG_PREDEF_COMPONENTS
}
comp_name_t
;
#define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
...
...
@@ -300,11 +301,12 @@ void set_component_filelog(int comp);
void
close_component_filelog
(
int
comp
);
void
set_component_consolelog
(
int
comp
);
int
map_str_to_int
(
mapping
*
map
,
const
char
*
str
);
int
map_str_nocase_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
);
int
register_log_component
(
c
har
*
name
,
char
*
fext
,
int
compidx
);
int
register_log_component
(
c
onst
char
*
name
,
char
*
fext
,
const
int
compidx
);
/* @}*/
...
...
@@ -360,7 +362,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_DUMP_DOUBLE 1
// debugging macros
#define LOG_F LOG_I
/* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
# if T_TRACER
# ifndef T_TRACER
#define T_stdout 1
#endif
/* per component, level dependant macros */
# 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_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)
...
...
@@ -377,21 +381,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# 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...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
/* */
# define LOG_W(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ; } while(0)
/* */
# define LOG_E(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ; } while(0)
/* */
# define LOG_D(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ; } while(0)
/* */
# define LOG_T(c, x...)
/* */
# define LOG_DUMPMSG(c, b, s, x...)
/* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
# define LOG_DEBUGFLAG(D) ( 0 )
# define LOG_DUMPFLAG(D) ( 0 )
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
# define LOG_VAR(A,B)
# endif
/* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define GCC_NOTUSED __attribute__((unused))
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
...
...
common/utils/system.c
View file @
f6656c69
...
...
@@ -197,7 +197,8 @@ void start_background_system(void) {
}
void
threadCreate
(
pthread_t
*
t
,
void
*
(
*
func
)(
void
*
),
void
*
param
,
char
*
name
,
int
affinity
,
int
priority
){
void
threadCreate_impl
(
pthread_t
*
t
,
void
*
(
*
func
)(
void
*
),
void
*
param
,
char
*
name
,
int
affinity
,
int
priority
,
const
char
*
functionName
){
LOG_I
(
TMR
,
"creating thread: %s, for function %s, priotity %d
\n
"
,
name
,
functionName
,
priority
);
pthread_attr_t
attr
;
pthread_attr_init
(
&
attr
);
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_DETACHED
);
...
...
common/utils/system.h
View file @
f6656c69
...
...
@@ -44,8 +44,11 @@ void start_background_system(void);
void
set_latency_target
(
void
);
void
configure_linux
(
void
);
void
threadCreate_impl
(
pthread_t
*
t
,
void
*
(
*
func
)(
void
*
),
void
*
param
,
char
*
name
,
int
affinity
,
int
priority
,
const
char
*
funcName
);
#define threadCreate(t, f, p, n , a, prio) threadCreate_impl(t, f, p, n , a, prio, #f)
void
threadCreate
(
pthread_t
*
t
,
void
*
(
*
func
)(
void
*
),
void
*
param
,
char
*
name
,
int
affinity
,
int
priority
);
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO)
#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10
#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO)
...
...
executables/gNBmain.c
View file @
f6656c69
...
...
@@ -1265,11 +1265,11 @@ void init_RU(const char *rf_config_file) {
}
int
main
(
int
argc
,
char
**
argv
)
{
start_background_system
();
AssertFatal
(
load_configmodule
(
argc
,
argv
)
!=
NULL
,
""
);
logInit
();
start_background_system
();
mode
=
normal_txrx
;
configure_linux
();
logInit
();
printf
(
"Reading in command-line options
\n
"
);
get_options
();
set_taus_seed
(
0
);
...
...
openair3/NAS/UE/ESM/PdnConnectivity.c
View file @
f6656c69
...
...
@@ -358,7 +358,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
int
pid
=
RETURNerror
;
char
apn_first_char
[
4
];
LOG_VAR
(
char
,
str
[
128
]);
LOG_
USEDINLOG_
VAR
(
char
,
str
[
128
]);
if
(
isprint
(
apn
->
value
[
0
]))
{
apn_first_char
[
0
]
=
'\0'
;
...
...
targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
View file @
f6656c69
...
...
@@ -284,7 +284,7 @@ NETWORK_CONTROLLER :
global_log_verbosity
=
"medium"
;
hw_log_level
=
"info"
;
hw_log_verbosity
=
"medium"
;
phy_log_level
=
"
info
"
;
phy_log_level
=
"
debug
"
;
phy_log_verbosity
=
"medium"
;
mac_log_level
=
"info"
;
mac_log_verbosity
=
"high"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment