summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/src/main
diff options
context:
space:
mode:
authorPhil Harvey <philharveyonline@apache.org>2013-01-30 09:15:18 +0000
committerPhil Harvey <philharveyonline@apache.org>2013-01-30 09:15:18 +0000
commit56ae5b5536cd437278fe50339f02993fcadf6980 (patch)
tree758c5d3dbece4f0a044eb12048fdbda10f5f04a6 /qpid/java/perftests/src/main
parent9541aea473799f98d5aa34ef18548d586228ac00 (diff)
downloadqpid-python-56ae5b5536cd437278fe50339f02993fcadf6980.tar.gz
QPID-4533: Modified perftests to support writing results to a database, and enhanced visualisation-jfc to allow it to read these results.
Previously only CSV output/input was supported by these modules respectively. Also modified files in perftests/etc/ to allow convenient running of perftests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1440312 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/perftests/src/main')
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java6
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java37
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java3
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java435
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java4
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java43
-rw-r--r--qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java4
7 files changed, 519 insertions, 13 deletions
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java
index 8c1f8675e3..e962bfe799 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ArgumentParser.java
@@ -34,10 +34,14 @@ public class ArgumentParser
throw new IllegalArgumentException("arguments must have format <name>=<value>: " + arg);
}
- if(initialValues.put(splitArg[0], splitArg[1]) == null)
+
+ String argumentKey = splitArg[0];
+ String argumentValue = splitArg[1];
+ if(!initialValues.containsKey(argumentKey))
{
throw new IllegalArgumentException("not a valid configuration property: " + arg);
}
+ initialValues.put(argumentKey, argumentValue);
}
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java
index a0e949bddc..449130a328 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java
@@ -30,6 +30,7 @@ import org.apache.qpid.disttest.controller.Controller;
import org.apache.qpid.disttest.controller.ResultsForAllTests;
import org.apache.qpid.disttest.controller.config.Config;
import org.apache.qpid.disttest.controller.config.ConfigReader;
+import org.apache.qpid.disttest.db.ResultsDbWriter;
import org.apache.qpid.disttest.jms.ControllerJmsDelegate;
import org.apache.qpid.disttest.results.aggregation.Aggregator;
import org.slf4j.Logger;
@@ -42,22 +43,29 @@ public class ControllerRunner extends AbstractRunner
public static final String TEST_CONFIG_PROP = "test-config";
public static final String DISTRIBUTED_PROP = "distributed";
public static final String OUTPUT_DIR_PROP = "outputdir";
+ public static final String WRITE_TO_DB = "writeToDb";
+ public static final String RUN_ID = "runId";
private static final String TEST_CONFIG_DEFAULT = "perftests-config.json";
private static final String DISTRIBUTED_DEFAULT = "false";
private static final String OUTPUT_DIR_DEFAULT = ".";
+ public static final String WRITE_TO_DB_DEFAULT = "false";
private final Aggregator _aggregator = new Aggregator();
private final ConfigFileHelper _configFileHelper = new ConfigFileHelper();
- private ResultsFileWriter _resuResultsFileWriter;
+ private ResultsFileWriter _resultsFileWriter;
+
+ private ResultsDbWriter _resultsDbWriter;
public ControllerRunner()
{
getCliOptions().put(TEST_CONFIG_PROP, TEST_CONFIG_DEFAULT);
getCliOptions().put(DISTRIBUTED_PROP, DISTRIBUTED_DEFAULT);
getCliOptions().put(OUTPUT_DIR_PROP, OUTPUT_DIR_DEFAULT);
+ getCliOptions().put(WRITE_TO_DB, WRITE_TO_DB_DEFAULT);
+ getCliOptions().put(RUN_ID, null);
}
public static void main(String[] args) throws Exception
@@ -70,7 +78,8 @@ public class ControllerRunner extends AbstractRunner
public void runController() throws Exception
{
Context context = getContext();
- setUpResultsWriter();
+ setUpResultFilesWriter();
+ setUpResultsDbWriter();
ControllerJmsDelegate jmsDelegate = new ControllerJmsDelegate(context);
@@ -84,11 +93,22 @@ public class ControllerRunner extends AbstractRunner
}
}
- void setUpResultsWriter()
+ private void setUpResultsDbWriter()
+ {
+ String writeToDbStr = getCliOptions().get(WRITE_TO_DB);
+ if(Boolean.valueOf(writeToDbStr))
+ {
+ String runId = getCliOptions().get(RUN_ID);
+ _resultsDbWriter = new ResultsDbWriter(getContext(), runId);
+ _resultsDbWriter.createResultsTableIfNecessary();
+ }
+ }
+
+ void setUpResultFilesWriter()
{
String outputDirString = getCliOptions().get(ControllerRunner.OUTPUT_DIR_PROP);
File outputDir = new File(outputDirString);
- _resuResultsFileWriter = new ResultsFileWriter(outputDir);
+ _resultsFileWriter = new ResultsFileWriter(outputDir);
}
private void runTests(ControllerJmsDelegate jmsDelegate)
@@ -115,7 +135,7 @@ public class ControllerRunner extends AbstractRunner
results.add(testResult);
}
- _resuResultsFileWriter.writeResultsSummary(results);
+ _resultsFileWriter.writeResultsSummary(results);
}
catch(Exception e)
{
@@ -135,7 +155,12 @@ public class ControllerRunner extends AbstractRunner
ResultsForAllTests rawResultsForAllTests = controller.runAllTests();
ResultsForAllTests resultsForAllTests = _aggregator.aggregateResults(rawResultsForAllTests);
- _resuResultsFileWriter.writeResultsToFile(resultsForAllTests, testConfigFile);
+ _resultsFileWriter.writeResultsToFile(resultsForAllTests, testConfigFile);
+ if(_resultsDbWriter != null)
+ {
+ _resultsDbWriter.writeResults(resultsForAllTests);
+ }
+
return resultsForAllTests;
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java
index 8d25f86b77..d3a5e30191 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/ConsumerParticipant.java
@@ -35,7 +35,6 @@ import javax.jms.MessageListener;
import org.apache.qpid.disttest.DistributedTestException;
import org.apache.qpid.disttest.jms.ClientJmsDelegate;
-import org.apache.qpid.disttest.message.ConsumerParticipantResult;
import org.apache.qpid.disttest.message.CreateConsumerCommand;
import org.apache.qpid.disttest.message.ParticipantResult;
import org.slf4j.Logger;
@@ -113,7 +112,7 @@ public class ConsumerParticipant implements Participant
getName(), numberOfMessagesReceived);
}
- ConsumerParticipantResult result = _resultFactory.createForConsumer(
+ ParticipantResult result = _resultFactory.createForConsumer(
getName(),
registeredClientName,
_command,
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java
new file mode 100644
index 0000000000..bd3405eadf
--- /dev/null
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/db/ResultsDbWriter.java
@@ -0,0 +1,435 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.disttest.db;
+
+import static org.apache.qpid.disttest.message.ParticipantAttribute.*;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.log4j.Logger;
+import org.apache.qpid.disttest.controller.ResultsForAllTests;
+import org.apache.qpid.disttest.message.ParticipantResult;
+import org.apache.qpid.disttest.results.aggregation.ITestResult;
+
+/**
+ * Intended call sequence:
+ * <ul>
+ * <li>{@link #ResultsDbWriter(Context, String)}</li>
+ * <li>{@link #createResultsTableIfNecessary()}</li>
+ * <li>{@link #writeResults(ResultsForAllTests)} (usually multiple times)</li>
+ * </ul>
+ */
+public class ResultsDbWriter
+{
+ private static final Logger _logger = Logger.getLogger(ResultsDbWriter.class);
+
+ private static final String RESULTS_TABLE_NAME = "RESULTS";
+
+ /** column name */
+ static final String INSERTED_TIMESTAMP = "insertedTimestamp";
+ /** column name */
+ static final String RUN_ID = "runId";
+
+ private static final String TABLE_EXISTENCE_QUERY = "SELECT 1 FROM SYS.SYSTABLES WHERE TABLENAME = ?";
+
+ private static final String CREATE_RESULTS_TABLE = String.format(
+ "CREATE TABLE %1$s (" +
+ "%2$s varchar(200) not null" + // TEST_NAME
+ ", %3$s bigint not null" + // ITERATION_NUMBER
+ ", %4$s varchar(200) not null" + // PARTICIPANT_NAME
+ ", %5$s double not null" + // THROUGHPUT
+ ", %6$s double" + // AVERAGE_LATENCY
+ ", %7$s varchar(200)" + // CONFIGURED_CLIENT_NAME
+ ", %8$s bigint" + // NUMBER_OF_MESSAGES_PROCESSED
+ ", %9$s bigint" + // PAYLOAD_SIZE
+ ", %10$s bigint" + // PRIORITY
+ ", %11$s bigint" + // TIME_TO_LIVE
+ ", %12$s bigint" + // ACKNOWLEDGE_MODE
+ ", %13$s bigint" + // DELIVERY_MODE
+ ", %14$s bigint" + // BATCH_SIZE
+ ", %15$s bigint" + // MAXIMUM_DURATION
+ ", %16$s bigint" + // PRODUCER_START_DELAY
+ ", %17$s bigint" + // PRODUCER_INTERVAL
+ ", %18$s bigint" + // IS_TOPIC
+ ", %19$s bigint" + // IS_DURABLE_SUBSCRIPTION
+ ", %20$s bigint" + // IS_BROWSING_SUBSCRIPTION
+ ", %21$s bigint" + // IS_SELECTOR
+ ", %22$s bigint" + // IS_NO_LOCAL
+ ", %23$s bigint" + // IS_SYNCHRONOUS_CONSUMER
+ ", %24$s bigint" + // TOTAL_NUMBER_OF_CONSUMERS
+ ", %25$s bigint" + // TOTAL_NUMBER_OF_PRODUCERS
+ ", %26$s bigint" + // TOTAL_PAYLOAD_PROCESSED
+ ", %27$s bigint" + // TIME_TAKEN
+ ", %28$s varchar(2000)" + // ERROR_MESSAGE
+ ", %29$s bigint" + // MIN_LATENCY
+ ", %30$s bigint" + // MAX_LATENCY
+ ", %31$s double" + // LATENCY_STANDARD_DEVIATION
+ ", %32$s varchar(200) not null" +
+ ", %33$s timestamp not null" +
+ ")",
+ RESULTS_TABLE_NAME,
+ TEST_NAME.getDisplayName(),
+ ITERATION_NUMBER.getDisplayName(),
+ PARTICIPANT_NAME.getDisplayName(),
+ THROUGHPUT.getDisplayName(),
+ AVERAGE_LATENCY.getDisplayName(),
+ CONFIGURED_CLIENT_NAME.getDisplayName(),
+ NUMBER_OF_MESSAGES_PROCESSED.getDisplayName(),
+ PAYLOAD_SIZE.getDisplayName(),
+ PRIORITY.getDisplayName(),
+ TIME_TO_LIVE.getDisplayName(),
+ ACKNOWLEDGE_MODE.getDisplayName(),
+ DELIVERY_MODE.getDisplayName(),
+ BATCH_SIZE.getDisplayName(),
+ MAXIMUM_DURATION.getDisplayName(),
+ PRODUCER_START_DELAY.getDisplayName(),
+ PRODUCER_INTERVAL.getDisplayName(),
+ IS_TOPIC.getDisplayName(),
+ IS_DURABLE_SUBSCRIPTION.getDisplayName(),
+ IS_BROWSING_SUBSCRIPTION.getDisplayName(),
+ IS_SELECTOR.getDisplayName(),
+ IS_NO_LOCAL.getDisplayName(),
+ IS_SYNCHRONOUS_CONSUMER.getDisplayName(),
+ TOTAL_NUMBER_OF_CONSUMERS.getDisplayName(),
+ TOTAL_NUMBER_OF_PRODUCERS.getDisplayName(),
+ TOTAL_PAYLOAD_PROCESSED.getDisplayName(),
+ TIME_TAKEN.getDisplayName(),
+ ERROR_MESSAGE.getDisplayName(),
+ MIN_LATENCY.getDisplayName(),
+ MAX_LATENCY.getDisplayName(),
+ LATENCY_STANDARD_DEVIATION.getDisplayName(),
+ RUN_ID,
+ INSERTED_TIMESTAMP
+ );
+
+ public static final String DRIVER_NAME = "jdbcDriverClass";
+ public static final String URL = "jdbcUrl";
+
+ private final String _url;
+ private final String _runId;
+
+ private final Clock _clock;
+
+ /**
+ * @param runId may be null, in which case a default value is chosen based on current time.
+ * @param context must contain environment entries {@value #DRIVER_NAME} and {@value #URL}.
+ */
+ public ResultsDbWriter(Context context, String runId)
+ {
+ this(context, runId, new Clock());
+ }
+
+ /** only call directly from tests */
+ ResultsDbWriter(Context context, String runId, Clock clock)
+ {
+ _clock = clock;
+ _runId = defaultIfNullRunId(runId);
+
+ _url = initialiseJdbc(context);
+ }
+
+ private String defaultIfNullRunId(String runId)
+ {
+ if(runId == null)
+ {
+ Date dateNow = new Date(_clock.currentTimeMillis());
+ return String.format("run %1$tF %1$tT.%tL", dateNow);
+ }
+ else
+ {
+ return runId;
+ }
+ }
+
+ public String getRunId()
+ {
+ return _runId;
+ }
+
+ /**
+ * Uses the context's environment to load the JDBC driver class and return the
+ * JDBC URL specified therein.
+ * @return the JDBC URL
+ */
+ private String initialiseJdbc(Context context)
+ {
+ Hashtable<?, ?> environment = null;
+ try
+ {
+ environment = context.getEnvironment();
+
+ String driverName = (String) environment.get(DRIVER_NAME);
+ if(driverName == null)
+ {
+ throw new IllegalArgumentException("JDBC driver name " + DRIVER_NAME
+ + " missing from context environment: " + environment);
+ }
+
+ @SuppressWarnings("unchecked")
+ Class<? extends Driver> driverClass = (Class<? extends Driver>) Class.forName(driverName);
+
+ Object url = environment.get(URL);
+ if(url == null)
+ {
+ throw new IllegalArgumentException("JDBC URL " + URL + " missing from context environment: " + environment);
+ }
+ return (String) url;
+ }
+ catch (NamingException e)
+ {
+ throw constructorRethrow(e, environment);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw constructorRethrow(e, environment);
+ }
+ }
+
+ private RuntimeException constructorRethrow(Exception e, Hashtable<?, ?> environment)
+ {
+ return new RuntimeException("Couldn't initialise ResultsDbWriter from context with environment" + environment, e);
+ }
+
+ public void createResultsTableIfNecessary()
+ {
+ try
+ {
+ Connection connection = null;
+ try
+ {
+ connection = DriverManager.getConnection(_url);
+ if(!tableExists(RESULTS_TABLE_NAME, connection))
+ {
+ Statement statement = connection.createStatement();
+ try
+ {
+ _logger.info("About to create results table using SQL: " + CREATE_RESULTS_TABLE);
+ statement.execute(CREATE_RESULTS_TABLE);
+ }
+ finally
+ {
+ statement.close();
+ }
+ }
+ }
+ finally
+ {
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new RuntimeException("Couldn't create results table", e);
+ }
+
+ }
+
+ private boolean tableExists(final String tableName, final Connection conn) throws SQLException
+ {
+ PreparedStatement stmt = conn.prepareStatement(TABLE_EXISTENCE_QUERY);
+ try
+ {
+ stmt.setString(1, tableName);
+ ResultSet rs = stmt.executeQuery();
+ try
+ {
+ return rs.next();
+ }
+ finally
+ {
+ rs.close();
+ }
+ }
+ finally
+ {
+ stmt.close();
+ }
+ }
+
+ public void writeResults(ResultsForAllTests results)
+ {
+ try
+ {
+ writeResultsThrowingException(results);
+ }
+ catch (SQLException e)
+ {
+ throw new RuntimeException("Couldn't write results " + results, e);
+ }
+ _logger.info(this + " wrote " + results.getTestResults().size() + " results to database");
+ }
+
+ private void writeResultsThrowingException(ResultsForAllTests results) throws SQLException
+ {
+ Connection connection = null;
+ try
+ {
+ connection = DriverManager.getConnection(_url);
+
+ for (ITestResult testResult : results.getTestResults())
+ {
+ for (ParticipantResult participantResult : testResult.getParticipantResults())
+ {
+ writeParticipantResult(connection, participantResult);
+ }
+ }
+ }
+ finally
+ {
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+
+ private void writeParticipantResult(Connection connection, ParticipantResult participantResult) throws SQLException
+ {
+ if(_logger.isDebugEnabled())
+ {
+ _logger.debug("About to write to DB the following participant result: " + participantResult);
+ }
+
+ PreparedStatement statement = null;
+ try
+ {
+ String sqlTemplate = String.format(
+ "INSERT INTO %s (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) " +
+ "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ RESULTS_TABLE_NAME,
+ TEST_NAME.getDisplayName(),
+ ITERATION_NUMBER.getDisplayName(),
+ PARTICIPANT_NAME.getDisplayName(),
+ THROUGHPUT.getDisplayName(),
+ AVERAGE_LATENCY.getDisplayName(),
+ CONFIGURED_CLIENT_NAME.getDisplayName(),
+ NUMBER_OF_MESSAGES_PROCESSED.getDisplayName(),
+ PAYLOAD_SIZE.getDisplayName(),
+ PRIORITY.getDisplayName(),
+ TIME_TO_LIVE.getDisplayName(),
+ ACKNOWLEDGE_MODE.getDisplayName(),
+ DELIVERY_MODE.getDisplayName(),
+ BATCH_SIZE.getDisplayName(),
+ MAXIMUM_DURATION.getDisplayName(),
+ PRODUCER_START_DELAY.getDisplayName(),
+ PRODUCER_INTERVAL.getDisplayName(),
+ IS_TOPIC.getDisplayName(),
+ IS_DURABLE_SUBSCRIPTION.getDisplayName(),
+ IS_BROWSING_SUBSCRIPTION.getDisplayName(),
+ IS_SELECTOR.getDisplayName(),
+ IS_NO_LOCAL.getDisplayName(),
+ IS_SYNCHRONOUS_CONSUMER.getDisplayName(),
+ TOTAL_NUMBER_OF_CONSUMERS.getDisplayName(),
+ TOTAL_NUMBER_OF_PRODUCERS.getDisplayName(),
+ TOTAL_PAYLOAD_PROCESSED.getDisplayName(),
+ TIME_TAKEN.getDisplayName(),
+ ERROR_MESSAGE.getDisplayName(),
+ MIN_LATENCY.getDisplayName(),
+ MAX_LATENCY.getDisplayName(),
+ LATENCY_STANDARD_DEVIATION.getDisplayName(),
+ RUN_ID,
+ INSERTED_TIMESTAMP
+ );
+ statement = connection.prepareStatement(sqlTemplate);
+
+ int columnIndex = 1;
+ statement.setString(columnIndex++, participantResult.getTestName());
+ statement.setInt(columnIndex++, participantResult.getIterationNumber());
+ statement.setString(columnIndex++, participantResult.getParticipantName());
+ statement.setDouble(columnIndex++, participantResult.getThroughput());
+ statement.setDouble(columnIndex++, participantResult.getAverageLatency());
+ statement.setString(columnIndex++, participantResult.getConfiguredClientName());
+ statement.setLong(columnIndex++, participantResult.getNumberOfMessagesProcessed());
+ statement.setLong(columnIndex++, participantResult.getPayloadSize());
+ statement.setLong(columnIndex++, participantResult.getPriority());
+ statement.setLong(columnIndex++, participantResult.getTimeToLive());
+ statement.setLong(columnIndex++, participantResult.getAcknowledgeMode());
+ statement.setLong(columnIndex++, participantResult.getDeliveryMode());
+ statement.setLong(columnIndex++, participantResult.getBatchSize());
+ statement.setLong(columnIndex++, participantResult.getMaximumDuration());
+ statement.setLong(columnIndex++, 0 /* TODO PRODUCER_START_DELAY*/);
+ statement.setLong(columnIndex++, 0 /* TODO PRODUCER_INTERVAL*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_TOPIC*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_DURABLE_SUBSCRIPTION*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_BROWSING_SUBSCRIPTION*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_SELECTOR*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_NO_LOCAL*/);
+ statement.setLong(columnIndex++, 0 /* TODO IS_SYNCHRONOUS_CONSUMER*/);
+ statement.setLong(columnIndex++, participantResult.getTotalNumberOfConsumers());
+ statement.setLong(columnIndex++, participantResult.getTotalNumberOfProducers());
+ statement.setLong(columnIndex++, participantResult.getTotalPayloadProcessed());
+ statement.setLong(columnIndex++, participantResult.getTimeTaken());
+ statement.setString(columnIndex++, participantResult.getErrorMessage());
+ statement.setLong(columnIndex++, participantResult.getMinLatency());
+ statement.setLong(columnIndex++, participantResult.getMaxLatency());
+ statement.setDouble(columnIndex++, participantResult.getLatencyStandardDeviation());
+
+ statement.setString(columnIndex++, _runId);
+ statement.setTimestamp(columnIndex++, new Timestamp(_clock.currentTimeMillis()));
+
+ statement.execute();
+ connection.commit();
+ }
+ finally
+ {
+ if (statement != null)
+ {
+ statement.close();
+ }
+ }
+ }
+
+ public static class Clock
+ {
+ public long currentTimeMillis()
+ {
+ return System.currentTimeMillis();
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
+ .append("runId", _runId)
+ .append("url", _url)
+ .toString();
+ }
+}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
index ad9aa31472..e78f6965d2 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
@@ -134,6 +134,7 @@ public class ConsumerParticipantResult extends ParticipantResult
_messageLatencies = messageLatencies;
}
+ @Override
@OutputAttribute(attribute=ParticipantAttribute.MIN_LATENCY)
public long getMinLatency()
{
@@ -145,6 +146,7 @@ public class ConsumerParticipantResult extends ParticipantResult
_minLatency = minLatency;
}
+ @Override
@OutputAttribute(attribute=ParticipantAttribute.MAX_LATENCY)
public long getMaxLatency()
{
@@ -156,6 +158,7 @@ public class ConsumerParticipantResult extends ParticipantResult
_maxLatency = maxLatency;
}
+ @Override
@OutputAttribute(attribute=ParticipantAttribute.AVERAGE_LATENCY)
public double getAverageLatency()
{
@@ -167,6 +170,7 @@ public class ConsumerParticipantResult extends ParticipantResult
_averageLatency = averageLatency;
}
+ @Override
@OutputAttribute(attribute=ParticipantAttribute.LATENCY_STANDARD_DEVIATION)
public double getLatencyStandardDeviation()
{
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java
index efd248b6de..0a824a316b 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java
@@ -22,12 +22,12 @@ import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER;
import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.MESSAGE_THROUGHPUT;
import static org.apache.qpid.disttest.message.ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.MESSAGE_THROUGHPUT;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
import java.util.Comparator;
import java.util.Date;
@@ -282,4 +282,41 @@ public class ParticipantResult extends Response
_acknowledgeMode = acknowledgeMode;
}
+ public double getLatencyStandardDeviation()
+ {
+ return 0.0;
+ }
+
+ @OutputAttribute(attribute = ParticipantAttribute.MIN_LATENCY)
+ public long getMinLatency()
+ {
+ return 0;
+ }
+
+ @OutputAttribute(attribute = ParticipantAttribute.MAX_LATENCY)
+ public long getMaxLatency()
+ {
+ return 0;
+ }
+
+ @OutputAttribute(attribute = ParticipantAttribute.AVERAGE_LATENCY)
+ public double getAverageLatency()
+ {
+ return 0;
+ }
+
+ public int getPriority()
+ {
+ return 0;
+ }
+
+ public long getTimeToLive()
+ {
+ return 0;
+ }
+
+ public int getDeliveryMode()
+ {
+ return 0;
+ }
}
diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java
index 766c90eec8..2d9399a3d3 100644
--- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java
+++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java
@@ -42,6 +42,7 @@ public class ProducerParticipantResult extends ParticipantResult
setParticipantName(participantName);
}
+ @Override
@OutputAttribute(attribute=PRIORITY)
public int getPriority()
{
@@ -53,6 +54,7 @@ public class ProducerParticipantResult extends ParticipantResult
_priority = priority;
}
+ @Override
@OutputAttribute(attribute=TIME_TO_LIVE)
public long getTimeToLive()
{
@@ -86,6 +88,7 @@ public class ProducerParticipantResult extends ParticipantResult
_interval = producerInterval;
}
+ @Override
@OutputAttribute(attribute=DELIVERY_MODE)
public int getDeliveryMode()
{
@@ -96,5 +99,4 @@ public class ProducerParticipantResult extends ParticipantResult
{
this._deliveryMode = deliveryMode;
}
-
}