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
1d9316bf
Commit
1d9316bf
authored
Apr 26, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
5b020a50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
latency-measure/src/main.c
latency-measure/src/main.c
+17
-0
No files found.
latency-measure/src/main.c
View file @
1d9316bf
...
...
@@ -68,7 +68,24 @@ static inline struct timespec add_ns(struct timespec t, int64_t ns) {
return
ret
;
}
static
inline
struct
timespec
sub_ns
(
struct
timespec
t
,
int64_t
ns
)
{
struct
timespec
ret
;
ret
.
tv_nsec
=
t
.
tv_nsec
-
ns
;
ret
.
tv_sec
=
t
.
tv_sec
;
if
(
ret
.
tv_nsec
<
0
)
{
ret
.
tv_sec
--
;
ret
.
tv_nsec
+=
NSECS_PER_SECOND
;
}
return
ret
;
}
static
void
sleep_poll
(
struct
timespec
*
next
,
struct
timespec
*
current
)
{
struct
timespec
pre_next
;
pre_next
=
sub_ns
(
next
,
3000000
);
clock_nanosleep
(
CLOCK_ID
,
TIMER_ABSTIME
,
for
(;;)
{
clock_gettime
(
CLOCK_ID
,
current
);
if
(
current
->
tv_sec
>
next
->
tv_sec
||
(
current
->
tv_sec
==
next
->
tv_sec
&&
current
->
tv_nsec
>=
next
->
tv_nsec
)
)
...
...
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