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
3f4964a6
Commit
3f4964a6
authored
Jun 24, 2020
by
Joanne Hugé
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute userspace timestamp after recvmsg in recvpacket
parent
f09aa981
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
packet-exchange/src/recv_packet.c
packet-exchange/src/recv_packet.c
+8
-10
No files found.
packet-exchange/src/recv_packet.c
View file @
3f4964a6
...
...
@@ -39,9 +39,7 @@ static ingress_stat_t *stats;
static
uint64_t
*
kernel_latency_hist
;
static
int
use_histogram
;
static
uint64_t
timestamps_buffer
[
TIMESTAMP_BUFFER_SIZE
];
static
int
ts_buf_read_index
=
0
;
static
int
ts_buf_write_index
=
0
;
uint64_t
post_kernel_timestamp
;
// Sets the interface
static
int
set_if
()
{
...
...
@@ -130,12 +128,6 @@ void recv_udp_packet() {
struct
timespec
ts
;
if
(
params
->
use_timestamps
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
timestamps_buffer
[
ts_buf_write_index
]
=
ts_to_uint
(
ts
);
ts_buf_write_index
=
(
ts_buf_write_index
+
1
)
%
TIMESTAMP_BUFFER_SIZE
;
}
iov
.
iov_base
=
&
rx_buffer
;
iov
.
iov_len
=
MAX_BUFFER_SIZE
-
1
;
...
...
@@ -151,13 +143,19 @@ void recv_udp_packet() {
if
(
recvmsgerr
<
0
)
error
(
EXIT_FAILURE
,
errno
,
"recvmsg failed, ret value: %d
\n
"
,
recvmsgerr
);
if
(
params
->
use_timestamps
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
post_kernel_timestamp
=
ts_to_uint
(
ts
);
}
if
(
params
->
use_timestamps
)
{
for
(
cmsg
=
CMSG_FIRSTHDR
(
&
msg
);
cmsg
;
cmsg
=
CMSG_NXTHDR
(
&
msg
,
cmsg
))
{
if
(
cmsg
->
cmsg_level
==
SOL_SOCKET
&&
cmsg
->
cmsg_type
==
SO_TIMESTAMPING
)
{
struct
timespec
*
stamp
=
(
struct
timespec
*
)
CMSG_DATA
(
cmsg
);
uint64_t
kernel_latency
=
timestamps_buffer
[
ts_buf_read_index
]
-
ts_to_uint
(
*
stamp
);
uint64_t
kernel_latency
=
post_kernel_timestamp
-
ts_to_uint
(
*
stamp
);
ts_buf_read_index
=
(
ts_buf_read_index
+
1
)
%
TIMESTAMP_BUFFER_SIZE
;
kernel_latency
/=
1000u
;
...
...
Joanne Hugé
@jhuge
mentioned in commit
2aa17b73
·
Jul 31, 2020
mentioned in commit
2aa17b73
mentioned in commit 2aa17b73fd8c7c5a0c0e35ba717a55e84582700d
Toggle commit list
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