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
zzha zzha
OpenXG-RAN
Commits
8e28dacd
Commit
8e28dacd
authored
Jun 17, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a small utility to extract a configuration file from a log
parent
99d1328d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
1 deletion
+80
-1
common/utils/T/tracer/Makefile
common/utils/T/tracer/Makefile
+5
-1
common/utils/T/tracer/extract_config.c
common/utils/T/tracer/extract_config.c
+75
-0
No files found.
common/utils/T/tracer/Makefile
View file @
8e28dacd
...
...
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
LIBS
=
-lX11
-lm
-lpng
-lXft
all
:
record replay textlog enb vcd
all
:
record replay
extract_config
textlog enb vcd
record
:
utils.o record.o database.o config.o
$(CC)
$(CFLAGS)
-o
record
$^
$(LIBS)
...
...
@@ -13,6 +13,9 @@ record: utils.o record.o database.o config.o
replay
:
utils.o replay.o
$(CC)
$(CFLAGS)
-o
replay
$^
$(LIBS)
extract_config
:
extract_config.o
$(CC)
$(CFLAGS)
-o
extract_config
$^
$(LIBS)
textlog
:
utils.o textlog.o database.o event.o handler.o config.o
\
event_selector.o view/view.a gui/gui.a logger/logger.a
\
filter/filter.a
...
...
@@ -47,6 +50,7 @@ filter/filter.a:
clean
:
rm
-f
*
.o core tracer_remote textlog enb vcd record replay
rm
-f
extract_config
cd
gui
&&
make clean
cd
view
&&
make clean
cd
logger
&&
make clean
...
...
common/utils/T/tracer/extract_config.c
0 → 100644
View file @
8e28dacd
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../T_defs.h"
void
usage
(
void
)
{
printf
(
"options:
\n
"
" -i <input file> this option is mandatory
\n
"
);
exit
(
1
);
}
#define ERR printf("ERROR: read file %s failed\n", input_filename)
int
main
(
int
n
,
char
**
v
)
{
char
*
input_filename
=
NULL
;
int
i
;
FILE
*
in
;
for
(
i
=
1
;
i
<
n
;
i
++
)
{
if
(
!
strcmp
(
v
[
i
],
"-h"
)
||
!
strcmp
(
v
[
i
],
"--help"
))
usage
();
if
(
!
strcmp
(
v
[
i
],
"-i"
))
{
if
(
i
>
n
-
2
)
usage
();
input_filename
=
v
[
++
i
];
continue
;
}
usage
();
}
if
(
input_filename
==
NULL
)
{
printf
(
"ERROR: provide an input file (-i)
\n
"
);
exit
(
1
);
}
in
=
fopen
(
input_filename
,
"r"
);
if
(
in
==
NULL
)
{
perror
(
input_filename
);
abort
();
}
while
(
1
)
{
int
type
;
int32_t
length
;
char
v
[
T_BUFFER_MAX
];
int
vpos
=
0
;
/* read event from file */
if
(
fread
(
&
length
,
4
,
1
,
in
)
!=
1
)
break
;
memcpy
(
v
+
vpos
,
&
length
,
4
);
vpos
+=
4
;
#ifdef T_SEND_TIME
if
(
length
<
sizeof
(
struct
timespec
))
{
ERR
;
break
;
}
if
(
fread
(
v
+
vpos
,
sizeof
(
struct
timespec
),
1
,
in
)
!=
1
)
{
ERR
;
break
;
}
vpos
+=
sizeof
(
struct
timespec
);
length
-=
sizeof
(
struct
timespec
);
#endif
if
(
length
<
sizeof
(
int
))
{
ERR
;
break
;
}
if
(
fread
(
&
type
,
sizeof
(
int
),
1
,
in
)
!=
1
)
{
ERR
;
break
;
}
memcpy
(
v
+
vpos
,
&
type
,
sizeof
(
int
));
vpos
+=
sizeof
(
int
);
length
-=
sizeof
(
int
);
if
(
length
)
if
(
fread
(
v
+
vpos
,
length
,
1
,
in
)
!=
1
)
{
ERR
;
break
;
}
vpos
+=
length
;
if
(
type
==
-
1
)
{
if
(
length
<
sizeof
(
int
))
{
ERR
;
break
;
}
length
-=
sizeof
(
int
);
if
(
fwrite
(
v
+
vpos
-
length
,
length
,
1
,
stdout
)
!=
1
)
{
ERR
;
break
;
}
}
/* TODO: parse all file? */
if
(
type
==
-
2
)
break
;
}
fclose
(
in
);
return
0
;
}
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