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
lizhongxiao
OpenXG-RAN
Commits
e5689a5b
Commit
e5689a5b
authored
May 12, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introducing a generic logger "class"
parent
d8ec913b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
103 deletions
+77
-103
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
+11
-21
common/utils/T/tracer/logger/framelog.h
common/utils/T/tracer/logger/framelog.h
+0
-13
common/utils/T/tracer/logger/logger.c
common/utils/T/tracer/logger/logger.c
+11
-0
common/utils/T/tracer/logger/logger.h
common/utils/T/tracer/logger/logger.h
+18
-0
common/utils/T/tracer/logger/logger_defs.h
common/utils/T/tracer/logger/logger_defs.h
+14
-0
common/utils/T/tracer/logger/textlog.c
common/utils/T/tracer/logger/textlog.c
+10
-19
common/utils/T/tracer/logger/textlog.h
common/utils/T/tracer/logger/textlog.h
+0
-13
common/utils/T/tracer/logger/ttilog.c
common/utils/T/tracer/logger/ttilog.c
+9
-19
common/utils/T/tracer/logger/ttilog.h
common/utils/T/tracer/logger/ttilog.h
+0
-14
common/utils/T/tracer/textlog.c
common/utils/T/tracer/textlog.c
+3
-3
No files found.
common/utils/T/tracer/logger/Makefile
View file @
e5689a5b
CC
=
gcc
CC
=
gcc
CFLAGS
=
-Wall
-g
-pthread
-I
..
CFLAGS
=
-Wall
-g
-pthread
-I
..
OBJS
=
textlog.o framelog.o ttilog.o
OBJS
=
logger.o
textlog.o framelog.o ttilog.o
logger.a
:
$(OBJS)
logger.a
:
$(OBJS)
ar cr logger.a
$(OBJS)
ar cr logger.a
$(OBJS)
...
...
common/utils/T/tracer/logger/framelog.c
View file @
e5689a5b
#include "framelog.h"
#include "logger.h"
#include "logger_defs.h"
#include "handler.h"
#include "handler.h"
#include "database.h"
#include "database.h"
#include <stdlib.h>
#include <stdlib.h>
...
@@ -7,14 +8,10 @@
...
@@ -7,14 +8,10 @@
#include <math.h>
#include <math.h>
struct
framelog
{
struct
framelog
{
char
*
event_name
;
struct
logger
common
;
void
*
database
;
void
*
database
;
unsigned
long
handler_id
;
int
subframe_arg
;
int
subframe_arg
;
int
buffer_arg
;
int
buffer_arg
;
/* list of views */
view
**
v
;
int
vsize
;
float
*
x
;
float
*
x
;
float
*
buffer
;
float
*
buffer
;
int
blength
;
int
blength
;
...
@@ -47,8 +44,8 @@ static void _event(void *p, event e)
...
@@ -47,8 +44,8 @@ static void _event(void *p, event e)
for
(
i
=
0
;
i
<
l
->
blength
;
i
++
)
for
(
i
=
0
;
i
<
l
->
blength
;
i
++
)
l
->
x
[
i
]
=
i
;
l
->
x
[
i
]
=
i
;
/* update 'length' of views */
/* update 'length' of views */
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
for
(
i
=
0
;
i
<
l
->
common
.
vsize
;
i
++
)
l
->
v
[
i
]
->
set
(
l
->
v
[
i
],
"length"
,
l
->
blength
);
l
->
common
.
v
[
i
]
->
set
(
l
->
common
.
v
[
i
],
"length"
,
l
->
blength
);
}
}
/* TODO: compute the LOGs in the plotter (too much useless computations) */
/* TODO: compute the LOGs in the plotter (too much useless computations) */
...
@@ -59,11 +56,11 @@ static void _event(void *p, event e)
...
@@ -59,11 +56,11 @@ static void _event(void *p, event e)
}
}
if
(
subframe
==
9
)
if
(
subframe
==
9
)
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
for
(
i
=
0
;
i
<
l
->
common
.
vsize
;
i
++
)
l
->
v
[
i
]
->
append
(
l
->
v
[
i
],
l
->
x
,
l
->
buffer
,
l
->
blength
);
l
->
common
.
v
[
i
]
->
append
(
l
->
common
.
v
[
i
],
l
->
x
,
l
->
buffer
,
l
->
blength
);
}
}
framelog
*
new_framelog
(
event_handler
*
h
,
void
*
database
,
logger
*
new_framelog
(
event_handler
*
h
,
void
*
database
,
char
*
event_name
,
char
*
subframe_varname
,
char
*
buffer_varname
)
char
*
event_name
,
char
*
subframe_varname
,
char
*
buffer_varname
)
{
{
struct
framelog
*
ret
;
struct
framelog
*
ret
;
...
@@ -73,12 +70,13 @@ framelog *new_framelog(event_handler *h, void *database,
...
@@ -73,12 +70,13 @@ framelog *new_framelog(event_handler *h, void *database,
ret
=
calloc
(
1
,
sizeof
(
struct
framelog
));
if
(
ret
==
NULL
)
abort
();
ret
=
calloc
(
1
,
sizeof
(
struct
framelog
));
if
(
ret
==
NULL
)
abort
();
ret
->
event_name
=
strdup
(
event_name
);
if
(
ret
->
event_name
==
NULL
)
abort
();
ret
->
common
.
event_name
=
strdup
(
event_name
);
if
(
ret
->
common
.
event_name
==
NULL
)
abort
();
ret
->
database
=
database
;
ret
->
database
=
database
;
event_id
=
event_id_from_name
(
database
,
event_name
);
event_id
=
event_id_from_name
(
database
,
event_name
);
ret
->
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
ret
->
common
.
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
f
=
get_format
(
database
,
event_id
);
f
=
get_format
(
database
,
event_id
);
...
@@ -112,11 +110,3 @@ framelog *new_framelog(event_handler *h, void *database,
...
@@ -112,11 +110,3 @@ framelog *new_framelog(event_handler *h, void *database,
return
ret
;
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
deleted
100644 → 0
View file @
d8ec913b
#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/logger/logger.c
0 → 100644
View file @
e5689a5b
#include "logger.h"
#include "logger_defs.h"
#include <stdlib.h>
void
logger_add_view
(
logger
*
_l
,
view
*
v
)
{
struct
logger
*
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/logger.h
0 → 100644
View file @
e5689a5b
#ifndef _LOGGER_H_
#define _LOGGER_H_
typedef
void
logger
;
logger
*
new_framelog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
subframe_varname
,
char
*
buffer_varname
);
logger
*
new_textlog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
format
);
logger
*
new_ttilog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
frame_varname
,
char
*
subframe_varname
,
char
*
data_varname
,
int
convert_to_dB
);
#include "view/view.h"
void
logger_add_view
(
logger
*
l
,
view
*
v
);
#endif
/* _LOGGER_H_ */
common/utils/T/tracer/logger/logger_defs.h
0 → 100644
View file @
e5689a5b
#ifndef _LOGGER_DEFS_H_
#define _LOGGER_DEFS_H_
#include "view/view.h"
struct
logger
{
char
*
event_name
;
unsigned
long
handler_id
;
/* list of views */
view
**
v
;
int
vsize
;
};
#endif
/* _LOGGER_DEFS_H_ */
common/utils/T/tracer/logger/textlog.c
View file @
e5689a5b
#include "textlog.h"
#include "logger.h"
#include "logger_defs.h"
#include "handler.h"
#include "handler.h"
#include "database.h"
#include "database.h"
#include "view/view.h"
#include "view/view.h"
...
@@ -22,16 +23,12 @@ struct format_item {
...
@@ -22,16 +23,12 @@ struct format_item {
};
};
struct
textlog
{
struct
textlog
{
char
*
event_name
;
struct
logger
common
;
char
*
format
;
char
*
format
;
void
*
database
;
void
*
database
;
unsigned
long
handler_id
;
/* parsed format string */
/* parsed format string */
struct
format_item
*
f
;
struct
format_item
*
f
;
int
fsize
;
int
fsize
;
/* list of views */
view
**
v
;
int
vsize
;
/* local output buffer */
/* local output buffer */
OBUF
o
;
OBUF
o
;
};
};
...
@@ -56,7 +53,8 @@ static void _event(void *p, event e)
...
@@ -56,7 +53,8 @@ static void _event(void *p, event e)
}
}
PUTC
(
&
l
->
o
,
0
);
PUTC
(
&
l
->
o
,
0
);
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
l
->
v
[
i
]
->
append
(
l
->
v
[
i
],
l
->
o
.
obuf
);
for
(
i
=
0
;
i
<
l
->
common
.
vsize
;
i
++
)
l
->
common
.
v
[
i
]
->
append
(
l
->
common
.
v
[
i
],
l
->
o
.
obuf
);
}
}
enum
chunk_type
{
C_ERROR
,
C_STRING
,
C_ARG_NAME
,
C_EVENT_NAME
};
enum
chunk_type
{
C_ERROR
,
C_STRING
,
C_ARG_NAME
,
C_EVENT_NAME
};
...
@@ -127,7 +125,7 @@ error:
...
@@ -127,7 +125,7 @@ error:
return
(
struct
chunk
){
type
:
C_ERROR
};
return
(
struct
chunk
){
type
:
C_ERROR
};
}
}
textlog
*
new_textlog
(
event_handler
*
h
,
void
*
database
,
logger
*
new_textlog
(
event_handler
*
h
,
void
*
database
,
char
*
event_name
,
char
*
format
)
char
*
event_name
,
char
*
format
)
{
{
struct
textlog
*
ret
;
struct
textlog
*
ret
;
...
@@ -137,13 +135,14 @@ textlog *new_textlog(event_handler *h, void *database,
...
@@ -137,13 +135,14 @@ textlog *new_textlog(event_handler *h, void *database,
ret
=
calloc
(
1
,
sizeof
(
struct
textlog
));
if
(
ret
==
NULL
)
abort
();
ret
=
calloc
(
1
,
sizeof
(
struct
textlog
));
if
(
ret
==
NULL
)
abort
();
ret
->
event_name
=
strdup
(
event_name
);
if
(
ret
->
event_name
==
NULL
)
abort
();
ret
->
common
.
event_name
=
strdup
(
event_name
);
if
(
ret
->
common
.
event_name
==
NULL
)
abort
();
ret
->
format
=
strdup
(
format
);
if
(
ret
->
format
==
NULL
)
abort
();
ret
->
format
=
strdup
(
format
);
if
(
ret
->
format
==
NULL
)
abort
();
ret
->
database
=
database
;
ret
->
database
=
database
;
event_id
=
event_id_from_name
(
database
,
event_name
);
event_id
=
event_id_from_name
(
database
,
event_name
);
ret
->
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
ret
->
common
.
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
f
=
get_format
(
database
,
event_id
);
f
=
get_format
(
database
,
event_id
);
...
@@ -167,7 +166,7 @@ textlog *new_textlog(event_handler *h, void *database,
...
@@ -167,7 +166,7 @@ textlog *new_textlog(event_handler *h, void *database,
break
;
break
;
case
C_EVENT_NAME
:
case
C_EVENT_NAME
:
ret
->
f
[
ret
->
fsize
].
type
=
INSTRING
;
ret
->
f
[
ret
->
fsize
].
type
=
INSTRING
;
ret
->
f
[
ret
->
fsize
].
s
=
ret
->
event_name
;
ret
->
f
[
ret
->
fsize
].
s
=
ret
->
common
.
event_name
;
break
;
break
;
}
}
ret
->
fsize
++
;
ret
->
fsize
++
;
...
@@ -179,11 +178,3 @@ error:
...
@@ -179,11 +178,3 @@ error:
printf
(
"%s:%d: bad format '%s'
\n
"
,
__FILE__
,
__LINE__
,
format
);
printf
(
"%s:%d: bad format '%s'
\n
"
,
__FILE__
,
__LINE__
,
format
);
abort
();
abort
();
}
}
void
textlog_add_view
(
textlog
*
_l
,
view
*
v
)
{
struct
textlog
*
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/textlog.h
deleted
100644 → 0
View file @
d8ec913b
#ifndef _TEXTLOG_H_
#define _TEXTLOG_H_
typedef
void
textlog
;
textlog
*
new_textlog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
format
);
#include "view/view.h"
void
textlog_add_view
(
textlog
*
l
,
view
*
v
);
#endif
/* _TEXTLOG_H_ */
common/utils/T/tracer/logger/ttilog.c
View file @
e5689a5b
#include "ttilog.h"
#include "logger.h"
#include "logger_defs.h"
#include "event.h"
#include "event.h"
#include "database.h"
#include "database.h"
#include "handler.h"
#include "handler.h"
...
@@ -8,15 +9,11 @@
...
@@ -8,15 +9,11 @@
#include <math.h>
#include <math.h>
struct
ttilog
{
struct
ttilog
{
char
*
event_name
;
struct
logger
common
;
void
*
database
;
void
*
database
;
unsigned
long
handler_id
;
int
frame_arg
;
int
frame_arg
;
int
subframe_arg
;
int
subframe_arg
;
int
data_arg
;
int
data_arg
;
/* list of views */
view
**
v
;
int
vsize
;
int
convert_to_dB
;
int
convert_to_dB
;
};
};
...
@@ -37,11 +34,11 @@ static void _event(void *p, event e)
...
@@ -37,11 +34,11 @@ static void _event(void *p, event e)
if
(
l
->
convert_to_dB
)
value
=
10
*
log10
(
value
);
if
(
l
->
convert_to_dB
)
value
=
10
*
log10
(
value
);
for
(
i
=
0
;
i
<
l
->
vsize
;
i
++
)
for
(
i
=
0
;
i
<
l
->
common
.
vsize
;
i
++
)
l
->
v
[
i
]
->
append
(
l
->
v
[
i
],
frame
,
subframe
,
value
);
l
->
common
.
v
[
i
]
->
append
(
l
->
common
.
v
[
i
],
frame
,
subframe
,
value
);
}
}
ttilog
*
new_ttilog
(
event_handler
*
h
,
void
*
database
,
logger
*
new_ttilog
(
event_handler
*
h
,
void
*
database
,
char
*
event_name
,
char
*
frame_varname
,
char
*
subframe_varname
,
char
*
event_name
,
char
*
frame_varname
,
char
*
subframe_varname
,
char
*
data_varname
,
int
convert_to_dB
)
char
*
data_varname
,
int
convert_to_dB
)
{
{
...
@@ -52,13 +49,14 @@ ttilog *new_ttilog(event_handler *h, void *database,
...
@@ -52,13 +49,14 @@ ttilog *new_ttilog(event_handler *h, void *database,
ret
=
calloc
(
1
,
sizeof
(
struct
ttilog
));
if
(
ret
==
NULL
)
abort
();
ret
=
calloc
(
1
,
sizeof
(
struct
ttilog
));
if
(
ret
==
NULL
)
abort
();
ret
->
event_name
=
strdup
(
event_name
);
if
(
ret
->
event_name
==
NULL
)
abort
();
ret
->
common
.
event_name
=
strdup
(
event_name
);
if
(
ret
->
common
.
event_name
==
NULL
)
abort
();
ret
->
database
=
database
;
ret
->
database
=
database
;
ret
->
convert_to_dB
=
convert_to_dB
;
ret
->
convert_to_dB
=
convert_to_dB
;
event_id
=
event_id_from_name
(
database
,
event_name
);
event_id
=
event_id_from_name
(
database
,
event_name
);
ret
->
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
ret
->
common
.
handler_id
=
register_handler_function
(
h
,
event_id
,
_event
,
ret
);
f
=
get_format
(
database
,
event_id
);
f
=
get_format
(
database
,
event_id
);
...
@@ -106,11 +104,3 @@ ttilog *new_ttilog(event_handler *h, void *database,
...
@@ -106,11 +104,3 @@ ttilog *new_ttilog(event_handler *h, void *database,
return
ret
;
return
ret
;
}
}
void
ttilog_add_view
(
ttilog
*
_l
,
view
*
v
)
{
struct
ttilog
*
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/ttilog.h
deleted
100644 → 0
View file @
d8ec913b
#ifndef _TTILOG_H_
#define _TTILOG_H_
typedef
void
ttilog
;
ttilog
*
new_ttilog
(
void
*
event_handler
,
void
*
database
,
char
*
event_name
,
char
*
frame_varname
,
char
*
subframe_varname
,
char
*
data_varname
,
int
convert_to_dB
);
#include "view/view.h"
void
ttilog_add_view
(
ttilog
*
l
,
view
*
v
);
#endif
/* _TTILOG_H_ */
common/utils/T/tracer/textlog.c
View file @
e5689a5b
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include "database.h"
#include "database.h"
#include "event.h"
#include "event.h"
#include "handler.h"
#include "handler.h"
#include "logger/
textlog
.h"
#include "logger/
logger
.h"
#include "view/view.h"
#include "view/view.h"
#include "gui/gui.h"
#include "gui/gui.h"
#include "utils.h"
#include "utils.h"
...
@@ -125,7 +125,7 @@ int main(int n, char **v)
...
@@ -125,7 +125,7 @@ int main(int n, char **v)
char
t
;
char
t
;
int
l
;
int
l
;
event_handler
*
h
;
event_handler
*
h
;
textlog
*
textlog
;
logger
*
textlog
;
gui
*
g
;
gui
*
g
;
int
gui_mode
=
0
;
int
gui_mode
=
0
;
view
*
out
;
view
*
out
;
...
@@ -192,7 +192,7 @@ int main(int n, char **v)
...
@@ -192,7 +192,7 @@ int main(int n, char **v)
textlog
=
new_textlog
(
h
,
database
,
name
,
desc
);
textlog
=
new_textlog
(
h
,
database
,
name
,
desc
);
// "ENB_UL_CHANNEL_ESTIMATE",
// "ENB_UL_CHANNEL_ESTIMATE",
// "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]");
// "ev: {} eNB_id [eNB_ID] frame [frame] subframe [subframe]");
textlog
_add_view
(
textlog
,
out
);
logger
_add_view
(
textlog
,
out
);
free
(
name
);
free
(
name
);
free
(
desc
);
free
(
desc
);
}
}
...
...
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