Skip to content

Commit 983131c

Browse files
author
Steve Powell
committed
Slight change to format of test-main output
1 parent 4978244 commit 983131c

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ public void report(boolean writeStats) throws IOException {
188188
sumL += v;
189189
}
190190

191-
double avgL = sumL / messageCount;
192-
System.out.println("CONSUMER - Message count: " + messageCount);
193-
System.out.println("Total time, milliseconds: " + totalDelta);
194-
System.out.println("Overall messages-per-second: " + (messageCount / (totalDelta / 1000.0)));
195-
System.out.println("Min latency, milliseconds: " + minL);
196-
System.out.println("Avg latency, milliseconds: " + avgL);
197-
System.out.println("Max latency, milliseconds: " + maxL);
191+
System.out.println("CONSUMER - Overall: "
192+
+ String.format("%d messages in %dms, a rate of %.2f msgs/sec", messageCount,
193+
totalDelta,
194+
(messageCount / (totalDelta / 1000.0))));
195+
System.out.println("Latency - Min (Avg) Max: "
196+
+ String.format("%dms (%.2fms) %dms", minL, sumL
197+
/ messageCount, maxL));
198198

199199
if (writeStats) {
200200
PrintStream o = new PrintStream(new FileOutputStream("simple-latency-experiment.csv"));

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,18 @@ public void sendBatch(String queueName) throws IOException {
217217
}
218218

219219
public void report(long totalDelta) {
220-
System.out.println("PRODUCER - Message count: " + _messageCount);
221-
System.out.println("Total time, milliseconds: " + totalDelta);
222-
System.out.println("Overall messages-per-second: " + (_messageCount / (totalDelta / 1000.0)));
220+
System.out
221+
.println("PRODUCER - Overall: "
222+
+ String.format("%d messages in %dms, a rate of %.2f msgs/sec", _messageCount,
223+
totalDelta,
224+
(_messageCount / (totalDelta / 1000.0))));
223225
}
224226

225227
public void summariseProgress(long startTime, long now, int sent, long previousReportTime, int previousSent) {
226228
int countOverInterval = sent - previousSent;
227229
double intervalRate = countOverInterval / ((now - previousReportTime) / 1000.0);
228-
System.out.println((now - startTime) + " ms: Sent " + sent + " - " + countOverInterval + " since last report (" + (int) intervalRate + " Hz)");
230+
System.out.println((now - startTime) + " ms: Sent " + sent + " - "
231+
+ countOverInterval + " since last report ("
232+
+ (int) intervalRate + " Hz)");
229233
}
230234
}

0 commit comments

Comments
 (0)