Skip to content

Commit d87b04e

Browse files
author
Matthias Radestock
committed
more sensible measurements
make sure messages have reached q before stopping publish timer and starting consume timer.
1 parent b3cf972 commit d87b04e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/src/com/rabbitmq/examples/BufferPerformanceMetrics.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,23 @@ public void configureSocket(Socket socket)
6969
long start;
7070

7171
start = System.nanoTime();
72+
7273
for(int i = 0; i < MESSAGE_COUNT; i++) {
7374
channel.basicPublish(EXCHANGE, ROUTING_KEY,
7475
MessageProperties.BASIC, MESSAGE);
7576
}
76-
long publishTime = System.nanoTime() - start;
77-
78-
start = System.nanoTime();
7977

8078
QueueingConsumer consumer = new QueueingConsumer(channel);
8179
channel.basicConsume(QUEUE, true, consumer);
8280

81+
long publishTime = System.nanoTime() - start;
82+
83+
start = System.nanoTime();
84+
8385
for(int i = 0; i < MESSAGE_COUNT; i++){
8486
consumer.nextDelivery();
8587
}
88+
8689
long getTime = System.nanoTime() - start;
8790

8891
double publishRate =

0 commit comments

Comments
 (0)