Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OAI-RAN-5G-sheduler_MaxTBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAQ5G-PFC
OAI-RAN-5G-sheduler_MaxTBS
Commits
8e28dacd
Commit
8e28dacd
authored
8 years ago
by
Cedric Roux
Browse files
Options
Downloads
Patches
Plain Diff
add a small utility to extract a configuration file from a log
parent
99d1328d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/utils/T/tracer/Makefile
+5
-1
5 additions, 1 deletion
common/utils/T/tracer/Makefile
common/utils/T/tracer/extract_config.c
+75
-0
75 additions, 0 deletions
common/utils/T/tracer/extract_config.c
with
80 additions
and
1 deletion
common/utils/T/tracer/Makefile
+
5
−
1
View file @
8e28dacd
...
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
...
@@ -5,7 +5,7 @@ CFLAGS=-Wall -g -pthread -DT_TRACER -I.
LIBS
=
-lX11
-lm
-lpng
-lXft
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
record
:
utils.o record.o database.o config.o
$(
CC
)
$(
CFLAGS
)
-o
record
$^
$(
LIBS
)
$(
CC
)
$(
CFLAGS
)
-o
record
$^
$(
LIBS
)
...
@@ -13,6 +13,9 @@ record: utils.o record.o database.o config.o
...
@@ -13,6 +13,9 @@ record: utils.o record.o database.o config.o
replay
:
utils.o replay.o
replay
:
utils.o replay.o
$(
CC
)
$(
CFLAGS
)
-o
replay
$^
$(
LIBS
)
$(
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
\
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
\
event_selector.o view/view.a gui/gui.a logger/logger.a
\
filter/filter.a
filter/filter.a
...
@@ -47,6 +50,7 @@ filter/filter.a:
...
@@ -47,6 +50,7 @@ filter/filter.a:
clean
:
clean
:
rm
-f
*
.o core tracer_remote textlog enb vcd record replay
rm
-f
*
.o core tracer_remote textlog enb vcd record replay
rm
-f
extract_config
cd
gui
&&
make clean
cd
gui
&&
make clean
cd
view
&&
make clean
cd
view
&&
make clean
cd
logger
&&
make clean
cd
logger
&&
make clean
...
...
This diff is collapsed.
Click to expand it.
common/utils/T/tracer/extract_config.c
0 → 100644
+
75
−
0
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
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment