From 222569ae007611ce0d57f0e2c52a62ac78de20a0 Mon Sep 17 00:00:00 2001 From: Peter Veentjer Date: Mon, 27 Jan 2025 13:27:36 +0200 Subject: [PATCH] Improved handling coordinated omission --- .../aeron/remote/FailoverTestRig.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/remote/FailoverTestRig.java b/benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/remote/FailoverTestRig.java index 56c6f6a2..980778d4 100644 --- a/benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/remote/FailoverTestRig.java +++ b/benchmarks-aeron/src/main/java/uk/co/real_logic/benchmarks/aeron/remote/FailoverTestRig.java @@ -237,17 +237,27 @@ private void runTest(final int durationSeconds, final int messageRate) } int workCount = 0; + final long now = clock.nanoTime(); if (moreToGenerate && now - nextMessageAt >= 0) { generationTimestamps[freePosition++] = now; - workCount += trySend(); + int trySend = trySend(nextMessageAt); - generatedMessages++; - nextMessageAt += periodNs; + if (trySend == 0) + { + freePosition--; + } + else + { + workCount += trySend; + generatedMessages++; + nextMessageAt += periodNs; + } + // todo: not sure what to do with this section. if (now - nextMessageAt >= 0) { fallingBehindCount++; @@ -256,8 +266,6 @@ private void runTest(final int durationSeconds, final int messageRate) workCount += transceiver.receive(); - workCount += trySend(); - if (now - deadline >= 0) { throw new RuntimeException("Timed out"); @@ -285,7 +293,7 @@ private void runTest(final int durationSeconds, final int messageRate) out.println("Stats: fallingBehindCount=" + fallingBehindCount); } - private int trySend() + private int trySend(final long timestamp) { if (!synced || sendPosition >= freePosition) { @@ -293,7 +301,6 @@ private int trySend() } final int sequence = sendPosition; - final long timestamp = generationTimestamps[sendPosition]; if (transceiver.trySendEcho(sequence, timestamp)) {