Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
3fd105ea
Commit
3fd105ea
authored
Nov 30, 2017
by
Andreas Schmidt
Browse files
Add nanosleep support. Remove some sleeps.
parent
eae6447d
Pipeline
#1671
passed with stages
in 1 minute and 33 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
prrt/proto/clock.h
View file @
3fd105ea
...
...
@@ -8,8 +8,9 @@
#define MAX_TIMESTAMP (prrtTimestamp_t) 4294967295
#define HALF_TIMESTAMP (prrtTimestamp_t) 2147483648
#define usleep(t) nanosleep((const struct timespec[]){{0, t * 1000}}, NULL)
#define sleep(t) nanosleep((const struct timespec[]){{t, 0}}, NULL)
#define usleep_nano(t) nanosleep((const struct timespec[]){{0, t * 1000}}, NULL)
#define sleep_nano(t) nanosleep((const struct timespec[]){{t, 0}}, NULL)
typedef
struct
prrtClock
{
prrtTimestamp_t
lastMeasurement
;
...
...
prrt/proto/processes/feedbackReceiver.c
View file @
3fd105ea
...
...
@@ -52,7 +52,6 @@ void *receive_feedback_loop(void *ptr)
while
(
!
atomic_load_explicit
(
&
sock_ptr
->
closing
,
memory_order_acquire
))
{
handle_feedback
(
sock_ptr
,
MAX_PAYLOAD_LENGTH
);
usleep
(
1
);
}
return
NULL
;
...
...
prrt/receiver.c
View file @
3fd105ea
...
...
@@ -130,7 +130,6 @@ int main(int argc, char **argv) {
sscanf
(
buffer
,
"%u"
,
&
seqno
);
debug
(
DEBUG_RECEIVER
,
"[B (n: %3d, i: %3d)] %s"
,
n
,
i
,
buffer
);
i
++
;
usleep
(
1
);
}
XlapTimestampTableDumpHeader
(
out_desc
);
...
...
prrt/sender.c
View file @
3fd105ea
...
...
@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
#endif
PrrtSocket
*
s
=
PrrtSocket_create
(
true
,
6
0
*
1000
*
1000
);
PrrtSocket
*
s
=
PrrtSocket_create
(
true
,
1
0
*
1000
*
1000
);
check
(
s
!=
NULL
,
"Socket create failed."
);
if
(
strcmp
(
arguments
.
hardwarestamping_interface
,
"-"
)
!=
0
)
{
...
...
@@ -134,10 +134,10 @@ int main(int argc, char **argv) {
PrrtSocket_send
(
s
,
(
unsigned
char
*
)
buf
,
strlen
(
buf
));
j
++
;
// Send every 1us, as this is a sensible packet interval.
usleep
(
1
);
// Send every 1
0
us, as this is a sensible packet interval.
usleep
_nano
(
1
0
);
}
sleep
(
5
);
sleep
_nano
(
10
);
XlapTimestampTableDumpHeader
(
out_desc
);
XlapTimestampTableDump
(
out_desc
,
ts_data_packet
,
tstable_data
);
...
...
Write
Preview
Supports
Markdown
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