Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
e9cbc85d
Commit
e9cbc85d
authored
Jul 10, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrtd:tools: use log-level convertion functions
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
6f7a4ccb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
40 deletions
+10
-40
wrtd-in-config.c
applications/wrtd/tools/wrtd-in-config.c
+1
-1
wrtd-inout-common.c
applications/wrtd/tools/wrtd-inout-common.c
+7
-39
wrtd-out-config.c
applications/wrtd/tools/wrtd-out-config.c
+2
-0
No files found.
applications/wrtd/tools/wrtd-in-config.c
View file @
e9cbc85d
...
...
@@ -133,7 +133,7 @@ void dump_input_state(struct wrtd_input_state *state)
printf
(
" - Dead time: %"
PRIu64
" ns
\n
"
,
ts_to_picos
(
state
->
dead_time
)
/
1000
);
decode_log_level
(
tmp
,
state
->
log_level
);
wrtd_strlogging_full
(
tmp
,
state
->
log_level
);
printf
(
" - Log level: %s
\n
"
,
tmp
);
}
...
...
applications/wrtd/tools/wrtd-inout-common.c
View file @
e9cbc85d
...
...
@@ -93,26 +93,6 @@ void decode_mode(char *buf, int mode)
}
}
void
decode_log_level
(
char
*
buf
,
uint32_t
flags
)
{
strcpy
(
buf
,
""
);
if
(
flags
==
0
)
strcpy
(
buf
,
"off"
);
if
(
flags
&
WRTD_LOG_RAW
)
strcat
(
buf
,
"Raw "
);
if
(
flags
&
WRTD_LOG_SENT
)
strcat
(
buf
,
"Sent "
);
if
(
flags
&
WRTD_LOG_PROMISC
)
strcat
(
buf
,
"Promiscious "
);
if
(
flags
&
WRTD_LOG_FILTERED
)
strcat
(
buf
,
"Filtered "
);
if
(
flags
&
WRTD_LOG_EXECUTED
)
strcat
(
buf
,
"Exceuted "
);
if
(
flags
&
WRTD_LOG_MISSED
)
strcat
(
buf
,
"Missed "
);
}
void
format_ts
(
char
*
buf
,
struct
wr_timestamp
ts
,
int
with_seconds
)
{
uint64_t
picoseconds
=
(
uint64_t
)
ts
.
ticks
*
8000
+
(
uint64_t
)
ts
.
frac
*
8000ULL
/
4096ULL
;
...
...
@@ -198,35 +178,23 @@ int parse_trigger_id(const char *str, struct wrtd_trig_id *id)
int
parse_log_level
(
char
*
list
[],
int
count
,
int
*
log_level
)
{
int
l
=
0
;
uint32_t
l
=
0
,
tmp
;
while
(
count
--
)
{
if
(
!
list
[
0
])
return
-
1
;
tmp
=
wrtd_strlogging_to_level
(
list
[
0
]);
if
(
tmp
==
WRTD_LOG_ALL
||
tmp
==
WRTD_LOG_NOTHING
)
{
l
=
tmp
;
break
;
}
l
|=
tmp
;
if
(
!
strcmp
(
list
[
0
],
"all"
))
{
l
=
WRTD_LOG_ALL
;
break
;
}
else
if
(
!
strcmp
(
list
[
0
],
"off"
))
{
l
=
0
;
break
;
}
else
if
(
!
strcmp
(
list
[
0
],
"promisc"
))
l
|=
WRTD_LOG_PROMISC
;
else
if
(
!
strcmp
(
list
[
0
],
"raw"
))
l
|=
WRTD_LOG_RAW
;
else
if
(
!
strcmp
(
list
[
0
],
"executed"
))
l
|=
WRTD_LOG_EXECUTED
;
else
if
(
!
strcmp
(
list
[
0
],
"missed"
))
l
|=
WRTD_LOG_MISSED
;
else
if
(
!
strcmp
(
list
[
0
],
"sent"
))
l
|=
WRTD_LOG_SENT
;
else
if
(
!
strcmp
(
list
[
0
],
"filtered"
))
l
|=
WRTD_LOG_FILTERED
;
else
return
-
1
;
list
++
;
}
...
...
applications/wrtd/tools/wrtd-out-config.c
View file @
e9cbc85d
...
...
@@ -155,6 +155,8 @@ static void dump_output_state(struct wrtd_output_state *state)
printf
(
" - Total RX messages: %-10d
\n
"
,
state
->
received_messages
);
printf
(
" - Total loopback messages: %-10d
\n
"
,
state
->
received_loopback
);
wrtd_strlogging_full
(
tmp
,
state
->
log_level
);
printf
(
" - Log level: %s
\n
"
,
tmp
);
}
static
int
wrtd_cmq_has_trig
(
struct
wrtd_node
*
wrtd
,
int
output
,
...
...
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