Commit 3fd105ea authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add nanosleep support. Remove some sleeps.

parent eae6447d
Pipeline #1671 passed with stages
in 1 minute and 33 seconds
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
#endif
PrrtSocket *s = PrrtSocket_create(true, 60 * 1000 * 1000);
PrrtSocket *s = PrrtSocket_create(true, 10 * 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 10us, as this is a sensible packet interval.
usleep_nano(10);
}
sleep(5);
sleep_nano(10);
XlapTimestampTableDumpHeader(out_desc);
XlapTimestampTableDump(out_desc, ts_data_packet, tstable_data);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment