1. Filename includes some config info of client.
2. Additional test information in the generated report.


git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@412046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Frederick G. Oconer 2006-06-06 08:43:13 +00:00
parent fa37910edd
commit 52602f0377
5 changed files with 66 additions and 13 deletions

View File

@ -19,7 +19,7 @@
<plugin> <plugin>
<groupId>incubator-activemq</groupId> <groupId>incubator-activemq</groupId>
<artifactId>maven-activemq-perf-plugin</artifactId> <artifactId>maven-activemq-perf-plugin</artifactId>
<version>4.0-SNAPSHOT</version> <version>4.1-SNAPSHOT</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -50,8 +50,8 @@ public abstract class JmsClientSystemSupport {
performanceSampler.setSamplerSettings(samplerSettings); performanceSampler.setSamplerSettings(samplerSettings);
PerfReportGenerator report = new PerfReportGenerator(); PerfReportGenerator report = new PerfReportGenerator();
report.setReportDirectory(this.getReportDirectory()); report.setReportName(this.getClass().getCanonicalName());
report.setReportName(this.getClass().toString()); report.setTestSettings(getSettings());
report.startGenerateReport(); report.startGenerateReport();
performanceSampler.setDataOutputStream(report.getDataOutputStream()); performanceSampler.setDataOutputStream(report.getDataOutputStream());

View File

@ -52,7 +52,7 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
} }
public static void main(String[] args) throws JMSException { public static void main(String[] args) throws JMSException {
/*String[] options = new String[24]; /*String[] options = new String[25];
options[0] = "-Dsampler.duration=60000"; // 1 min options[0] = "-Dsampler.duration=60000"; // 1 min
options[1] = "-Dsampler.interval=5000"; // 5 secs options[1] = "-Dsampler.interval=5000"; // 5 secs
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
@ -81,6 +81,7 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
options[21] = "-DsysTest.numClients=5"; options[21] = "-DsysTest.numClients=5";
options[22] = "-DsysTest.totalDests=5"; options[22] = "-DsysTest.totalDests=5";
options[23] = "-DsysTest.destDistro=all"; options[23] = "-DsysTest.destDistro=all";
options[24] = "-DsysTest.reportDirectory=./target/test-perf";
args = options;*/ args = options;*/
@ -97,7 +98,6 @@ public class JmsConsumerSystem extends JmsClientSystemSupport {
} }
JmsConsumerSystem sysTest = new JmsConsumerSystem(); JmsConsumerSystem sysTest = new JmsConsumerSystem();
sysTest.setReportDirectory("./target/Test-perf");
sysTest.setSettings(sysSettings); sysTest.setSettings(sysSettings);
sysTest.runSystemTest(); sysTest.runSystemTest();
} }

View File

@ -52,7 +52,7 @@ public class JmsProducerSystem extends JmsClientSystemSupport {
} }
public static void main(String[] args) { public static void main(String[] args) {
/*String[] options = new String[19]; /*String[] options = new String[20];
options[0] = "-Dsampler.duration=60000"; // 1 min options[0] = "-Dsampler.duration=60000"; // 1 min
options[1] = "-Dsampler.interval=5000"; // 5 secs options[1] = "-Dsampler.interval=5000"; // 5 secs
options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs options[2] = "-Dsampler.rampUpTime=10000"; // 10 secs
@ -76,6 +76,7 @@ public class JmsProducerSystem extends JmsClientSystemSupport {
options[16] = "-DsysTest.numClients=5"; options[16] = "-DsysTest.numClients=5";
options[17] = "-DsysTest.totalDests=5"; options[17] = "-DsysTest.totalDests=5";
options[18] = "-DsysTest.destDistro=all"; options[18] = "-DsysTest.destDistro=all";
options[19] = "-DsysTest.reportDirectory=./target/test-perf";
args = options; */ args = options; */
@ -93,7 +94,6 @@ public class JmsProducerSystem extends JmsClientSystemSupport {
} }
JmsProducerSystem sysTest = new JmsProducerSystem(); JmsProducerSystem sysTest = new JmsProducerSystem();
sysTest.setReportDirectory("./target/Test-perf");
sysTest.setSettings(sysSettings); sysTest.setSettings(sysSettings);
sysTest.runSystemTest(); sysTest.runSystemTest();
} }

View File

@ -5,6 +5,8 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import java.util.Enumeration;
import java.util.Iterator;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -18,7 +20,8 @@ public class PerfReportGenerator {
private String reportDirectory = null; private String reportDirectory = null;
private String reportName = null; private String reportName = null;
private DataOutputStream dataOutputStream = null; private DataOutputStream dataOutputStream = null;
private Properties clientSetting;
private Properties testSettings;
public PerfReportGenerator() { public PerfReportGenerator() {
} }
@ -30,8 +33,7 @@ public class PerfReportGenerator {
public void startGenerateReport() { public void startGenerateReport() {
setReportDirectory(reportDirectory); setReportDirectory(this.getTestSettings().getProperty("sysTest.reportDirectory"));
setReportName(reportName);
File reportDir = new File(getReportDirectory()); File reportDir = new File(getReportDirectory());
@ -42,7 +44,8 @@ public class PerfReportGenerator {
File reportFile = null; File reportFile = null;
if (reportDir != null) { if (reportDir != null) {
reportFile = new File(reportDirectory + File.separator + reportName + ".xml"); String filename = (this.getReportName()).substring(this.getReportName().lastIndexOf(".")+1)+"-"+createReportName(getTestSettings());
reportFile = new File(this.getReportDirectory() + File.separator + filename + ".xml");
} }
try { try {
@ -68,8 +71,26 @@ public class PerfReportGenerator {
buffer.append("<test-report>\n"); buffer.append("<test-report>\n");
buffer.append("<test-information>\n"); buffer.append("<test-information>\n");
buffer.append("<os-name>" + System.getProperty("os.name") + "</os-name>\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("<java-version>" + System.getProperty("java.version") + "</java-version>\n");
if(this.getTestSettings()!=null){
Enumeration keys = getTestSettings().propertyNames();
buffer.append("<client-settings>\n");
String key;
String key2;
while(keys.hasMoreElements()){
key = (String) keys.nextElement();
key2 = key.substring(key.indexOf(".")+1);
buffer.append("<" + key2 +">" + getTestSettings().get(key) + "</" + key2 +">\n");
}
buffer.append("</client-settings>\n");
}
buffer.append("</test-information>\n"); buffer.append("</test-information>\n");
buffer.append("<test-result>\n"); buffer.append("<test-result>\n");
@ -93,7 +114,39 @@ public class PerfReportGenerator {
return reportName; return reportName;
} }
public String createReportName(Properties testSettings) {
if(testSettings!=null){
String[] keys = {"client.destCount","consumer.asyncRecv","consumer.durable",
"producer.messageSize","sysTest.numClients","sysTest.totalDests"};
StringBuffer buffer = new StringBuffer();
String key;
String val;
String temp;
for(int i=0;i<keys.length;i++){
key = keys[i];
val = testSettings.getProperty(key);
if(val==null)continue;
temp = key.substring(key.indexOf(".")+1);
buffer.append(temp+val);
}
return buffer.toString();
}
return null;
}
public void setReportName(String reportName) { public void setReportName(String reportName) {
this.reportName = reportName; this.reportName = reportName;
} }
public Properties getTestSettings() {
return testSettings;
}
public void setTestSettings(Properties testSettings) {
this.testSettings = testSettings;
}
} }