summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2007-11-30 08:00:22 +0000
committerArnaud Simon <arnaudsimon@apache.org>2007-11-30 08:00:22 +0000
commite9e8f1636bb2e48b6252a9802516337883ce596f (patch)
treed624df257319a69749ca07126851e64173ea2a88
parentb90b3468947d80ab0b73fdd21fff8d6ab47b2195 (diff)
downloadqpid-python-e9e8f1636bb2e48b6252a9802516337883ce596f.tar.gz
added interval rate
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@599725 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java38
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java25
-rw-r--r--java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java2
3 files changed, 33 insertions, 32 deletions
diff --git a/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java b/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
index 9700c1733e..a618a6599d 100644
--- a/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
+++ b/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
@@ -5,19 +5,15 @@ import java.io.IOException;
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 @@ public class MessageConsumerTest extends Options implements MessageListener
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 @@ public class MessageConsumerTest extends Options implements MessageListener
{
_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 @@ public class MessageConsumerTest extends Options implements MessageListener
printSummary();
_session.close();
_connection.stop();
- return;
}
}
}
@@ -101,19 +89,27 @@ public class MessageConsumerTest extends Options implements MessageListener
{
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)
{
diff --git a/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java b/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
index 084e098cc3..4398b28131 100644
--- a/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
+++ b/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageProducerTest.java
@@ -4,11 +4,8 @@ import java.io.FileWriter;
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 @@ public class MessageProducerTest extends Options
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 @@ public class MessageProducerTest extends Options
{
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 @@ public class MessageProducerTest extends Options
// 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 @@ public class MessageProducerTest extends Options
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)
{
diff --git a/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java b/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
index e9a86b8014..4fc8f036ff 100644
--- a/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
+++ b/java/perftests/src/main/java/org/apache/qpid/client/perf/Options.java
@@ -25,7 +25,7 @@ public class Options
_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();