36
36
37
37
public class PerfTest {
38
38
39
- private static String testID ;
40
-
41
39
public static void main (String [] args ) {
42
40
Options options = getOptions ();
43
41
CommandLineParser parser = new GnuParser ();
@@ -48,9 +46,9 @@ public static void main(String[] args) {
48
46
usage (options );
49
47
System .exit (0 );
50
48
}
51
- testID = new SimpleDateFormat ("HH:mm:ss. SSS" ).format (Calendar .
49
+ String testID = new SimpleDateFormat ("HHmmss- SSS" ).format (Calendar .
52
50
getInstance ().getTime ());
53
- testID = strArg (cmd , 'd' , "test-" + testID );
51
+ testID = strArg (cmd , 'd' , "test-" + testID );
54
52
String exchangeType = strArg (cmd , 't' , "direct" );
55
53
String exchangeName = strArg (cmd , 'e' , exchangeType );
56
54
String queueName = strArg (cmd , 'u' , "" );
@@ -80,12 +78,13 @@ public static void main(String[] args) {
80
78
String uri = strArg (cmd , 'h' , "amqp://localhost" );
81
79
82
80
//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 );
89
88
90
89
ConnectionFactory factory = new ConnectionFactory ();
91
90
factory .setShutdownTimeout (0 ); // So we still shut down even with slow consumers
@@ -199,20 +198,24 @@ private static class PrintlnStats extends Stats {
199
198
private final boolean recvStatsEnabled ;
200
199
private final boolean returnStatsEnabled ;
201
200
private final boolean confirmStatsEnabled ;
201
+
202
+ private final String testID ;
202
203
203
- public PrintlnStats (long interval ,
204
+ public PrintlnStats (String testID , long interval ,
204
205
boolean sendStatsEnabled , boolean recvStatsEnabled ,
205
206
boolean returnStatsEnabled , boolean confirmStatsEnabled ) {
206
207
super (interval );
207
208
this .sendStatsEnabled = sendStatsEnabled ;
208
209
this .recvStatsEnabled = recvStatsEnabled ;
209
210
this .returnStatsEnabled = returnStatsEnabled ;
210
211
this .confirmStatsEnabled = confirmStatsEnabled ;
212
+ this .testID = testID ;
211
213
}
212
214
213
215
@ Override
214
216
protected void report (long now ) {
215
217
System .out .print ("id: " + testID + ", " );
218
+
216
219
System .out .print ("time: " + String .format ("%.3f" , (now - startTime )/1000.0 ) + "s" );
217
220
218
221
showRate ("sent" , sendCountInterval , sendStatsEnabled , elapsedInterval );
0 commit comments