From 559752dc6925a42cddd8c45a3b704e83b744b433 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@DESKTOP-2S09UKA> Date: Wed, 26 Aug 2020 14:29:22 -0700 Subject: [PATCH] improved timing diagnostic messages --- .../src/OpenDis7Examples/AllPduSender.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/examples/src/OpenDis7Examples/AllPduSender.java b/examples/src/OpenDis7Examples/AllPduSender.java index d4f7e4e1d4..4a09ff8297 100755 --- a/examples/src/OpenDis7Examples/AllPduSender.java +++ b/examples/src/OpenDis7Examples/AllPduSender.java @@ -24,10 +24,10 @@ public class AllPduSender public static final int DEFAULT_MULTICAST_PORT = 3000; /** Duration in milliseconds, set to 0 to avoid pausing between PDU sends */ - private long THREAD_SLEEP_INTERVAL = 0; + private long THREAD_SLEEP_INTERVAL = 2000; /** Number of complete loops to perform */ - private int SEND_LOOPS_TO_PERFORM = 1; + private int SEND_LOOPS_TO_PERFORM = 10; private int port; private InetAddress multicastAddress; @@ -48,11 +48,23 @@ public class AllPduSender } } + @SuppressWarnings("SleepWhileInLoop") public int run() { System.out.println("OpenDis7Examples.AllPduSender started..."); if (SEND_LOOPS_TO_PERFORM != 1) - System.out.println("... running for " + SEND_LOOPS_TO_PERFORM + " loops"); + { + float waitIntervalSeconds = ((float)THREAD_SLEEP_INTERVAL / 1000); + float loopIntervalSeconds = ((float)THREAD_SLEEP_INTERVAL / 1000) * 72; // 72 PDUs + float totalDurationSeconds = loopIntervalSeconds * SEND_LOOPS_TO_PERFORM ; + System.out.println("... THREAD_SLEEP_INTERVAL = " + THREAD_SLEEP_INTERVAL + " milliseconds = " + waitIntervalSeconds + " seconds"); + System.out.print ("... running for "); + if (SEND_LOOPS_TO_PERFORM > 1) + System.out.print (SEND_LOOPS_TO_PERFORM + " loops, "); + if (THREAD_SLEEP_INTERVAL > 0) + System.out.println("expected loop interval = " + loopIntervalSeconds + " seconds, total duration = " + + totalDurationSeconds + " seconds = " + (totalDurationSeconds/60.0) + " minutes"); + } System.out.println("Generate list of all PDU types and note issues, if any..."); List<Pdu> generatedPdusList = new ArrayList<>(); -- GitLab