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
littleBu
OpenXG-RAN
Commits
31821838
Commit
31821838
authored
6 years ago
by
Haruki NAOI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: --log-mem options is erased.
parent
d44ef56e
Branches unavailable
2025.w08
2025.w07
2025.w06
2025.w05
2025.w04
2025.w03
2025.w02
2024.w51
2024.w50
2024.w49
2024.w48
2024.w47
2024.w46
2024.w45
2024.w44
2024.w43
2024.w42
2024.w41
2024.w40
2024.w39
2024.w38
2024.w36
2024.w35
2024.w34
2024.w33
2024.w32
2024.w31
2024.w30
2024.w29
2024.w28
2024.w27
2024.w26
2024.w25
2024.w24
2024.w23
2024.w22
2024.w21
2024.w18
2024.w17
2024.w16
2024.w15
2024.w14
2024.w13
2024.w12
2024.w11
2024.w10
2024.w09
2024.w08
2024.w06
2024.w05
2024.w04
2024.w03
2024.w02
2024.w01
2023.w51
2023.w50
2023.w49
2023.w48
2023.w47
2023.w45
2023.w43
2023.w42
2023.w41
2023.w40
2023.w39
2023.w38
2023.w37
2023.w36
2023.w34
2023.w33
2023.w32
2023.w31
2023.w30
2023.w29
2023.w28
2023.w27
2023.w26
2023.w25
2023.w24
2023.w23
2023.w22
2023.w21
2023.w20
2023.w19
2023.w18
2023.w18b
2023.w16
2023.w15
2023.w14
2023.w13
2023.w12
2023.w11
2023.w11b
2023.w10
2023.w10b
2023.w09
2023.w08
2023.w08b
2023.w07
2023.w06
2023.w05
2023.w03
2023.w02
2022.42
2022.41
2022.w51
2022.w50
2022.w49
2022.w48
2022.w47
2022.w46
2022.w45
2022.w43
2022.w42
2022.w42b
2022.w41
2022.w40
2022.w39
2022.w38
2022.w37
2022.w37b
2022.w36
2022.w35
2022.w33
2022.w32
2022.w31
2022.w31b
2022.w30
2022.w29
2022.w26
2022.w25
2022.w24
2022.w24b
2022.w23
2022.w22
2022.w21
2022.w20
2022.w19
2022.w18
2022.w17
2022.w15
2022.w15b
2022.w14a
2022.w13
2022.w13b
2022.w13a
2022.w12
2022.w10
2022.w09
2022.w09b
2022.w08
2022.w08b
2022.w07
2022.w07b
2022.w06
2022.w06a
2022.w05
2022.w05b
2022.w03_hotfix
2022.w03_b
2022.w02
2022.w01
2021.wk46
2021.wk14_a
2021.wk13_d
2021.wk13_c
2021.w51_c
2021.w51_a
2021.w50_a
2021.w49_b
2021.w49_a
2021.w48
2021.w47
2021.w46
2021.w46-powder
2021.w45
2021.w45_b
2021.w44
2021.w43
2021.w42
2021.w37
2021.w36
2021.w35
2021.w34
2021.w33
2021.w32
2021.w31
2021.w30
2021.w29
2021.w28
2021.w27
2021.w26
2021.w25
2021.w24
2021.w23
2021.w22
2021.w20
2021.w19
2021.w18_b
2021.w18_a
2021.w17_b
2021.w16
2021.w15
2021.w14
2021.w13_a
2021.w12
2021.w11
2021.w10
2021.w09
2021.w08
2021.w06
2021.w05
2021.w04
2021.w02
2020.w51_2
2020.w51
2020.w50
2020.w49
2020.w48_2
2020.w48
2020.w47
2020.w46_2
2020.w46
2020.w45_2
2020.w45
2020.w44
2020.w42_2
2020.w42
2020.w41
2020.w39
2020.w38
2020.w37
2020.w36
2020.w34
2020.w33
2020.w31
2020.w30
2020.w29
2020.w28
2020.w26
2020.w25
2020.w24
2020.w23
2020.w22
2020.w19
2020.w17
2020.w16
2020.w15
2020.w11
2020.w09
2020.w06
2020.w05
2020.w04
2020.w03
2019.w51
2019.w44
2019.w41
2019.w36
2019.w30
2019.w28
2019.w27
2019.w25
2019.w23
2019.w21
2019.w17
2019.w15
2019.w13
2019.w11
2019.w10
2019.w09
2019.w08
2019.w07
2019.w06
2019.w04
2019.w03
2018.w51
2018.w48
2018.w47
2018.w46
2018.w44
2018.w41
2018.w40
2018.w39
2018.w36
v2.2.0
v2.1.0
v2.0.0
v1.2.2
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.3
v1.0.2
v1.0.1
v1.0.0
setparam
osa-etsi-ws-ue
osa-etsi-ws-try2
osa-etsi-ws-try1
osa-etsi-ws-gNB
nr-ip-over-lte
nr-ip-over-lte-v.1.5
nr-ip-over-lte-v.1.4
nr-ip-over-lte-v.1.3
nr-ip-over-lte-v.1.2
nr-ip-over-lte-v.1.1
nr-ip-over-lte-v.1.0
flexran-eol
develop-nr-pdcch
develop-nr-2020w03
develop-nr-2020w02
develop-nr-2019w51
develop-nr-2019w50
develop-nr-2019w48
develop-nr-2019w47
develop-nr-2019w45
develop-nr-2019w43
develop-nr-2019w42
develop-nr-2019w40
develop-nr-2019w28
develop-nr-2019w23
benetel_phase_rotation
benetel_gnb_rel_2.0
benetel_gnb_rel_1.0
benetel_enb_rel_2.0
benetel_enb_rel_1.0
ARC_1.3
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
310 additions
and
20 deletions
+310
-20
common/utils/LOG/log.c
common/utils/LOG/log.c
+282
-17
common/utils/LOG/log.h
common/utils/LOG/log.h
+14
-0
common/utils/LOG/log_extern.h
common/utils/LOG/log_extern.h
+2
-0
common/utils/itti/assertions.h
common/utils/itti/assertions.h
+0
-1
common/utils/itti/signals.c
common/utils/itti/signals.c
+3
-0
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+8
-2
targets/RT/USER/lte-softmodem.h
targets/RT/USER/lte-softmodem.h
+1
-0
No files found.
common/utils/LOG/log.c
View file @
31821838
...
@@ -49,7 +49,18 @@
...
@@ -49,7 +49,18 @@
#include "common/config/config_userapi.h"
#include "common/config/config_userapi.h"
// main log variables
// main log variables
log_mem_cnt_t
log_mem_d
[
2
];
int
log_mem_flag
=
0
;
int
log_mem_multi
=
1
;
volatile
int
log_mem_side
=
0
;
pthread_mutex_t
log_mem_lock
;
pthread_cond_t
log_mem_notify
;
pthread_t
log_mem_thread
;
int
log_mem_file_cnt
=
0
;
volatile
int
log_mem_write_flag
=
0
;
volatile
int
log_mem_write_side
=
0
;
char
__log_mem_filename
[
1024
]
=
{
0
};
char
*
log_mem_filename
=
&
__log_mem_filename
[
0
];
mapping
log_level_names
[]
=
{
mapping
log_level_names
[]
=
{
...
@@ -485,7 +496,7 @@ int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
...
@@ -485,7 +496,7 @@ int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
void
logRecord_mt
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
...
)
void
logRecord_mt
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
...
)
{
{
char
threadname
[
PR_SET_NAME
];
char
threadname
[
PR_SET_NAME
];
char
log_buffer
[
MAX_LOG_TOTAL
];
char
log_buffer
[
MAX_LOG_TOTAL
];
...
@@ -493,23 +504,23 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
...
@@ -493,23 +504,23 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
va_start
(
args
,
format
);
va_start
(
args
,
format
);
if
(
log_mem_flag
==
1
)
{
log_output_memory
(
file
,
func
,
line
,
comp
,
level
,
format
,
args
);
}
else
{
snprintf
(
log_buffer
,
MAX_LOG_TOTAL
,
"%s%s[%s]%s %s %s"
,
log_level_highlight_end
[
level
],
(
(
g_log
->
flag
&
FLAG_NOCOLOR
)
?
""
:
log_level_highlight_start
[
level
]),
g_log
->
log_component
[
comp
].
name
,
(
(
g_log
->
flag
&
FLAG_LEVEL
)
?
g_log
->
level2string
[
level
]
:
""
),
(
(
g_log
->
flag
&
FLAG_THREAD
)
?
log_getthreadname
(
threadname
,
PR_SET_NAME
+
1
)
:
""
),
format
);
g_log
->
log_component
[
comp
].
fwrite
(
g_log
->
log_component
[
comp
].
stream
,
log_buffer
,
args
);
}
snprintf
(
log_buffer
,
MAX_LOG_TOTAL
,
"%s%s[%s]%s %s %s"
,
log_level_highlight_end
[
level
],
(
(
g_log
->
flag
&
FLAG_NOCOLOR
)
?
""
:
log_level_highlight_start
[
level
]),
g_log
->
log_component
[
comp
].
name
,
(
(
g_log
->
flag
&
FLAG_LEVEL
)
?
g_log
->
level2string
[
level
]
:
""
),
(
(
g_log
->
flag
&
FLAG_THREAD
)
?
log_getthreadname
(
threadname
,
PR_SET_NAME
+
1
)
:
""
),
format
);
g_log
->
log_component
[
comp
].
fwrite
(
g_log
->
log_component
[
comp
].
stream
,
log_buffer
,
args
);
va_end
(
args
);
va_end
(
args
);
}
}
...
@@ -531,8 +542,6 @@ int set_log(int component, int level, int interval)
...
@@ -531,8 +542,6 @@ int set_log(int component, int level, int interval)
return
0
;
return
0
;
}
}
void
set_glog
(
int
level
)
void
set_glog
(
int
level
)
{
{
for
(
int
c
=
0
;
c
<
MAX_LOG_COMPONENTS
;
c
++
)
{
for
(
int
c
=
0
;
c
<
MAX_LOG_COMPONENTS
;
c
++
)
{
...
@@ -628,6 +637,262 @@ void logClean (void)
...
@@ -628,6 +637,262 @@ void logClean (void)
}
}
}
}
extern
int
oai_exit
;
void
flush_mem_to_file
(
void
)
{
int
fp
;
char
f_name
[
1024
];
struct
timespec
slp_tm
;
slp_tm
.
tv_sec
=
0
;
slp_tm
.
tv_nsec
=
10000
;
pthread_setname_np
(
pthread_self
(),
"flush_mem_to_file"
);
while
(
!
oai_exit
)
{
pthread_mutex_lock
(
&
log_mem_lock
);
log_mem_write_flag
=
0
;
pthread_cond_wait
(
&
log_mem_notify
,
&
log_mem_lock
);
log_mem_write_flag
=
1
;
pthread_mutex_unlock
(
&
log_mem_lock
);
// write!
if
(
log_mem_d
[
log_mem_write_side
].
enable_flag
==
0
){
if
(
log_mem_file_cnt
>
1
){
log_mem_file_cnt
=
1
;
printf
(
"log over write!!!
\n
"
);
}
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
int
ret
=
write
(
fp
,
log_mem_d
[
log_mem_write_side
].
buf_p
,
log_mem_d
[
log_mem_write_side
].
buf_index
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"{LOG} %s %d Couldn't write in %s
\n
"
,
__FILE__
,
__LINE__
,
f_name
);
exit
(
EXIT_FAILURE
);
}
close
(
fp
);
log_mem_file_cnt
++
;
log_mem_d
[
log_mem_write_side
].
buf_index
=
0
;
log_mem_d
[
log_mem_write_side
].
enable_flag
=
1
;
}
else
{
printf
(
"If you'd like to write log, you should set enable flag to 0!!!
\n
"
);
nanosleep
(
&
slp_tm
,
NULL
);
}
}
}
void
log_output_memory
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
va_list
args
)
{
//logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
int
len
=
0
;
log_component_t
*
c
;
char
*
log_start
;
char
*
log_end
;
/* The main difference with the version above is the use of this local log_buffer.
* The other difference is the return value of snprintf which was not used
* correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
* big enough so that the buffer is never full.
*/
char
log_buffer
[
MAX_LOG_TOTAL
];
/* for no gcc warnings */
(
void
)
log_start
;
(
void
)
log_end
;
c
=
&
g_log
->
log_component
[
comp
];
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD, VCD_FUNCTION_IN);
// make sure that for log trace the extra info is only printed once, reset when the level changes
if
((
level
==
OAILOG_FILE
)
||
(
level
==
OAILOG_TRACE
))
{
log_start
=
log_buffer
;
len
=
vsnprintf
(
log_buffer
,
MAX_LOG_TOTAL
,
format
,
args
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
log_end
=
log_buffer
+
len
;
}
else
{
if
(
(
g_log
->
flag
&
0x001
)
||
(
c
->
flag
&
0x001
)
)
{
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"%s"
,
log_level_highlight_start
[
level
]);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
}
log_start
=
log_buffer
+
len
;
// if ( (g_log->flag & 0x004) || (c->flag & 0x004) ) {
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"[%s]"
,
g_log
->
log_component
[
comp
].
name
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
// }
// if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"[%s]"
,
g_log
->
level2string
[
level
]);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
// }
if
(
(
g_log
->
flag
&
FLAG_THREAD
)
||
(
c
->
flag
&
FLAG_THREAD
)
)
{
# define THREAD_NAME_LEN 128
char
threadname
[
THREAD_NAME_LEN
];
if
(
pthread_getname_np
(
pthread_self
(),
threadname
,
THREAD_NAME_LEN
)
!=
0
)
{
perror
(
"pthread_getname_np : "
);
}
else
{
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"[%s]"
,
threadname
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
}
# undef THREAD_NAME_LEN
}
if
(
(
g_log
->
flag
&
FLAG_FUNCT
)
||
(
c
->
flag
&
FLAG_FUNCT
)
)
{
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"[%s] "
,
func
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
}
if
(
(
g_log
->
flag
&
FLAG_FILE_LINE
)
||
(
c
->
flag
&
FLAG_FILE_LINE
)
)
{
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"[%s:%d]"
,
file
,
line
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
}
//len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%08lx]", thread_id);
//if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
len
+=
vsnprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
format
,
args
);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
log_end
=
log_buffer
+
len
;
if
(
(
g_log
->
flag
&
FLAG_NOCOLOR
)
||
(
c
->
flag
&
FLAG_NOCOLOR
)
)
{
len
+=
snprintf
(
&
log_buffer
[
len
],
MAX_LOG_TOTAL
-
len
,
"%s"
,
log_level_highlight_end
[
level
]);
if
(
len
>
MAX_LOG_TOTAL
)
len
=
MAX_LOG_TOTAL
;
}
}
//va_end(args);
// OAI printf compatibility
if
((
g_log
->
onlinelog
==
1
)
&&
(
level
!=
OAILOG_FILE
))
{
if
(
log_mem_flag
==
1
){
if
(
log_mem_d
[
log_mem_side
].
enable_flag
==
1
){
int
temp_index
;
temp_index
=
log_mem_d
[
log_mem_side
].
buf_index
;
if
(
temp_index
+
len
+
1
<
LOG_MEM_SIZE
){
log_mem_d
[
log_mem_side
].
buf_index
+=
len
;
memcpy
(
&
log_mem_d
[
log_mem_side
].
buf_p
[
temp_index
],
log_buffer
,
len
);
}
else
{
log_mem_d
[
log_mem_side
].
enable_flag
=
0
;
if
(
log_mem_d
[
1
-
log_mem_side
].
enable_flag
==
1
){
temp_index
=
log_mem_d
[
1
-
log_mem_side
].
buf_index
;
if
(
temp_index
+
len
+
1
<
LOG_MEM_SIZE
){
log_mem_d
[
1
-
log_mem_side
].
buf_index
+=
len
;
log_mem_side
=
1
-
log_mem_side
;
memcpy
(
&
log_mem_d
[
log_mem_side
].
buf_p
[
temp_index
],
log_buffer
,
len
);
/* write down !*/
if
(
pthread_mutex_lock
(
&
log_mem_lock
)
!=
0
)
{
return
;
}
if
(
log_mem_write_flag
==
0
){
log_mem_write_side
=
1
-
log_mem_side
;
if
(
pthread_cond_signal
(
&
log_mem_notify
)
!=
0
)
{
}
}
if
(
pthread_mutex_unlock
(
&
log_mem_lock
)
!=
0
)
{
return
;
}
}
else
{
log_mem_d
[
1
-
log_mem_side
].
enable_flag
=
0
;
}
}
}
}
}
else
{
fwrite
(
log_buffer
,
len
,
1
,
stdout
);
}
}
}
int
logInit_log_mem
(
void
)
{
if
(
log_mem_flag
==
1
){
if
(
log_mem_multi
==
1
){
printf
(
"log-mem multi!!!
\n
"
);
log_mem_d
[
0
].
buf_p
=
malloc
(
LOG_MEM_SIZE
);
log_mem_d
[
0
].
buf_index
=
0
;
log_mem_d
[
0
].
enable_flag
=
1
;
log_mem_d
[
1
].
buf_p
=
malloc
(
LOG_MEM_SIZE
);
log_mem_d
[
1
].
buf_index
=
0
;
log_mem_d
[
1
].
enable_flag
=
1
;
log_mem_side
=
0
;
if
((
pthread_mutex_init
(
&
log_mem_lock
,
NULL
)
!=
0
)
||
(
pthread_cond_init
(
&
log_mem_notify
,
NULL
)
!=
0
))
{
log_mem_d
[
1
].
enable_flag
=
0
;
return
-
1
;
}
pthread_create
(
&
log_mem_thread
,
NULL
,
(
void
*
(
*
)(
void
*
))
flush_mem_to_file
,
(
void
*
)
NULL
);
}
else
{
printf
(
"log-mem single!!!
\n
"
);
log_mem_d
[
0
].
buf_p
=
malloc
(
LOG_MEM_SIZE
);
log_mem_d
[
0
].
buf_index
=
0
;
log_mem_d
[
0
].
enable_flag
=
1
;
log_mem_d
[
1
].
enable_flag
=
0
;
log_mem_side
=
0
;
}
}
else
{
log_mem_d
[
0
].
buf_p
=
NULL
;
log_mem_d
[
1
].
buf_p
=
NULL
;
log_mem_d
[
0
].
enable_flag
=
0
;
log_mem_d
[
1
].
enable_flag
=
0
;
}
printf
(
"log init done
\n
"
);
return
0
;
}
void
close_log_mem
(
void
){
int
fp
;
char
f_name
[
1024
];
if
(
log_mem_flag
==
1
){
log_mem_d
[
0
].
enable_flag
=
0
;
log_mem_d
[
1
].
enable_flag
=
0
;
usleep
(
10
);
// wait for log writing
while
(
log_mem_write_flag
==
1
){
usleep
(
100
);
}
if
(
log_mem_multi
==
1
){
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
int
ret
=
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"{LOG} %s %d Couldn't write in %s
\n
"
,
__FILE__
,
__LINE__
,
f_name
);
exit
(
EXIT_FAILURE
);
}
close
(
fp
);
free
(
log_mem_d
[
0
].
buf_p
);
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
ret
=
write
(
fp
,
log_mem_d
[
1
].
buf_p
,
log_mem_d
[
1
].
buf_index
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"{LOG} %s %d Couldn't write in %s
\n
"
,
__FILE__
,
__LINE__
,
f_name
);
exit
(
EXIT_FAILURE
);
}
close
(
fp
);
free
(
log_mem_d
[
1
].
buf_p
);
}
else
{
fp
=
open
(
log_mem_filename
,
O_WRONLY
|
O_CREAT
,
0666
);
int
ret
=
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"{LOG} %s %d Couldn't write in %s
\n
"
,
__FILE__
,
__LINE__
,
log_mem_filename
);
exit
(
EXIT_FAILURE
);
}
close
(
fp
);
free
(
log_mem_d
[
0
].
buf_p
);
}
}
}
#ifdef LOG_TEST
#ifdef LOG_TEST
...
...
This diff is collapsed.
Click to expand it.
common/utils/LOG/log.h
View file @
31821838
...
@@ -269,6 +269,20 @@ int is_newline( char *str, int size);
...
@@ -269,6 +269,20 @@ int is_newline( char *str, int size);
int
register_log_component
(
char
*
name
,
char
*
fext
,
int
compidx
);
int
register_log_component
(
char
*
name
,
char
*
fext
,
int
compidx
);
#define LOG_MEM_SIZE 500*1024*1024
#define LOG_MEM_FILE "./logmem.log"
void
flush_mem_to_file
(
void
);
void
log_output_memory
(
const
char
*
file
,
const
char
*
func
,
int
line
,
int
comp
,
int
level
,
const
char
*
format
,
va_list
args
);
int
logInit_log_mem
(
void
);
void
close_log_mem
(
void
);
typedef
struct
{
char
*
buf_p
;
int
buf_index
;
int
enable_flag
;
}
log_mem_cnt_t
;
/* @}*/
/* @}*/
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
...
...
This diff is collapsed.
Click to expand it.
common/utils/LOG/log_extern.h
View file @
31821838
...
@@ -28,3 +28,5 @@ extern mapping log_level_names[];
...
@@ -28,3 +28,5 @@ extern mapping log_level_names[];
extern
mapping
log_options
[];
extern
mapping
log_options
[];
extern
mapping
log_maskmap
[];
extern
mapping
log_maskmap
[];
extern
int
log_mem_flag
;
extern
char
*
log_mem_filename
;
This diff is collapsed.
Click to expand it.
common/utils/itti/assertions.h
View file @
31821838
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
#ifndef ASSERTIONS_H_
#ifndef ASSERTIONS_H_
#define ASSERTIONS_H_
#define ASSERTIONS_H_
void
output_log_mem
(
void
);
#define _Assert_Exit_ \
#define _Assert_Exit_ \
{ \
{ \
fprintf(stderr, "\nExiting execution\n"); \
fprintf(stderr, "\nExiting execution\n"); \
...
...
This diff is collapsed.
Click to expand it.
common/utils/itti/signals.c
View file @
31821838
...
@@ -117,18 +117,21 @@ int signal_handle(int *end)
...
@@ -117,18 +117,21 @@ int signal_handle(int *end)
case
SIGUSR1
:
case
SIGUSR1
:
SIG_DEBUG
(
"Received SIGUSR1
\n
"
);
SIG_DEBUG
(
"Received SIGUSR1
\n
"
);
*
end
=
1
;
*
end
=
1
;
close_log_mem
();
break
;
break
;
case
SIGSEGV
:
/* Fall through */
case
SIGSEGV
:
/* Fall through */
case
SIGABRT
:
case
SIGABRT
:
SIG_DEBUG
(
"Received SIGABORT
\n
"
);
SIG_DEBUG
(
"Received SIGABORT
\n
"
);
backtrace_handle_signal
(
&
info
);
backtrace_handle_signal
(
&
info
);
close_log_mem
();
break
;
break
;
case
SIGINT
:
case
SIGINT
:
printf
(
"Received SIGINT
\n
"
);
printf
(
"Received SIGINT
\n
"
);
itti_send_terminate_message
(
TASK_UNKNOWN
);
itti_send_terminate_message
(
TASK_UNKNOWN
);
*
end
=
1
;
*
end
=
1
;
close_log_mem
();
break
;
break
;
default:
default:
...
...
This diff is collapsed.
Click to expand it.
targets/RT/USER/lte-softmodem.c
View file @
31821838
...
@@ -70,6 +70,7 @@
...
@@ -70,6 +70,7 @@
unsigned
short
config_frames
[
4
]
=
{
2
,
9
,
11
,
13
};
unsigned
short
config_frames
[
4
]
=
{
2
,
9
,
11
,
13
};
#endif
#endif
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/log_extern.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg_externs.h"
#include "UTIL/OTG/otg_externs.h"
#include "UTIL/MATH/oml.h"
#include "UTIL/MATH/oml.h"
...
@@ -141,7 +142,7 @@ static int8_t threequarter_fs=0;
...
@@ -141,7 +142,7 @@ static int8_t threequarter_fs=0;
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
uint32_t
downlink_frequency
[
MAX_NUM_CCs
][
4
];
int32_t
uplink_frequency_offset
[
MAX_NUM_CCs
][
4
];
int32_t
uplink_frequency_offset
[
MAX_NUM_CCs
][
4
];
char
logmem_filename
[
1024
]
=
{
0
};
// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB)
// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB)
int16_t
dlsch_demod_shift
=
0
;
int16_t
dlsch_demod_shift
=
0
;
...
@@ -550,7 +551,12 @@ static void get_options(void) {
...
@@ -550,7 +551,12 @@ static void get_options(void) {
if
(
start_telnetsrv
)
{
if
(
start_telnetsrv
)
{
load_module_shlib
(
"telnetsrv"
,
NULL
,
0
);
load_module_shlib
(
"telnetsrv"
,
NULL
,
0
);
}
}
if
(
strlen
(
logmem_filename
)
>
0
)
{
log_mem_filename
=
&
logmem_filename
[
0
];
log_mem_flag
=
1
;
printf
(
"Enabling OPT for log save at memory %s
\n
"
,
log_mem_filename
);
logInit_log_mem
();
}
if
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
))
)
{
if
(
!
(
CONFIG_ISFLAGSET
(
CONFIG_ABORT
))
)
{
...
...
This diff is collapsed.
Click to expand it.
targets/RT/USER/lte-softmodem.h
View file @
31821838
...
@@ -202,6 +202,7 @@
...
@@ -202,6 +202,7 @@
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:"./logmem.log", TYPE_STRING, sizeof(logmem_filename)}, \
}
}
#define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_GLOGLEVEL_IDX 1
#define CMDLINE_GLOGLEVEL_IDX 1
...
...
This diff is collapsed.
Click to expand it.
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