From e7aa1b6231fcf1235a4288402b67434f3d474557 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Mon, 23 Sep 2019 18:23:06 +0100
Subject: [PATCH] Add in a nanosleep() to the delay loop timer and some
 fudge...

Conflicts:
	swiftmpistepsim.c
---
 swiftmpistepsim.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/swiftmpistepsim.c b/swiftmpistepsim.c
index 9f57fb7..ae9a976 100644
--- a/swiftmpistepsim.c
+++ b/swiftmpistepsim.c
@@ -149,9 +149,12 @@ static void *inject_thread(void *arg) {
     ind_req++;
 
     /* Set looptics on the first pass. Assumes MPI_Isend and MPI_Irecv are
-     * equally timed. */
+     * equally timed. Note we include a nanosleep, they are slow, and a fudge
+     * factor. */
     if (looptics == 0 && usetics) {
-      looptics = getticks() - starttics;
+      sleep.tv_nsec = 1;
+      nanosleep(&sleep, NULL);
+      looptics = (getticks() - starttics) * 2;
       if (verbose)
         message("injection loop took %.3f %s.", clocks_from_ticks(looptics),
                 clocks_getunit());
-- 
GitLab