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
70b0fa2c
Commit
70b0fa2c
authored
Jun 09, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print lost packets
parent
773ed882
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
packet-exchange/src/server.c
packet-exchange/src/server.c
+14
-2
No files found.
packet-exchange/src/server.c
View file @
70b0fa2c
...
@@ -35,6 +35,7 @@ typedef struct thread_stat {
...
@@ -35,6 +35,7 @@ typedef struct thread_stat {
uint64_t
max_interval
;
uint64_t
max_interval
;
int
packets_received
;
int
packets_received
;
packet_info_t
packet_info
;
packet_info_t
packet_info
;
int
lost_packets
;
}
thread_stat_t
;
}
thread_stat_t
;
typedef
struct
thread_param
{
typedef
struct
thread_param
{
...
@@ -106,6 +107,7 @@ static void *packet_receiving_thread(void *p) {
...
@@ -106,6 +107,7 @@ static void *packet_receiving_thread(void *p) {
uint64_t
diff
=
0
;
uint64_t
diff
=
0
;
cpu_set_t
mask
;
cpu_set_t
mask
;
int64_t
dist_to_interval
;
int64_t
dist_to_interval
;
int
prev_packet_id
=
0
;
stats
->
min_interval
=
UINT64_MAX
;
stats
->
min_interval
=
UINT64_MAX
;
stats
->
max_interval
=
0
;
stats
->
max_interval
=
0
;
...
@@ -134,15 +136,23 @@ static void *packet_receiving_thread(void *p) {
...
@@ -134,15 +136,23 @@ static void *packet_receiving_thread(void *p) {
}
else
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
}
else
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
int
current_packet_id
;
param
->
stats
.
packet_info
=
recv_udp_packet
(
enable_timestamps
,
enable_histograms
,
histograms
);
param
->
stats
.
packet_info
=
recv_udp_packet
(
enable_timestamps
,
enable_histograms
,
histograms
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
current
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
current
);
// If this is not the first received packet
if
(
stats
->
packets_received
)
{
if
(
stats
->
packets_received
)
{
diff
=
calcdiff_ns
(
current
,
previous
);
diff
=
calcdiff_ns
(
current
,
previous
);
stats
->
min_interval
=
diff
<
stats
->
min_interval
?
diff
:
stats
->
min_interval
;
stats
->
min_interval
=
diff
<
stats
->
min_interval
?
diff
:
stats
->
min_interval
;
stats
->
max_interval
=
diff
>
stats
->
max_interval
?
diff
:
stats
->
max_interval
;
stats
->
max_interval
=
diff
>
stats
->
max_interval
?
diff
:
stats
->
max_interval
;
// Check if packets were lost
current_packet_id
=
atoi
(
param
->
stats
.
packet_info
.
data
);
param
->
stats
.
lost_packets
+=
current_packet_id
-
prev_packet_id
-
1
;
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
dist_to_interval
=
(((
int64_t
)
diff
)
-
param
->
interval
)
/
1000
;
dist_to_interval
=
(((
int64_t
)
diff
)
-
param
->
interval
)
/
1000
;
dist_to_interval
+=
MAX_HIST_VAL
/
2
;
dist_to_interval
+=
MAX_HIST_VAL
/
2
;
...
@@ -157,6 +167,7 @@ static void *packet_receiving_thread(void *p) {
...
@@ -157,6 +167,7 @@ static void *packet_receiving_thread(void *p) {
}
}
previous
=
current
;
previous
=
current
;
prev_packet_id
=
current_packet_id
;
}
}
}
}
...
@@ -217,10 +228,11 @@ int main(int argc, char *argv[]) {
...
@@ -217,10 +228,11 @@ int main(int argc, char *argv[]) {
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
diff
=
((
int64_t
)
stats
->
max_interval
)
-
stats
->
min_interval
;
diff
=
((
int64_t
)
stats
->
max_interval
)
-
stats
->
min_interval
;
printf
(
"(%d) Jitter : %"
PRIi64
" [Packet data: %s]
\n
"
,
printf
(
"(%d) Jitter : %"
PRIi64
" [Packet data: %s]
[Lost packets: %d]
\n
"
,
stats
->
packets_received
,
stats
->
packets_received
,
diff
,
diff
,
stats
->
packet_info
.
data
);
stats
->
packet_info
.
data
,
stats
->
lost_packets
);
if
(
enable_timestamps
)
{
if
(
enable_timestamps
)
{
printf
(
"(%d) Enter send_udp_packet timestamp: %"
PRIu64
"
\n
"
,
printf
(
"(%d) Enter send_udp_packet timestamp: %"
PRIu64
"
\n
"
,
...
...
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