10000 Update test ID declaration. · CassOnMars/rabbitmq-java-client@40eb0fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 40eb0fe

Browse files
abousselmiacogoluegnes
authored andcommitted
Update test ID declaration.
1 parent 5113b8b commit 40eb0fe

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
public class PerfTest {
3838

39-
private static String testID;
40-
4139
public static void main(String[] args) {
4240
Options options = getOptions();
4341
CommandLineParser parser = new GnuParser();
@@ -48,9 +46,9 @@ public static void main(String[] args) {
4846
usage(options);
4947
System.exit(0);
5048
}
51-
testID = new SimpleDateFormat("HH:mm:ss.SSS").format(Calendar.
49+
String testID = new SimpleDateFormat("HHmmss-SSS").format(Calendar.
5250
getInstance().getTime());
53-
testID = strArg(cmd, 'd', "test-" + testID);
51+
testID = strArg(cmd, 'd', "test-"+testID);
5452
String exchangeType = strArg(cmd, 't', "direct");
5553
String exchangeName = strArg(cmd, 'e', exchangeType);
5654
String queueName = strArg(cmd, 'u', "");
@@ -80,12 +78,13 @@ public static void main(String[] args) {
8078
String uri = strArg(cmd, 'h', "amqp://localhost");
8179

8280
//setup
83-
PrintlnStats stats = new PrintlnStats(1000L * samplingInterval,
84-
producerCount > 0,
85-
consumerCount > 0,
86-
(flags.contains("mandatory") ||
87-
flags.contains("immediate")),
88-
confirm != -1);
81+
PrintlnStats stats = new PrintlnStats(testID,
82+
1000L * samplingInterval,
83+
producerCount > 0,
84+
consumerCount > 0,
85+
(flags.contains("mandatory") ||
86+
flags.contains("immediate")),
87+
confirm != -1);
8988

9089
ConnectionFactory factory = new ConnectionFactory();
9190
factory.setShutdownTimeout(0); // So we still shut down even with slow consumers
@@ -199,20 +198,24 @@ private static class PrintlnStats extends Stats {
199198
private final boolean recvStatsEnabled;
200199
private final boolean returnStatsEnabled;
201200
private final boolean confirmStatsEnabled;
201+
202+
private final String testID;
202203

203-
public PrintlnStats(long interval,
204+
public PrintlnStats(String testID, long interval,
204205
boolean sendStatsEnabled, boolean recvStatsEnabled,
205206
boolean returnStatsEnabled, boolean confirmStatsEnabled) {
206207
super(interval);
207208
this.sendStatsEnabled = sendStatsEnabled;
208209
this.recvStatsEnabled = recvStatsEnabled;
209210
this.returnStatsEnabled = returnStatsEnabled;
210211
this.confirmStatsEnabled = confirmStatsEnabled;
212+
this.testID = testID;
211213
}
212214

213215
@Override
214216
protected void report(long now) {
215217
System.out.print("id: " + testID + ", ");
218+
216219
System.out.print("time: " + String.format("%.3f", (now - startTime)/1000.0) + "s");
217220

218221
showRate("sent", sendCountInterval, sendStatsEnabled, elapsedInterval);

0 commit comments

Comments
 (0)
0