From b1bffee58eeadcd846dd300fcb26ccf3e7250a10 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 12 Apr 2010 15:42:47 +0000 Subject: QPID-2425 : Augmented JUnit-Toolkit to emit latency information already gathed by the PingAsyncTestPerf for each batch. Merged from 0.5.x-dev r 917464 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@933283 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'qpid/java/perftests/src') diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java index d8fea85477..9ed9fea299 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/ping/PingAsyncTestPerf.java @@ -228,6 +228,9 @@ public class PingAsyncTestPerf extends PingTestPerf implements TimingControllerA /** The test results logging batch size. */ int _batchSize; + /** The latency recoreded for the batch */ + private long _batchLatency = 0; + /** * Creates a results listener on the specified batch size. * @@ -250,6 +253,8 @@ public class PingAsyncTestPerf extends PingTestPerf implements TimingControllerA */ public void onMessage(Message message, int remainingCount, long latency) throws JMSException { + // Record the latency for the whole batch + _batchLatency += latency; // Check if a batch boundary has been crossed. if ((remainingCount % _batchSize) == 0) { @@ -278,7 +283,11 @@ public class PingAsyncTestPerf extends PingTestPerf implements TimingControllerA // Register a test result for the correlation id. try { - tc.completeTest(true, receivedInBatch); + // Record the total latency for the batch. + // if batchSize=1 then this will just be the message latency + tc.completeTest(true, receivedInBatch, null, _batchLatency); + // Reset latency + _batchLatency = 0; } catch (InterruptedException e) { -- cgit v1.2.1