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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
f18d59c9
Commit
f18d59c9
authored
Mar 16, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- add channel estimation plot
- add on/off command line options
parent
1f4f0305
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
11 deletions
+98
-11
T_messages.txt
T_messages.txt
+4
-0
tracer/Makefile
tracer/Makefile
+2
-0
tracer/database.c
tracer/database.c
+31
-2
tracer/defs.h
tracer/defs.h
+2
-1
tracer/main.c
tracer/main.c
+53
-4
tracer/plot.c
tracer/plot.c
+6
-4
No files found.
T_messages.txt
View file @
f18d59c9
...
...
@@ -3,6 +3,10 @@ ID = ENB_INPUT_SIGNAL
DESC = eNodeB received signal in the time domain for a duration of 1ms
GROUP = PHY:GRAPHIC:HEAVY
FORMAT = int,eNB_ID : int,frame : int,subframe : int,antenna : buffer,rxdata
ID = ENB_UL_CHANNEL_ESTIMATE
DESC = eNodeB channel estimation in the time domain
GROUP = PHY:GRAPHIC:HEAVY
FORMAT = int,eNB_ID : int,UE_ID : int,frame : int,subframe : int,antenna : buffer,chest_t
#legacy logs
ID = LEGACY_MAC_INFO
...
...
tracer/Makefile
View file @
f18d59c9
CC
=
gcc
CFLAGS
=
-Wall
-g
-pthread
CFLAGS
+=
-O3
-ffast-math
-fomit-frame-pointer
LIBS
=
-lX11
-lm
#comment those two lines to NOT use shared memory
...
...
tracer/database.c
View file @
f18d59c9
...
...
@@ -9,6 +9,7 @@ typedef struct {
char
*
desc
;
char
**
groups
;
int
size
;
int
id
;
}
id
;
typedef
struct
{
...
...
@@ -116,7 +117,7 @@ int string_cmp(const void *_p1, const void *_p2)
return
strcmp
(
*
p1
,
*
p2
);
}
id
*
add_id
(
database
*
r
,
char
*
idname
)
id
*
add_id
(
database
*
r
,
char
*
idname
,
int
i
)
{
if
(
bsearch
(
&
(
id
){
name
:
idname
},
r
->
i
,
r
->
isize
,
sizeof
(
id
),
id_cmp
)
!=
NULL
)
{
printf
(
"ERROR: ID '%s' declared more than once
\n
"
,
idname
);
exit
(
1
);
}
...
...
@@ -129,6 +130,7 @@ id *add_id(database *r, char *idname)
r
->
i
[
r
->
isize
].
desc
=
NULL
;
r
->
i
[
r
->
isize
].
groups
=
NULL
;
r
->
i
[
r
->
isize
].
size
=
0
;
r
->
i
[
r
->
isize
].
id
=
i
;
r
->
isize
++
;
qsort
(
r
->
i
,
r
->
isize
,
sizeof
(
id
),
id_cmp
);
return
(
id
*
)
bsearch
(
&
(
id
){
name
:
idname
},
r
->
i
,
r
->
isize
,
sizeof
(
id
),
id_cmp
);
...
...
@@ -221,6 +223,7 @@ void *parse_database(char *filename)
database
*
r
;
char
*
name
,
*
value
;
id
*
last_id
=
NULL
;
int
i
;
r
=
calloc
(
1
,
sizeof
(
*
r
));
if
(
r
==
NULL
)
abort
();
memset
(
&
p
,
0
,
sizeof
(
p
));
...
...
@@ -229,11 +232,13 @@ void *parse_database(char *filename)
in
=
fopen
(
filename
,
"r"
);
if
(
in
==
NULL
)
{
perror
(
filename
);
abort
();
}
i
=
0
;
while
(
1
)
{
get_line
(
&
p
,
in
,
&
name
,
&
value
);
if
(
name
==
NULL
)
break
;
//printf("%s %s\n", name, value);
if
(
!
strcmp
(
name
,
"ID"
))
last_id
=
add_id
(
r
,
value
);
if
(
!
strcmp
(
name
,
"ID"
))
{
last_id
=
add_id
(
r
,
value
,
i
);
i
++
;
}
if
(
!
strcmp
(
name
,
"GROUP"
))
add_groups
(
r
,
last_id
,
value
);
if
(
!
strcmp
(
name
,
"DESC"
))
add_desc
(
last_id
,
value
);
}
...
...
@@ -280,3 +285,27 @@ void list_groups(void *_d)
int
i
;
for
(
i
=
0
;
i
<
d
->
gsize
;
i
++
)
printf
(
"%s
\n
"
,
d
->
g
[
i
].
name
);
}
static
void
onoff_id
(
database
*
d
,
char
*
name
,
int
*
a
,
int
onoff
)
{
id
*
i
;
i
=
bsearch
(
&
(
id
){
name
:
name
},
d
->
i
,
d
->
isize
,
sizeof
(
id
),
id_cmp
);
if
(
i
==
NULL
)
return
;
a
[
i
->
id
]
=
onoff
;
printf
(
"turning %s %s
\n
"
,
name
,
onoff
?
"ON"
:
"OFF"
);
}
static
void
onoff_group
(
database
*
d
,
char
*
name
,
int
*
a
,
int
onoff
)
{
group
*
g
;
int
i
;
g
=
bsearch
(
&
(
group
){
name
:
name
},
d
->
g
,
d
->
gsize
,
sizeof
(
group
),
group_cmp
);
if
(
g
==
NULL
)
return
;
for
(
i
=
0
;
i
<
g
->
size
;
i
++
)
onoff_id
(
d
,
g
->
ids
[
i
],
a
,
onoff
);
}
void
on_off
(
void
*
d
,
char
*
item
,
int
*
a
,
int
onoff
)
{
onoff_group
(
d
,
item
,
a
,
onoff
);
onoff_id
(
d
,
item
,
a
,
onoff
);
}
tracer/defs.h
View file @
f18d59c9
#ifndef _TRACER_DEFS_H_
#define _TRACER_DEFS_H_
void
*
make_plot
(
int
width
,
int
height
,
int
bufsize
);
void
*
make_plot
(
int
width
,
int
height
,
int
bufsize
,
char
*
title
);
void
plot_set
(
void
*
plot
,
float
*
data
,
int
len
,
int
pos
);
void
iq_plot_set
(
void
*
plot
,
short
*
data
,
int
len
,
int
pos
);
...
...
@@ -10,5 +10,6 @@ void *parse_database(char *filename);
void
dump_database
(
void
*
database
);
void
list_ids
(
void
*
database
);
void
list_groups
(
void
*
database
);
void
on_off
(
void
*
d
,
char
*
item
,
int
*
a
,
int
onoff
);
#endif
/* _TRACER_DEFS_H_ */
tracer/main.c
View file @
f18d59c9
...
...
@@ -15,6 +15,7 @@
#include "../T_defs.h"
void
*
ul_plot
;
void
*
chest_plot
;
#ifdef T_USE_SHARED_MEMORY
...
...
@@ -209,11 +210,30 @@ void get_message(int s)
GET
(
s
,
&
antenna
,
sizeof
(
int
));
GET
(
s
,
&
size
,
sizeof
(
int
));
GET
(
s
,
buf
,
size
);
#if 0
printf("got T_ENB_INPUT_SIGNAL eNB %d frame %d subframe %d antenna %d size %d %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
eNB, frame, subframe, antenna, size, buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7],buf[8],buf[9],buf[10],buf[11],buf[12],buf[13],buf[14],buf[15]);
#endif
if
(
size
!=
4
*
7680
)
{
printf
(
"bad T_ENB_INPUT_SIGNAL, only 7680 samples allowed
\n
"
);
abort
();}
iq_plot_set
(
ul_plot
,
(
short
*
)
buf
,
7680
,
subframe
*
7680
);
if
(
ul_plot
)
iq_plot_set
(
ul_plot
,
(
short
*
)
buf
,
7680
,
subframe
*
7680
);
break
;
}
case
T_ENB_UL_CHANNEL_ESTIMATE
:
{
unsigned
char
buf
[
T_BUFFER_MAX
];
int
size
;
int
eNB
,
UE
,
frame
,
subframe
,
antenna
;
GET
(
s
,
&
eNB
,
sizeof
(
int
));
GET
(
s
,
&
UE
,
sizeof
(
int
));
GET
(
s
,
&
frame
,
sizeof
(
int
));
GET
(
s
,
&
subframe
,
sizeof
(
int
));
GET
(
s
,
&
antenna
,
sizeof
(
int
));
GET
(
s
,
&
size
,
sizeof
(
int
));
GET
(
s
,
buf
,
size
);
if
(
size
!=
512
*
4
)
{
printf
(
"bad T_ENB_UL_CHANNEL_ESTIMATE, only 512 samples allowed
\n
"
);
abort
();}
if
(
chest_plot
)
iq_plot_set
(
chest_plot
,
(
short
*
)
buf
,
512
,
0
);
break
;
}
case
T_buf_test
:
{
...
...
@@ -265,6 +285,11 @@ void usage(void)
" -li print IDs in the database
\n
"
" -lg print GROUPs in the database
\n
"
" -dump dump the database
\n
"
" -x run with XFORMS (revisited)
\n
"
" -on <GROUP or ID> turn log ON for given GROUP or ID
\n
"
" -off <GROUP or ID> turn log OFF for given GROUP or ID
\n
"
"note: you may pass several -on and -off, they will be processed in order
\n
"
" by default, all is off
\n
"
);
exit
(
1
);
}
...
...
@@ -280,6 +305,16 @@ int main(int n, char **v)
int
do_list_ids
=
0
;
int
do_list_groups
=
0
;
int
do_dump_database
=
0
;
int
do_xforms
=
0
;
char
**
on_off_name
;
int
*
on_off_action
;
int
on_off_n
=
0
;
int
is_on
[
T_NUMBER_OF_IDS
];
memset
(
is_on
,
0
,
sizeof
(
is_on
));
on_off_name
=
malloc
(
n
*
sizeof
(
char
*
));
if
(
on_off_name
==
NULL
)
abort
();
on_off_action
=
malloc
(
n
*
sizeof
(
int
));
if
(
on_off_action
==
NULL
)
abort
();
for
(
i
=
1
;
i
<
n
;
i
++
)
{
if
(
!
strcmp
(
v
[
i
],
"-h"
)
||
!
strcmp
(
v
[
i
],
"--help"
))
usage
();
...
...
@@ -288,6 +323,12 @@ int main(int n, char **v)
if
(
!
strcmp
(
v
[
i
],
"-li"
))
{
do_list_ids
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-lg"
))
{
do_list_groups
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-dump"
))
{
do_dump_database
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-x"
))
{
do_xforms
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-on"
))
{
if
(
i
>
n
-
2
)
usage
();
on_off_name
[
on_off_n
]
=
v
[
++
i
];
on_off_action
[
on_off_n
++
]
=
1
;
continue
;
}
if
(
!
strcmp
(
v
[
i
],
"-off"
))
{
if
(
i
>
n
-
2
)
usage
();
on_off_name
[
on_off_n
]
=
v
[
++
i
];
on_off_action
[
on_off_n
++
]
=
0
;
continue
;
}
printf
(
"ERROR: unknown option %s
\n
"
,
v
[
i
]);
usage
();
}
...
...
@@ -303,7 +344,13 @@ int main(int n, char **v)
if
(
do_list_groups
)
{
list_groups
(
database
);
return
0
;
}
if
(
do_dump_database
)
{
dump_database
(
database
);
return
0
;
}
ul_plot
=
make_plot
(
512
,
100
,
7680
*
2
*
10
);
if
(
do_xforms
)
{
ul_plot
=
make_plot
(
512
,
100
,
7680
*
2
*
10
,
"UL Input Signal"
);
chest_plot
=
make_plot
(
512
,
100
,
512
*
2
,
"UL Channel Estimate UE 0"
);
}
for
(
i
=
0
;
i
<
on_off_n
;
i
++
)
on_off
(
database
,
on_off_name
[
i
],
is_on
,
on_off_action
[
i
]);
#ifdef T_USE_SHARED_MEMORY
init_shm
();
...
...
@@ -312,9 +359,11 @@ int main(int n, char **v)
/* send the first message - activate all traces */
t
=
0
;
if
(
write
(
s
,
&
t
,
1
)
!=
1
)
abort
();
l
=
T_NUMBER_OF_IDS
;
l
=
0
;
for
(
i
=
0
;
i
<
T_NUMBER_OF_IDS
;
i
++
)
if
(
is_on
[
i
])
l
++
;
if
(
write
(
s
,
&
l
,
sizeof
(
int
))
!=
sizeof
(
int
))
abort
();
for
(
l
=
0
;
l
<
T_NUMBER_OF_IDS
;
l
++
)
if
(
is_on
[
l
])
if
(
write
(
s
,
&
l
,
sizeof
(
int
))
!=
sizeof
(
int
))
abort
();
/* read messages */
...
...
tracer/plot.c
View file @
f18d59c9
...
...
@@ -44,15 +44,15 @@ static void *plot_thread(void *_p)
{
int
i
;
for
(
i
=
0
;
i
<
512
*
150
;
i
++
)
for
(
i
=
0
;
i
<
p
->
bufsize
/
2
;
i
++
)
p
->
buf
[
i
]
=
10
*
log10
(
1
.
0
+
(
float
)(
p
->
iqbuf
[
2
*
i
]
*
p
->
iqbuf
[
2
*
i
]
+
p
->
iqbuf
[
2
*
i
+
1
]
*
p
->
iqbuf
[
2
*
i
+
1
]));
}
s
=
p
->
buf
;
for
(
i
=
0
;
i
<
512
;
i
++
)
{
v
=
0
;
for
(
j
=
0
;
j
<
150
;
j
++
,
s
++
)
v
+=
*
s
;
v
/=
150
;
for
(
j
=
0
;
j
<
p
->
bufsize
/
2
/
512
;
j
++
,
s
++
)
v
+=
*
s
;
v
/=
p
->
bufsize
/
2
/
512
;
XDrawLine
(
p
->
d
,
p
->
p
,
DefaultGC
(
p
->
d
,
DefaultScreen
(
p
->
d
)),
i
,
100
,
i
,
100
-
v
);
}
...
...
@@ -79,7 +79,7 @@ static void new_thread(void *(*f)(void *), void *data)
{
fprintf
(
stderr
,
"pthread_attr_destroy err
\n
"
);
exit
(
1
);
}
}
void
*
make_plot
(
int
width
,
int
height
,
int
bufsize
)
void
*
make_plot
(
int
width
,
int
height
,
int
bufsize
,
char
*
title
)
{
plot
*
p
;
Display
*
d
;
...
...
@@ -92,6 +92,8 @@ void *make_plot(int width, int height, int bufsize)
XSelectInput
(
d
,
w
,
ExposureMask
);
XMapWindow
(
d
,
w
);
XStoreName
(
d
,
w
,
title
);
pm
=
XCreatePixmap
(
d
,
w
,
width
,
height
,
DefaultDepth
(
d
,
DefaultScreen
(
d
)));
p
=
malloc
(
sizeof
(
*
p
));
if
(
p
==
NULL
)
abort
();
...
...
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