activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From foco...@apache.org
Subject svn commit: r411835 - in /incubator/activemq/trunk: assembly/ tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/
Date Mon, 05 Jun 2006 15:57:40 GMT
Author: foconer
Date: Mon Jun  5 08:57:39 2006
New Revision: 411835

URL: http://svn.apache.org/viewvc?rev=411835&view=rev
Log:
initial support for generating report xml file.

Added:
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfReportGenerator.java
Modified:
    incubator/activemq/trunk/assembly/pom.xml
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
    incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java

Modified: incubator/activemq/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/pom.xml?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/pom.xml (original)
+++ incubator/activemq/trunk/assembly/pom.xml Mon Jun  5 08:57:39 2006
@@ -296,7 +296,6 @@
           </execution>
         </executions>
       </plugin>
-      <!-- 
       <plugin>
         <groupId>incubator-activemq</groupId>
         <artifactId>maven-activemq-perf-plugin</artifactId>
@@ -305,7 +304,6 @@
           <configFile>src/release/conf/activemq.xml</configFile>
         </configuration>
       </plugin>
-      -->
     </plugins>
   </build>
 

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ConsumerMojo.java
Mon Jun  5 08:57:39 2006
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.activemq.tool.JmsConsumerClient;
+import org.apache.activemq.tool.JmsConsumerSystem;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 
@@ -33,43 +33,198 @@
         extends AbstractMojo {
 
     /**
-     * @parameter expression="${url}" default-value="tcp://localhost:61616"
+     * @parameter expression="${sampler.durable}" default-value="60000"
      * @required
      */
-    private String url;
+    private String duration;
 
     /**
-     * @parameter expression="${topic}" default-value="true"
+     * @parameter expression="${sampler.interval}" default-value="5000"
      * @required
      */
-    private String topic;
+    private String interval;
 
     /**
-     * @parameter expression="${subject}"  default-value="FOO.BAR"
+     * @parameter expression="${sampler.rampUpTime}" default-value="10000"
      * @required
      */
-    private String subject;
+    private String rampUpTime;
 
     /**
-     * @parameter expression="${durable}" default-value="false"
+     * @parameter expression="${sampler.rampDownTime}" default-value="10000"
+     * @required
+     */
+    private String rampDownTime;
+
+    /**
+     * @parameter expression="${client.spiClass}" default-value="org.apache.activemq.tool.spi.ActiveMQPojoSPI"
+     * @required
+     */
+    private String spiClass;
+
+    /**
+     * @parameter expression="${client.sessTransacted}" default-value="false"
+     * @required
+     */
+    private String sessTransacted;
+
+    /**
+     * @parameter expression="${client.sessAckMode}" default-value="autoAck"
+     * @required
+     */
+    private String sessAckMode;
+
+    /**
+     * @parameter expression="${client.destName}" default-value="topic://FOO.BAR.TEST"
+     * @required
+     */
+    private String destName;
+
+    /**
+     * @parameter expression="${client.destCount}" default-value="1"
+     * @required
+     */
+    private String destCount;
+
+    /**
+     * @parameter expression="${client.destComposite}" default-value="false"
+     * @required
+     */
+    private String destComposite;
+
+    /**
+     * @parameter expression="${consumer.durable}" default-value="false"
      * @required
      */
     private String durable;
 
     /**
-     * @parameter expression="${maximumMessage}" default-value="10"
+     * @parameter expression="${consumer.asyncRecv}" default-value="true"
+     * @required
+     */
+    private String asyncRecv;
+
+    /**
+     * @parameter expression="${consumer.recvCount}" default-value="1000"
      * @required
      */
-    private String maximumMessage;
+    private String recvCount;
+
+    /**
+     * @parameter expression="${consumer.recvDuration}" default-value="60000"
+     * @required
+     */
+    private String recvDuration;
+
+    /**
+     * @parameter expression="${consumer.recvType}" default-value="time"
+     * @required
+     */
+    private String recvType;
+
+    /**
+     * @parameter expression="${factory.brokerUrl}" default-value="tcp://localhost:61616"
+     * @required
+     */
+    private String brokerUrl;
+
+    /**
+     * @parameter expression="${factory.optimAck}" default-value="true"
+     * @required
+     */
+    private String optimAck;
+
+    /**
+     * @parameter expression="${factory.optimDispatch}" default-value="true"
+     * @required
+     */
+    private String optimDispatch;
+
+    /**
+     * @parameter expression="${factory.prefetchQueue}" default-value="10"
+     * @required
+     */
+    private String prefetchQueue;
+
+    /**
+     * @parameter expression="${factory.prefetchTopic}" default-value="10"
+     * @required
+     */
+    private String prefetchTopic;
+
+    /**
+     * @parameter expression="${factory.useRetroactive}" default-value="false"
+     * @required
+     */
+    private String useRetroactive;
+
+    /**
+     * @parameter expression="${sysTest.numClients}" default-value="5"
+     * @required
+     */
+    private String numClients;
+
+    /**
+     * @parameter expression="${sysTest.totalDests}" default-value="5"
+     * @required
+     */
+    private String totalDests;
+
+    /**
+     * @parameter expression="${sysTest.destDistro}" default-value="all"
+     * @required
+     */
+    private String destDistro;
+
+    /**
+     * @parameter expression="${sysTest.reportDirectory}" default-value="${project.build.directory}/test-perf"
+     * @required
+     */
+    private String reportDirectory;
 
     public void execute()
             throws MojoExecutionException {
 
-        String[] args = {url, topic, subject, durable, maximumMessage};
         try {
-            JmsConsumerClient.main(args);
+            JmsConsumerSystem.main(createArgument());
         } catch (JMSException e) {
-            throw new MojoExecutionException("Error Executing Consumer: " + e.getMessage());
+            throw new MojoExecutionException(e.getMessage());
         }
+
+    }
+
+    public String[] createArgument() {
+        String[] options = new String[25];
+        options[0] = "-Dsampler.duration=" + duration;     // 1 min
+        options[1] = "-Dsampler.interval=" + interval;      // 5 secs
+        options[2] = "-Dsampler.rampUpTime=" + rampUpTime;   // 10 secs
+        options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs
+
+        options[4] = "-Dclient.spiClass=" + spiClass;
+        options[5] = "-Dclient.sessTransacted=" + sessTransacted;
+        options[6] = "-Dclient.sessAckMode=" + sessAckMode;
+        options[7] = "-Dclient.destName=" + destName;
+        options[8] = "-Dclient.destCount=" + destCount;
+        options[9] = "-Dclient.destComposite=" + destComposite;
+
+        options[10] = "-Dconsumer.durable=" + durable;
+        options[11] = "-Dconsumer.asyncRecv=" + asyncRecv;
+        options[12] = "-Dconsumer.recvCount=" + recvCount;     // 1000 messages
+        options[13] = "-Dconsumer.recvDuration=" + recvDuration; // 1 min
+        options[14] = "-Dconsumer.recvType=" + recvType;
+
+        options[15] = "-Dfactory.brokerUrl=" + brokerUrl;
+        options[16] = "-Dfactory.optimAck=" + optimAck;
+        options[17] = "-Dfactory.optimDispatch=" + optimDispatch;
+        options[18] = "-Dfactory.prefetchQueue=" + prefetchQueue;
+        options[19] = "-Dfactory.prefetchTopic=" + prefetchTopic;
+        options[20] = "-Dfactory.useRetroactive=" + useRetroactive;
+
+        options[21] = "-DsysTest.numClients=" + numClients;
+        options[22] = "-DsysTest.totalDests=" + totalDests;
+        options[23] = "-DsysTest.destDistro=" + destDistro;
+        options[24] = "-DsysTest.reportDirectory=" + reportDirectory;
+
+        return options;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/maven/ProducerMojo.java
Mon Jun  5 08:57:39 2006
@@ -1,11 +1,9 @@
 package org.apache.activemq.maven;
 
-import org.apache.activemq.tool.JmsProducerClient;
+import org.apache.activemq.tool.JmsProducerSystem;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 
-import javax.jms.JMSException;
-
 /*
  * Copyright 2001-2005 The Apache Software Foundation.
  *
@@ -33,44 +31,159 @@
         extends AbstractMojo {
 
     /**
-     * @parameter expression="${url}" default-value="tcp://localhost:61616"
+     * @parameter expression="${sampler.durable}" default-value="60000"
      * @required
      */
-    private String url;
+    private String duration;
+
     /**
-     * @parameter expression="${topic}" default-value="true"
+     * @parameter expression="${sampler.interval}" default-value="5000"
      * @required
      */
-    private String topic;
+    private String interval;
+
     /**
-     * @parameter expression="${subject}" default-value="FOO.BAR"
+     * @parameter expression="${sampler.rampUpTime}" default-value="10000"
      * @required
      */
-    private String subject;
+    private String rampUpTime;
+
     /**
-     * @parameter expression="${durable}" default-value="false"
+     * @parameter expression="${sampler.rampDownTime}" default-value="10000"
      * @required
      */
-    private String durable;
+    private String rampDownTime;
+
     /**
-     * @parameter expression="${messageCount}" default-value="10"
+     * @parameter expression="${client.spiClass}" default-value="org.apache.activemq.tool.spi.ActiveMQPojoSPI"
      * @required
      */
-    private String messageCount;
+    private String spiClass;
+
     /**
-     * @parameter expression="${messageSize}" default-value="255"
+     * @parameter expression="${client.sessTransacted}" default-value="false"
+     * @required
+     */
+    private String sessTransacted;
+
+    /**
+     * @parameter expression="${client.sessAckMode}" default-value="autoAck"
+     * @required
+     */
+    private String sessAckMode;
+
+    /**
+     * @parameter expression="${client.destName}" default-value="topic://FOO.BAR.TEST"
+     * @required
+     */
+    private String destName;
+
+    /**
+     * @parameter expression="${client.destCount}" default-value="1"
+     * @required
+     */
+    private String destCount;
+
+    /**
+     * @parameter expression="${client.destComposite}" default-value="false"
+     * @required
+     */
+    private String destComposite;
+
+    /**
+     * @parameter expression="${producer.messageSize}" default-value="1024"
      * @required
      */
     private String messageSize;
 
+    /**
+     * @parameter expression="${producer.sendCount}" default-value="1000"
+     * @required
+     */
+    private String sendCount;
+
+    /**
+     * @parameter expression="${producer.sendDuration}" default-value="60000"
+     * @required
+     */
+    private String sendDuration;
+
+    /**
+     * @parameter expression="${producer.sendType}" default-value="time"
+     * @required
+     */
+    private String sendType;
+
+    /**
+     * @parameter expression="${factory.brokerUrl}" default-value="tcp://localhost:61616"
+     * @required
+     */
+    private String brokerUrl;
+
+    /**
+     * @parameter expression="${factory.asyncSend}" default-value="true"
+     * @required
+     */
+    private String asyncSend;
+
+    /**
+     * @parameter expression="${sysTest.numClients}" default-value="5"
+     * @required
+     */
+    private String numClients;
+
+    /**
+     * @parameter expression="${sysTest.totalDests}" default-value="5"
+     * @required
+     */
+    private String totalDests;
+
+    /**
+     * @parameter expression="${sysTest.destDistro}" default-value="all"
+     * @required
+     */
+    private String destDistro;
+
+    /**
+     * @parameter expression="${sysTest.reportDirectory}" default-value="${project.build.directory}/test-perf"
+     * @required
+     */
+    private String reportDirectory;
+
+
     public void execute()
             throws MojoExecutionException {
 
-        String[] args = {url, topic, subject, durable, messageCount, messageSize};
-        try {
-            JmsProducerClient.main(args);
-        } catch (JMSException e) {
-            throw new MojoExecutionException("Error executing Producer: " + e.getMessage());
-        }
+        JmsProducerSystem.main(createArgument());
+    }
+
+    public String[] createArgument() {
+        String[] options = new String[25];
+        options[0] = "-Dsampler.duration=" + duration;     // 1 min
+        options[1] = "-Dsampler.interval=" + interval;      // 5 secs
+        options[2] = "-Dsampler.rampUpTime=" + rampUpTime;   // 10 secs
+        options[3] = "-Dsampler.rampDownTime=" + rampDownTime; // 10 secs
+
+        options[4] = "-Dclient.spiClass=" + spiClass;
+        options[5] = "-Dclient.sessTransacted=" + sessTransacted;
+        options[6] = "-Dclient.sessAckMode=" + sessAckMode;
+        options[7] = "-Dclient.destName=" + destName;
+        options[8] = "-Dclient.destCount=" + destCount;
+        options[9] = "-Dclient.destComposite=" + destComposite;
+
+        options[10] = "-Dproducer.messageSize="+messageSize;
+        options[11] = "-Dproducer.sendCount="+sendCount;     // 1000 messages
+        options[12] = "-Dproducer.sendDuration="+sendDuration; // 1 min
+        options[13] = "-Dproducer.sendType="+sendType;
+
+        options[14] = "-Dfactory.brokerUrl="+brokerUrl;
+        options[15] = "-Dfactory.asyncSend="+asyncSend;
+
+        options[21] = "-DsysTest.numClients=" + numClients;
+        options[22] = "-DsysTest.totalDests=" + totalDests;
+        options[23] = "-DsysTest.destDistro=" + destDistro;
+        options[24] = "-DsysTest.reportDirectory=" + reportDirectory;
+
+        return options;
     }
 }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsClientSystemSupport.java
Mon Jun  5 08:57:39 2006
@@ -38,6 +38,7 @@
     protected Properties jmsClientSettings = new Properties();
     protected ThreadGroup clientThreadGroup;
     protected PerfMeasurementTool performanceSampler;
+    protected String reportDirectory;
 
     protected int numClients = 1;
     protected int totalDests = 1;
@@ -48,6 +49,13 @@
         performanceSampler = new PerfMeasurementTool();
         performanceSampler.setSamplerSettings(samplerSettings);
 
+        PerfReportGenerator report = new PerfReportGenerator();
+        report.setReportDirectory(this.getReportDirectory());
+        report.setReportName(this.getClass().toString());
+        report.startGenerateReport();
+
+        performanceSampler.setDataOutputStream(report.getDataOutputStream());
+
         clientThreadGroup = new ThreadGroup(getThreadGroupName());
         for (int i=0; i<getNumClients(); i++) {
             final Properties clientSettings = new Properties();
@@ -65,6 +73,9 @@
         }
 
         performanceSampler.startSampler();
+        performanceSampler.waitForSamplerToFinish(0);
+
+        report.stopGenerateReport();
     }
 
     protected void distributeDestinations(String distroType, int clientIndex, int numClients,
int numDests, Properties clientSettings) {
@@ -159,6 +170,14 @@
         } else {
             jmsClientSettings.setProperty(key, value);
         }
+    }
+
+    public String getReportDirectory(){
+        return reportDirectory;
+    }
+
+    public void setReportDirectory(String reportDirectory){
+        this.reportDirectory = reportDirectory;
     }
 
     public Properties getSysTestSettings() {

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerClient.java
Mon Jun  5 08:57:39 2006
@@ -253,7 +253,7 @@
     }
 
     public static void main(String[] args) throws JMSException {
-        String[] options = new String[21];
+        /*String[] options = new String[21];
         options[0] = "-Dsampler.duration=60000";     // 1 min
         options[1] = "-Dsampler.interval=5000";      // 5 secs
         options[2] = "-Dsampler.rampUpTime=10000";   // 10 secs
@@ -279,7 +279,7 @@
         options[19] = "-Dfactory.prefetchTopic=32767";
         options[20] = "-Dfactory.useRetroactive=false";
 
-        args = options;
+        args = options;   */
 
         Properties samplerSettings  = new Properties();
         Properties consumerSettings = new Properties();

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsConsumerSystem.java
Mon Jun  5 08:57:39 2006
@@ -52,7 +52,7 @@
     }
 
     public static void main(String[] args) throws JMSException {
-        String[] options = new String[24];
+        /*String[] options = new String[24];
         options[0] = "-Dsampler.duration=60000";     // 1 min
         options[1] = "-Dsampler.interval=5000";      // 5 secs
         options[2] = "-Dsampler.rampUpTime=10000";   // 10 secs
@@ -82,7 +82,7 @@
         options[22] = "-DsysTest.totalDests=5";
         options[23] = "-DsysTest.destDistro=all";
 
-        args = options;
+        args = options;*/
 
         Properties sysSettings  = new Properties();
         for (int i=0; i<args.length; i++) {
@@ -97,6 +97,7 @@
         }
 
         JmsConsumerSystem sysTest = new JmsConsumerSystem();
+        sysTest.setReportDirectory("./target/Test-perf");
         sysTest.setSettings(sysSettings);
         sysTest.runSystemTest();
     }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerClient.java
Mon Jun  5 08:57:39 2006
@@ -291,7 +291,7 @@
     }
 
     public static void main(String[] args) throws JMSException {
-        String[] options = new String[16];
+        /*String[] options = new String[16];
         options[0] = "-Dsampler.duration=60000";     // 1 min
         options[1] = "-Dsampler.interval=5000";      // 5 secs
         options[2] = "-Dsampler.rampUpTime=10000";   // 10 secs
@@ -312,7 +312,7 @@
         options[14] = "-Dfactory.brokerUrl=tcp://localhost:61616";
         options[15] = "-Dfactory.asyncSend=true";
 
-        args = options;
+        args = options;*/
 
         Properties samplerSettings  = new Properties();
         Properties producerSettings = new Properties();

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/JmsProducerSystem.java
Mon Jun  5 08:57:39 2006
@@ -52,7 +52,7 @@
     }
 
     public static void main(String[] args) {
-        String[] options = new String[19];
+        /*String[] options = new String[19];
         options[0] = "-Dsampler.duration=60000";     // 1 min
         options[1] = "-Dsampler.interval=5000";      // 5 secs
         options[2] = "-Dsampler.rampUpTime=10000";   // 10 secs
@@ -77,7 +77,7 @@
         options[17] = "-DsysTest.totalDests=5";
         options[18] = "-DsysTest.destDistro=all";
 
-        args = options;
+        args = options;*/
 
         Properties sysSettings  = new Properties();
 
@@ -93,6 +93,7 @@
         }
 
         JmsProducerSystem sysTest = new JmsProducerSystem();
+        sysTest.setReportDirectory("./target/Test-perf");
         sysTest.setSettings(sysSettings);
         sysTest.runSystemTest();
     }

Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java?rev=411835&r1=411834&r2=411835&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
(original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfMeasurementTool.java
Mon Jun  5 08:57:39 2006
@@ -19,23 +19,26 @@
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.jms.JMSException;
-import java.util.List;
+import java.io.DataOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
 
 public class PerfMeasurementTool implements PerfEventListener, Runnable {
     public static final String PREFIX_CONFIG_SYSTEM_TEST = "sampler.";
 
-    private long duration     = 5 * 60 * 1000; // 5 mins by default test duration
-    private long interval     = 1000;          // 1 sec sample interval
-    private long rampUpTime   = 1 * 60 * 1000; // 1 min default test ramp up time
+    private long duration = 5 * 60 * 1000; // 5 mins by default test duration
+    private long interval = 1000;          // 1 sec sample interval
+    private long rampUpTime = 1 * 60 * 1000; // 1 min default test ramp up time
     private long rampDownTime = 1 * 60 * 1000; // 1 min default test ramp down time
-    private long sampleIndex  = 0;
+    private long sampleIndex = 0;
 
     private AtomicBoolean start = new AtomicBoolean(false);
-    private AtomicBoolean stop  = new AtomicBoolean(false);
+    private AtomicBoolean stop = new AtomicBoolean(false);
     private AtomicBoolean isRunning = new AtomicBoolean(false);
+    private DataOutputStream dataDoutputStream = null;
     private Properties samplerSettings = new Properties();
 
     private List perfClients = new ArrayList();
@@ -46,7 +49,7 @@
     }
 
     public void registerClient(PerfMeasurable[] clients) {
-        for (int i=0; i<clients.length; i++) {
+        for (int i = 0; i < clients.length; i++) {
             registerClient(clients[i]);
         }
     }
@@ -60,6 +63,14 @@
         ReflectionUtil.configureClass(this, samplerSettings);
     }
 
+    public DataOutputStream getDataOutputStream() {
+        return dataDoutputStream;
+    }
+
+    public void setDataOutputStream(DataOutputStream dataDoutputStream) {
+        this.dataDoutputStream = dataDoutputStream;
+    }
+
     public long getDuration() {
         return duration;
     }
@@ -135,8 +146,8 @@
             }
 
             // Let's reset the throughput first and start getting the samples
-            for (Iterator i=perfClients.iterator(); i.hasNext();) {
-                PerfMeasurable client = (PerfMeasurable)i.next();
+            for (Iterator i = perfClients.iterator(); i.hasNext();) {
+                PerfMeasurable client = (PerfMeasurable) i.next();
                 client.reset();
             }
 
@@ -157,10 +168,10 @@
     }
 
     public void sampleClients() {
-        for (Iterator i=perfClients.iterator(); i.hasNext();) {
-            PerfMeasurable client = (PerfMeasurable)i.next();
-            System.out.println("<sample index=" + sampleIndex + " name=" + client.getClientName()
+
-                               " throughput=" + client.getThroughput() + "/>");
+        for (Iterator i = perfClients.iterator(); i.hasNext();) {
+            PerfMeasurable client = (PerfMeasurable) i.next();
+            writeResult("<sample index=" + sampleIndex + " name=" + client.getClientName()
+
+                    " throughput=" + client.getThroughput() + "/>\n");
             client.reset();
         }
     }
@@ -173,6 +184,14 @@
                 }
             } catch (InterruptedException e) {
             }
+        }
+    }
+
+    public void writeResult(String result) {
+        try {
+            getDataOutputStream().writeChars(result);
+        } catch (IOException e) {
+            e.printStackTrace();
         }
     }
 }

Added: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfReportGenerator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfReportGenerator.java?rev=411835&view=auto
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfReportGenerator.java
(added)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/PerfReportGenerator.java
Mon Jun  5 08:57:39 2006
@@ -0,0 +1,99 @@
+package org.apache.activemq.tool;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: admin
+ * Date: Jun 5, 2006
+ * Time: 10:57:52 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PerfReportGenerator {
+
+    private String reportDirectory = null;
+    private String reportName = null;
+    private DataOutputStream dataOutputStream = null;
+    private Properties clientSetting;
+
+    public PerfReportGenerator() {
+    }
+
+    public PerfReportGenerator(String reportDirectory, String reportName) {
+        this.setReportDirectory(reportDirectory);
+        this.setReportName(reportName);
+    }
+
+    public void startGenerateReport() {
+
+        setReportDirectory(reportDirectory);
+        setReportName(reportName);
+
+        File reportDir = new File(getReportDirectory());
+
+        // Create output directory if it doesn't exist.
+        if (!reportDir.exists()) {
+            reportDir.mkdirs();
+        }
+
+        File reportFile = null;
+        if (reportDir != null) {
+            reportFile = new File(reportDirectory + File.separator + reportName + ".xml");
+        }
+
+        try {
+            dataOutputStream = new DataOutputStream(new FileOutputStream(reportFile));
+            dataOutputStream.writeChars(getTestInformation().toString());
+        } catch (IOException e1) {
+            e1.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+    }
+
+    public void stopGenerateReport() {
+        try {
+            dataOutputStream.writeChars("</test-result>\n</test-report>");
+            dataOutputStream.flush();
+            dataOutputStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+    }
+
+    protected String getTestInformation() {
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append("<test-report>\n");
+        buffer.append("<test-information>\n");
+        buffer.append("<os-name>" + System.getProperty("os.name") + "</os-name>\n");
+        buffer.append("<java-version>" + System.getProperty("java.version") + "</java-version>\n");
+        buffer.append("</test-information>\n");
+        buffer.append("<test-result>\n");
+
+        return buffer.toString();
+    }
+
+    public DataOutputStream getDataOutputStream() {
+        return this.dataOutputStream;
+    }
+
+
+    public String getReportDirectory() {
+        return reportDirectory;
+    }
+
+    public void setReportDirectory(String reportDirectory) {
+        this.reportDirectory = reportDirectory;
+    }
+
+    public String getReportName() {
+        return reportName;
+    }
+
+    public void setReportName(String reportName) {
+        this.reportName = reportName;
+    }
+}



Mime
View raw message