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
promise
OpenXG-RAN
Commits
8195e42d
Commit
8195e42d
authored
May 09, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preliminary work on frame logger
not tested
parent
32b2264f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
1 deletion
+137
-1
common/utils/T/tracer/logger/Makefile
common/utils/T/tracer/logger/Makefile
+1
-1
common/utils/T/tracer/logger/framelog.c
common/utils/T/tracer/logger/framelog.c
+122
-0
common/utils/T/tracer/logger/framelog.h
common/utils/T/tracer/logger/framelog.h
+13
-0
common/utils/T/tracer/view/view.h
common/utils/T/tracer/view/view.h
+1
-0
No files found.
common/utils/T/tracer/logger/Makefile
View file @
8195e42d
CC
=
gcc
CC
=
gcc
CFLAGS
=
-Wall
-g
-pthread
-I
..
CFLAGS
=
-Wall
-g
-pthread
-I
..
OBJS
=
textlog.o
OBJS
=
textlog.o
framelog.o
logger.a
:
$(OBJS)
logger.a
:
$(OBJS)
ar cr logger.a
$(OBJS)
ar cr logger.a
$(OBJS)
...
...
common/utils/T/tracer/logger/framelog.c
0 → 100644
View file @
8195e42d
#include "framelog.h"
#include "handler.h"
#include "database.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
struct
framelog
{
char
*
event_name
;
void
*
database
;
unsigned
long
handler_id
;
int
subframe_arg
;
int
buffer_arg
;
/* list of views */
view
**
v
;
int
vsize
;
float
*
x
;
float
*
buffer
;
int
blength
;
};
static
void
_event
(
void
*
p
,
event
e
)
{
struct
framelog
*
l
=
p
;
int
i
;
int
subframe
;
void
*
buffer
;
int
bsize
;
int
nsamples
;
subframe
=
e
.
e
[
l
->
subframe_arg
].
i
;
buffer
=
e
.
e
[
l
->
buffer_arg
].
b
;
bsize
=
e
.
e
[
l
->
buffer_arg
].
bsize
;
nsamples
=
bsize
/
(
2
*
sizeof
(
int16_t
));
if
(
l
->
blength
!=
nsamples
*
10
)
{
l
->
blength
=
nsamples
*
10
;
free
(
l
->
x
);
free
(
l
->
buffer
);
l
->
x
=
calloc
(
sizeof
(
float
),
l
->
blength
);
if
(
l
->
x
==
NULL
)
abort
();
l
->
buffer
=
calloc
(
sizeof
(
float
),
l
->
blength
);
if
(
l
->
buffer
==
NULL
)
abort
();
/* update 'x' */
for
(
i
=
0
;
i
<
l
->
blength
;
i
++
)
l
->
x
[
i
]
=
i
;
/* update 'length' of views */
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
l
->
v
[
i
]
->
set
(
l
->
v
[
i
],
"length"
,
l
->
blength
);
}
/* TODO: compute the LOGs in the plotter (too much useless computations) */
for
(
i
=
0
;
i
<
nsamples
;
i
++
)
{
int
I
=
((
int16_t
*
)
buffer
)[
i
*
2
];
int
Q
=
((
int16_t
*
)
buffer
)[
i
*
2
+
1
];
l
->
buffer
[
subframe
*
nsamples
+
i
]
=
10
*
log10
(
1
.
0
+
(
float
)(
I
*
I
+
Q
*
Q
));
}
if
(
subframe
==
9
)
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
l
->
v
[
i
]
->
append
(
l
->
v
[
i
],
l
->
x
,
l
->
buffer
,
l
->
blength
);
}
framelog
*
new_framelog
(
event_handler
*
h
,
void
*
database
,
char
*
event_name
,
char
*
subframe_varname
,
char
*
buffer_varname
)
{
struct
framelog
*
ret
;
int
event_id
;
database_event_format
f
;
int
i
;
ret
=
calloc
(
1
,
sizeof
(
struct
framelog
));
if
(
ret
==
NULL
)
abort
();
ret
->
event_name
=
strdup
(
event_name
);
if
(
ret
->
event_name
==
NULL
)
abort
();
ret
->
database
=
database
;
event_id
=
event_id_from_name
(
database
,
event_name
);
ret
->
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
f
=
get_format
(
database
,
event_id
);
/* look for subframe and buffer args */
ret
->
subframe_arg
=
-
1
;
ret
->
buffer_arg
=
-
1
;
for
(
i
=
0
;
i
<
f
.
count
;
i
++
)
{
if
(
!
strcmp
(
f
.
name
[
i
],
subframe_varname
))
ret
->
subframe_arg
=
i
;
if
(
!
strcmp
(
f
.
name
[
i
],
buffer_varname
))
ret
->
buffer_arg
=
i
;
}
if
(
ret
->
subframe_arg
==
-
1
)
{
printf
(
"%s:%d: subframe argument '%s' not found in event '%s'
\n
"
,
__FILE__
,
__LINE__
,
subframe_varname
,
event_name
);
abort
();
}
if
(
ret
->
buffer_arg
==
-
1
)
{
printf
(
"%s:%d: buffer argument '%s' not found in event '%s'
\n
"
,
__FILE__
,
__LINE__
,
buffer_varname
,
event_name
);
abort
();
}
if
(
strcmp
(
f
.
type
[
ret
->
subframe_arg
],
"int"
)
!=
0
)
{
printf
(
"%s:%d: argument '%s' has wrong type (should be 'int')
\n
"
,
__FILE__
,
__LINE__
,
subframe_varname
);
abort
();
}
if
(
strcmp
(
f
.
type
[
ret
->
buffer_arg
],
"buffer"
)
!=
0
)
{
printf
(
"%s:%d: argument '%s' has wrong type (should be 'buffer')
\n
"
,
__FILE__
,
__LINE__
,
buffer_varname
);
abort
();
}
return
ret
;
}
void
framelog_add_view
(
framelog
*
_l
,
view
*
v
)
{
struct
framelog
*
l
=
_l
;
l
->
vsize
++
;
l
->
v
=
realloc
(
l
->
v
,
l
->
vsize
*
sizeof
(
view
*
));
if
(
l
->
v
==
NULL
)
abort
();
l
->
v
[
l
->
vsize
-
1
]
=
v
;
}
common/utils/T/tracer/logger/framelog.h
0 → 100644
View file @
8195e42d
#ifndef _FRAMELOG_H_
#define _FRAMELOG_H_
typedef
void
framelog
;
framelog
*
new_framelog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
subframe_varname
,
char
*
buffer_varname
);
#include "view/view.h"
void
framelog_add_view
(
framelog
*
l
,
view
*
v
);
#endif
/* _FRAMELOG_H_ */
common/utils/T/tracer/view/view.h
View file @
8195e42d
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
typedef
struct
view
{
typedef
struct
view
{
void
(
*
clear
)(
struct
view
*
this
);
void
(
*
clear
)(
struct
view
*
this
);
void
(
*
append
)(
struct
view
*
this
,
...);
void
(
*
append
)(
struct
view
*
this
,
...);
void
(
*
set
)(
struct
view
*
this
,
char
*
name
,
...);
}
view
;
}
view
;
view
*
new_view_stdout
(
void
);
view
*
new_view_stdout
(
void
);
...
...
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