qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arnaudsi...@apache.org
Subject svn commit: r599725 - in /incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf: MessageConsumerTest.java MessageProducerTest.java Options.java
Date Fri, 30 Nov 2007 08:00:23 GMT
Author: arnaudsimon
Date: Fri Nov 30 00:00:22 2007
New Revision: 599725

URL: http://svn.apache.org/viewvc?rev=599725&view=rev
Log:
added interval rate

Modified:
    incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
    incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
    incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java

Modified: incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java?rev=599725&r1=599724&r2=599725&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
Fri Nov 30 00:00:22 2007
@@ -5,19 +5,15 @@
 import java.sql.Date;
 import java.text.SimpleDateFormat;
 
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
 import javax.jms.Destination;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
 import javax.jms.Session;
 
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.client.message.TestMessageFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,34 +24,28 @@
 
     String _logFileName;
     long _startTime;
+    long _intervalStartTime;
     long _totalMsgCount;
     long _intervalCount;
 
-    private Connection _connection;
+    private AMQConnection _connection;
     private Session _session;
-    private BytesMessage _payload;
-    private MessageConsumer _consumer;
-    private boolean _verifyOrder = false;
 
     public void init() throws Exception
     {
        this.parseOptions();
        _logFileName = _logFilePath + "/MessageConsumerTest_" + System.currentTimeMillis();
-
-       AMQConnection _connection = ConnectionUtility.getInstance().getConnection();
+       _connection = ConnectionUtility.getInstance().getConnection();
        _connection.start();
        Destination dest = Boolean.getBoolean("useQueue")? new AMQQueue(_connection,_destination)
: new AMQTopic(_connection,_destination);
        _session = _connection.createSession(_transacted, Session.AUTO_ACKNOWLEDGE);
-       _payload = TestMessageFactory.newBytesMessage(_session, _messageSize);
-       _consumer = _session.createConsumer(dest);
-       if(!_synchronous)
+        MessageConsumer _consumer = _session.createConsumer(dest);
+        if(!_synchronous)
        {
            _consumer.setMessageListener(this);
        }
-       _verifyOrder = Boolean.getBoolean("verifyOrder");
 
        _startTime = System.currentTimeMillis();
-       boolean run = true;
        if(Boolean.getBoolean("collect_stats"))
        {
            printHeading();
@@ -72,7 +62,6 @@
             {
                 _logger.error("Error : Message received out of order in JMSSyncConsumer:"
+ _id + " message id was " + msgId + " expected: " + _currentMsgCount+1);
             }*/
-            message = null;
             _totalMsgCount ++;
             _intervalCount++;
             if(_intervalCount >= _logFrequency)
@@ -87,7 +76,6 @@
                     printSummary();
                     _session.close();
                     _connection.stop();
-                    return;
                 }
             }
         }
@@ -101,19 +89,27 @@
     {
         try
         {
-            FileWriter _memoryLog = new FileWriter(_logFileName + ".csv",true);
+           FileWriter _memoryLog = new FileWriter(_logFileName + ".csv",true);
             StringBuffer buf = new StringBuffer();
             Date d = new Date(System.currentTimeMillis());
-            double totaltime = d.getTime() - _startTime;
+            long currentTime = d.getTime();
+            long intervalTime =  currentTime -  _intervalStartTime;
+            long totalTime = currentTime - _startTime;
             buf.append(df.format(d)).append(",");
             buf.append(d.getTime()).append(",");
-            buf.append(_totalMsgCount).append(",");
-            buf.append(_totalMsgCount*1000 /totaltime).append(",");
+            buf.append(" total Msg Count: ").append(_totalMsgCount).append(",");
+            if(totalTime > 0 )
+                buf.append(" rate: ").append(_totalMsgCount * 1000 / totalTime);
+            buf.append(",");
+            buf.append(" interval Count: ").append(_intervalCount).append(",");
+            if(intervalTime > 0 )
+                buf.append(" interval rate: ").append(_intervalCount * 1000 / intervalTime).append(",");
             buf.append(Runtime.getRuntime().totalMemory() -Runtime.getRuntime().freeMemory()).append("\n");
             buf.append("\n");
             _memoryLog.write(buf.toString());
             _memoryLog.close();
             System.out.println(buf);
+            _intervalStartTime = d.getTime();
         }
         catch (Exception e)
         {

Modified: incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java?rev=599725&r1=599724&r2=599725&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
Fri Nov 30 00:00:22 2007
@@ -4,11 +4,8 @@
 import java.io.IOException;
 import java.sql.Date;
 import java.text.SimpleDateFormat;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 
 import javax.jms.BytesMessage;
-import javax.jms.Connection;
 import javax.jms.Destination;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
@@ -27,10 +24,11 @@
 
     String _logFileName;
     long _startTime;
+    long _intervalStartTime;
     long _totalMsgCount;
     long _intervalCount;
 
-    private Connection _connection;
+    private AMQConnection _connection;
     private Session _session;
     private BytesMessage _payload;
     private MessageProducer _producer;
@@ -39,8 +37,7 @@
     {
        this.parseOptions();
        _logFileName = _logFilePath + "/MessageProducerTest_" + System.currentTimeMillis();
-
-       AMQConnection _connection = ConnectionUtility.getInstance().getConnection();
+       _connection = ConnectionUtility.getInstance().getConnection();
        _connection.start();
        Destination dest = Boolean.getBoolean("useQueue")? new AMQQueue(_connection,_destination)
: new AMQTopic(_connection,_destination);
        _session = _connection.createSession(_transacted, Session.AUTO_ACKNOWLEDGE);
@@ -72,10 +69,10 @@
                 // check every x messages to see if times up
                 if(_intervalCount >= _logFrequency)
                 {
-                    _intervalCount = 0;
                     if (Boolean.getBoolean("collect_stats"))
                     {
                         runReaper();
+                        _intervalCount = 0;
                     }
                     if (System.currentTimeMillis() - _startTime >= _expiry)
                     {
@@ -101,16 +98,24 @@
             FileWriter _memoryLog = new FileWriter(_logFileName + ".csv",true);
             StringBuffer buf = new StringBuffer();
             Date d = new Date(System.currentTimeMillis());
-            double totaltime = d.getTime() - _startTime;
+            long currentTime = d.getTime();
+            long intervalTime =  currentTime -  _intervalStartTime;
+            long totalTime = currentTime - _startTime;
             buf.append(df.format(d)).append(",");
             buf.append(d.getTime()).append(",");
-            buf.append(_totalMsgCount).append(",");
-            buf.append(_totalMsgCount*1000 /totaltime).append(",");
+            buf.append(" total Msg Count: ").append(_totalMsgCount).append(",");
+            if(totalTime > 0 )            
+            buf.append(" rate: ").append(_totalMsgCount * 1000 / totalTime);
+            buf.append(",");
+            buf.append(" interval Count: ").append(_intervalCount).append(",");
+            if(intervalTime > 0 )            
+                buf.append(" interval rate: ").append(_intervalCount * 1000 / intervalTime).append(",");
             buf.append(Runtime.getRuntime().totalMemory() -Runtime.getRuntime().freeMemory()).append("\n");
             buf.append("\n");
             _memoryLog.write(buf.toString());
             _memoryLog.close();
             System.out.println(buf);
+            _intervalStartTime = d.getTime();
         }
         catch (Exception e)
         {

Modified: incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java?rev=599725&r1=599724&r2=599725&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
Fri Nov 30 00:00:22 2007
@@ -25,7 +25,7 @@
         _messageSize = Integer.parseInt(System.getProperty("messageSize","100"));
         _transacted = false;
         _destination = System.getProperty("destinations");
-        _logFrequency = Long.parseLong(System.getProperty("logFrequency","1000"));
+        _logFrequency = Long.parseLong(System.getProperty("logFrequency","10000"));
         _logFilePath = System.getProperty("logFilePath");
         _expiry = getExpiry();
 



Mime
View raw message