Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
nexedi
tsn-measures
Commits
07ffe167
Commit
07ffe167
authored
Sep 28, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug server signal emission latency
parent
a9221760
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
packet-exchange/src/server.c
packet-exchange/src/server.c
+9
-2
No files found.
packet-exchange/src/server.c
View file @
07ffe167
...
@@ -87,6 +87,8 @@ static int64_t max_diff_ts = 0;
...
@@ -87,6 +87,8 @@ static int64_t max_diff_ts = 0;
static
int64_t
avg_diff_ts
=
0
;
static
int64_t
avg_diff_ts
=
0
;
static
uint64_t
high_diff_ts
=
0
;
static
uint64_t
high_diff_ts
=
0
;
static
int
interval_us
;
static
char
ts_tracemark_buf
[
64
];
static
char
ts_tracemark_buf
[
64
];
static
void
help
(
char
*
argv
[])
{
static
void
help
(
char
*
argv
[])
{
...
@@ -122,6 +124,7 @@ static void *emit_signal_thread(void *p) {
...
@@ -122,6 +124,7 @@ static void *emit_signal_thread(void *p) {
struct
timespec
current
;
struct
timespec
current
;
struct
timespec
previous_emit
,
previous_ts
;
struct
timespec
previous_emit
,
previous_ts
;
int64_t
emit_diff
,
ts_diff
;
int64_t
emit_diff
,
ts_diff
;
int
latency_spike
=
0
;
int
ret
;
int
ret
;
// Set thread CPU affinity
// Set thread CPU affinity
...
@@ -154,11 +157,15 @@ static void *emit_signal_thread(void *p) {
...
@@ -154,11 +157,15 @@ static void *emit_signal_thread(void *p) {
if
((
emit_diff
<
((
int64_t
)
thread_params
.
interval
)
-
ERROR_MARGIN_NS
)
||
if
((
emit_diff
<
((
int64_t
)
thread_params
.
interval
)
-
ERROR_MARGIN_NS
)
||
(
emit_diff
>
((
int64_t
)
thread_params
.
interval
)
+
ERROR_MARGIN_NS
))
{
(
emit_diff
>
((
int64_t
)
thread_params
.
interval
)
+
ERROR_MARGIN_NS
))
{
fprintf
(
stderr
,
"Signal emission interval reached error threshold: %"
PRIi64
"
\n
"
,
emit_diff
);
fprintf
(
stderr
,
"Signal emission interval reached error threshold: %"
PRIi64
"
\n
"
,
emit_diff
);
exit
(
EXIT_FAILURE
)
;
latency_spike
=
1
;
}
}
if
((
ts_diff
<
((
int64_t
)
thread_params
.
interval
)
-
ERROR_MARGIN_NS
)
||
if
((
ts_diff
<
((
int64_t
)
thread_params
.
interval
)
-
ERROR_MARGIN_NS
)
||
(
ts_diff
>
((
int64_t
)
thread_params
.
interval
)
+
ERROR_MARGIN_NS
))
{
(
ts_diff
>
((
int64_t
)
thread_params
.
interval
)
+
ERROR_MARGIN_NS
))
{
fprintf
(
stderr
,
"Timestamp interval reached error threshold: %"
PRIi64
"
\n
"
,
ts_diff
);
fprintf
(
stderr
,
"Timestamp interval reached error threshold: %"
PRIi64
"
\n
"
,
ts_diff
);
latency_spike
=
1
;
}
if
(
latency_spike
)
{
fprintf
(
stderr
,
"Exiting... Current interval: %d
\n
"
,
interval_us
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
...
@@ -228,6 +235,7 @@ static void *tsn_thread(void *p) {
...
@@ -228,6 +235,7 @@ static void *tsn_thread(void *p) {
// Get time for statistics
// Get time for statistics
clock_gettime
(
CLOCK_REALTIME
,
&
current
);
clock_gettime
(
CLOCK_REALTIME
,
&
current
);
recv_xdp_cleanup
();
recv_xdp_cleanup
();
interval_us
=
calcdiff_ns
(
current
,
previous
)
/
1000
;
if
(
thread_params
.
start_ts
)
if
(
thread_params
.
start_ts
)
add_ns
(
&
next
,
thread_params
.
interval
);
add_ns
(
&
next
,
thread_params
.
interval
);
...
@@ -288,7 +296,6 @@ static void *tsn_thread(void *p) {
...
@@ -288,7 +296,6 @@ static void *tsn_thread(void *p) {
else
{
else
{
// Update stats
// Update stats
if
(
ingress_stats
.
packets_received
)
{
if
(
ingress_stats
.
packets_received
)
{
int
interval_us
=
calcdiff_ns
(
current
,
previous
)
/
1000
;
ingress_stats
.
min_interval
=
ingress_stats
.
min_interval
=
_min_
(
interval_us
,
ingress_stats
.
min_interval
);
_min_
(
interval_us
,
ingress_stats
.
min_interval
);
...
...
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