Skip to content

Commit 91becc6

Browse files
author
Simon MacMullen
committed
Obtain rates in bytes/sec as well as msg/sec (not counting AMQP overhead)
1 parent 335d8ef commit 91becc6

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

test/src/com/rabbitmq/examples/perf/ScenarioStats.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.rabbitmq.examples.perf;
1818

19+
import java.util.Map;
20+
1921
public interface ScenarioStats {
20-
public Object results();
22+
public Map<String, Object> results();
2123
}

test/src/com/rabbitmq/examples/perf/SimpleScenario.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public void run() throws IOException, InterruptedException {
4343
this.stats = new SimpleScenarioStats(interval);
4444
for (MulticastParams p : params) {
4545
MulticastSet set = new MulticastSet(stats, factory, p);
46+
stats.setMinMsgSize(p.minMsgSize);
4647
set.run();
4748
}
4849
}

test/src/com/rabbitmq/examples/perf/SimpleScenarioStats.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SimpleScenarioStats extends Stats implements ScenarioStats {
2626

2727
private List<Map<String, Object>> samples = new ArrayList<Map<String, Object>>();
2828
private long elapsedTotalToIgnore;
29+
private long minMsgSize;
2930

3031
public SimpleScenarioStats(long interval) {
3132
super(interval);
@@ -42,8 +43,10 @@ protected void report(long now) {
4243
}
4344

4445
Map<String, Object> sample = new HashMap<String, Object>();
45-
sample.put("send-rate", rate(sendCountInterval, elapsedInterval));
46-
sample.put("recv-rate", rate(recvCountInterval, elapsedInterval));
46+
sample.put("send-msg-rate", rate(sendCountInterval, elapsedInterval));
47+
sample.put("send-bytes-rate", rate(sendCountInterval, elapsedInterval) * minMsgSize);
48+
sample.put("recv-msg-rate", rate(recvCountInterval, elapsedInterval));
49+
sample.put("recv-bytes-rate", rate(recvCountInterval, elapsedInterval) * minMsgSize);
4750
sample.put("elapsed", elapsedTotal);
4851
if (latencyCountInterval > 0) {
4952
sample.put("avg-latency", intervalAverageLatency());
@@ -56,15 +59,21 @@ protected void report(long now) {
5659
@Override
5760
public Map<String, Object> results() {
5861
Map<String, Object> map = new HashMap<String, Object>();
59-
map.put("send-rate", getSendRate());
60-
map.put("recv-rate", getRecvRate());
62+
map.put("send-msg-rate", getSendRate());
63+
map.put("send-bytes-rate", getSendRate() * minMsgSize);
64+
map.put("recv-msg-rate", getRecvRate());
65+
map.put("recv-bytes-rate", getRecvRate() * minMsgSize);
6166
if (latencyCountTotal > 0) {
6267
map.put("avg-latency", overallAverageLatency());
6368
}
6469
map.put("samples", samples);
6570
return map;
6671
}
6772

73+
public void setMinMsgSize(long minMsgSize) {
74+
this.minMsgSize = minMsgSize;
75+
}
76+
6877
public double getSendRate() {
6978
return rate(sendCountTotal, elapsedTotal - elapsedTotalToIgnore);
7079
}

test/src/com/rabbitmq/examples/perf/VaryingScenario.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.rabbitmq.client.ConnectionFactory;
2020

21-
import java.io.IOException;
2221
import java.util.ArrayList;
2322
import java.util.Arrays;
2423
import java.util.List;
@@ -65,6 +64,7 @@ private void run(Variable[] variables, List<VariableValue> values) throws Except
6564
value.setup(p);
6665
}
6766
MulticastSet set = new MulticastSet(stats0, factory, p);
67+
stats0.setMinMsgSize(p.minMsgSize);
6868
set.run();
6969
for (VariableValue value : values) {
7070
value.teardown(p);

test/src/com/rabbitmq/examples/perf/VaryingScenarioStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public SimpleScenarioStats next(List<VariableValue> value) {
3535
}
3636

3737
@Override
38-
public Object results() {
38+
public Map<String, Object> results() {
3939
Map<String, Object> map = new HashMap<String, Object>();
4040

4141
List<String> dimensions = new ArrayList<String>();

0 commit comments

Comments
 (0)