Return-Path: Delivered-To: apmail-geronimo-activemq-commits-archive@www.apache.org Received: (qmail 20575 invoked from network); 5 Jul 2006 22:31:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 22:31:05 -0000 Received: (qmail 91059 invoked by uid 500); 5 Jul 2006 22:31:05 -0000 Delivered-To: apmail-geronimo-activemq-commits-archive@geronimo.apache.org Received: (qmail 90912 invoked by uid 500); 5 Jul 2006 22:31:04 -0000 Mailing-List: contact activemq-commits-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-dev@geronimo.apache.org Delivered-To: mailing list activemq-commits@geronimo.apache.org Received: (qmail 90850 invoked by uid 99); 5 Jul 2006 22:31:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 15:31:03 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 15:30:59 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 2BD4A1A9825; Wed, 5 Jul 2006 15:30:38 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r419366 [5/7] - in /incubator/activemq/trunk: activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/ activemq-core/src/main/java/org/apache/activemq/broker/ activemq-core/src/main/java/org/apache/activemq/command/ activemq... Date: Wed, 05 Jul 2006 22:30:26 -0000 To: activemq-commits@geronimo.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060705223038.2BD4A1A9825@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java?rev=419366&r1=419365&r2=419366&view=diff ============================================================================== --- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java (original) +++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java Wed Jul 5 15:30:19 2006 @@ -1,288 +1,288 @@ -/** - * Copyright 2005-2006 The Apache Software Foundation - *

- * Licensed 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.activemq.tool.properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.Iterator; -import java.util.StringTokenizer; -import java.util.Properties; -import java.util.List; -import java.util.ArrayList; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Constructor; - -public final class ReflectionUtil { - private static final Log log = LogFactory.getLog(ReflectionUtil.class); - - private ReflectionUtil() { - } - - public static void configureClass(Object obj, String key, String val) { - try { - String debugInfo; - - Object target = obj; - Class targetClass = obj.getClass(); - - // DEBUG: Debugging Info - debugInfo = "Invoking: " + targetClass.getName(); - - StringTokenizer tokenizer = new StringTokenizer(key, "."); - String keySubString = key; - int tokenCount = tokenizer.countTokens(); - - // For nested settings, get the object first. -1, do not count the last token - for (int j=0; j + * Licensed 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.activemq.tool.properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Iterator; +import java.util.StringTokenizer; +import java.util.Properties; +import java.util.List; +import java.util.ArrayList; +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Constructor; + +public final class ReflectionUtil { + private static final Log log = LogFactory.getLog(ReflectionUtil.class); + + private ReflectionUtil() { + } + + public static void configureClass(Object obj, String key, String val) { + try { + String debugInfo; + + Object target = obj; + Class targetClass = obj.getClass(); + + // DEBUG: Debugging Info + debugInfo = "Invoking: " + targetClass.getName(); + + StringTokenizer tokenizer = new StringTokenizer(key, "."); + String keySubString = key; + int tokenCount = tokenizer.countTokens(); + + // For nested settings, get the object first. -1, do not count the last token + for (int j=0; j"); - } - - protected void writeXmlFooter() { - xmlFileWriter.println(""); - } - - protected void writeXmlTestSettings() { - Properties props; - - // Write test settings - for (Iterator i=testPropsMap.keySet().iterator(); i.hasNext();) { - String key = (String)i.next(); - props = (Properties)testPropsMap.get(key); - writeMap(key, props); - } - - int count = 1; - for (Iterator i=testPropsList.iterator(); i.hasNext();) { - props = (Properties)i.next(); - writeMap("settings" + count++, props); - } - } - - protected void writeXmlLogFile() throws IOException { - // Write throughput data - xmlFileWriter.println(""); - xmlFileWriter.println(""); - - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(tempLogFile))); - String line; - while ((line = reader.readLine()) != null) { - if (line.startsWith("[TP-DATA]")) { - handleCsvData(ReportPlugin.REPORT_PLUGIN_THROUGHPUT, line.substring("[TP-DATA]".length())); - parsePerfCsvData("tpdata", line.substring("[TP-DATA]".length())); - } else if (line.startsWith("[CPU-DATA]")) { - handleCsvData(ReportPlugin.REPORT_PLUGIN_CPU, line.substring("[CPU-DATA]".length())); - parsePerfCsvData("cpudata", line.substring("[CPU-DATA]".length())); - } else if (line.startsWith("[INFO]")) { - xmlFileWriter.println("" + line + ""); - } else { - xmlFileWriter.println("" + line + ""); - } - } - - xmlFileWriter.println(""); - xmlFileWriter.println(""); - } - - protected void writeXmlPerfSummary() { - // Write throughput summary - Map summary = getSummary(ReportPlugin.REPORT_PLUGIN_THROUGHPUT); - - xmlFileWriter.println(""); - xmlFileWriter.println(""); - - String val, clientName, clientVal; - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_TOTAL_TP); - System.out.println("System Total Throughput: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_TOTAL_CLIENTS); - System.out.println("System Total Clients: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_TP); - System.out.println("System Average Throughput: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_EMM_TP); - System.out.println("System Average Throughput Excluding Min/Max: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_CLIENT_TP); - System.out.println("System Average Client Throughput: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_CLIENT_EMM_TP); - System.out.println("System Average Client Throughput Excluding Min/Max: " + val); - xmlFileWriter.println("" + val + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Min Client Throughput Per Sample: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Max Client Throughput Per Sample: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_TOTAL_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Min Client Total Throughput: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_TOTAL_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Max Client Total Throughput: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_AVE_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Min Average Client Throughput: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_AVE_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Max Average Client Throughput: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_AVE_EMM_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Min Average Client Throughput Excluding Min/Max: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_AVE_EMM_TP); - clientName = val.substring(0, val.indexOf("=")); - clientVal = val.substring(val.indexOf("=") + 1); - System.out.println("Max Average Client Throughput Excluding Min/Max: clientName=" + clientName + ", value=" + clientVal); - xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); - - xmlFileWriter.println(""); - xmlFileWriter.println(""); - } - - protected void writeMap(String name, Map map) { - xmlFileWriter.println(""); - xmlFileWriter.println(""); - for (Iterator i=map.keySet().iterator(); i.hasNext();) { - String propKey = (String)i.next(); - Object propVal = map.get(propKey); - xmlFileWriter.println("" + propVal.toString() + ""); - } - xmlFileWriter.println(""); - xmlFileWriter.println(""); - } - - protected void parsePerfCsvData(String elementName, String csvData) { - StringTokenizer tokenizer = new StringTokenizer(csvData, ",;"); - String xmlElement; - - xmlElement = "<" + elementName; - String data, key, val; - while (tokenizer.hasMoreTokens()) { - data = tokenizer.nextToken(); - key = data.substring(0, data.indexOf("=")); - val = data.substring(data.indexOf("=") + 1); - xmlElement += (" " + key + "='" + val + "'"); - } - xmlElement += " />"; - xmlFileWriter.println(xmlElement); - } -} +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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.activemq.tool.reports; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.activemq.tool.reports.plugins.ReportPlugin; +import org.apache.activemq.tool.reports.plugins.ThroughputReportPlugin; + +import java.util.Properties; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Iterator; +import java.util.StringTokenizer; +import java.io.File; +import java.io.PrintWriter; +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.FileInputStream; +import java.io.IOException; + +public class XmlFilePerfReportWriter extends AbstractPerfReportWriter { + private static final Log log = LogFactory.getLog(XmlFilePerfReportWriter.class); + + private File tempLogFile; + private PrintWriter tempLogFileWriter; + + private File xmlFile; + private PrintWriter xmlFileWriter; + + private String reportDir; + private String reportName; + + private Map testPropsMap; + private List testPropsList; + + public XmlFilePerfReportWriter() { + this("", "PerformanceReport.xml"); + } + + public XmlFilePerfReportWriter(String reportDir, String reportName) { + this.testPropsMap = new HashMap(); + this.testPropsList = new ArrayList(); + this.reportDir = reportDir; + this.reportName = reportName; + } + + public void openReportWriter() { + if (tempLogFile == null) { + tempLogFile = createTempLogFile(); + } + + try { + // Disable auto-flush and allocate 100kb of buffer + tempLogFileWriter = new PrintWriter(new BufferedOutputStream(new FileOutputStream(tempLogFile), 102400), false); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + public void closeReportWriter() { + // Flush and close log file writer + tempLogFileWriter.flush(); + tempLogFileWriter.close(); + + writeToXml(); + } + + public String getReportDir() { + return reportDir; + } + + public void setReportDir(String reportDir) { + this.reportDir = reportDir; + } + + public String getReportName() { + return reportName; + } + + public void setReportName(String reportName) { + this.reportName = reportName; + } + + public File getXmlFile() { + return xmlFile; + } + + public void setXmlFile(File xmlFile) { + this.xmlFile = xmlFile; + } + + public void writeInfo(String info) { + tempLogFileWriter.println("[INFO]" + info); + } + + public void writeCsvData(int csvType, String csvData) { + if (csvType == ReportPlugin.REPORT_PLUGIN_THROUGHPUT) { + tempLogFileWriter.println("[TP-DATA]" + csvData); + } else if (csvType == ReportPlugin.REPORT_PLUGIN_CPU) { + tempLogFileWriter.println("[CPU-DATA]" + csvData); + } + } + + public void writeProperties(String header, Properties props) { + testPropsMap.put(header, props); + } + + public void writeProperties(Properties props) { + testPropsList.add(props); + } + + protected File createTempLogFile() { + File f; + try { + f = File.createTempFile("tmpPL", null); + } catch (IOException e) { + f = new File("tmpPL" + System.currentTimeMillis() + ".tmp"); + } + f.deleteOnExit(); + return f; + } + + protected File createXmlFile() { + String filename = (getReportName().endsWith(".xml") ? getReportName() : (getReportName() + ".xml")); + String path = (getReportDir() == null) ? "" : getReportDir(); + + return new File(path + filename); + } + + protected void writeToXml() { + try { + xmlFile = createXmlFile(); + xmlFileWriter = new PrintWriter(new FileOutputStream(xmlFile)); + writeXmlHeader(); + writeXmlTestSettings(); + writeXmlLogFile(); + writeXmlPerfSummary(); + writeXmlFooter(); + xmlFileWriter.close(); + + log.info("Created performance report: " + xmlFile.getAbsolutePath()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void writeXmlHeader() { + xmlFileWriter.println(""); + } + + protected void writeXmlFooter() { + xmlFileWriter.println(""); + } + + protected void writeXmlTestSettings() { + Properties props; + + // Write test settings + for (Iterator i=testPropsMap.keySet().iterator(); i.hasNext();) { + String key = (String)i.next(); + props = (Properties)testPropsMap.get(key); + writeMap(key, props); + } + + int count = 1; + for (Iterator i=testPropsList.iterator(); i.hasNext();) { + props = (Properties)i.next(); + writeMap("settings" + count++, props); + } + } + + protected void writeXmlLogFile() throws IOException { + // Write throughput data + xmlFileWriter.println(""); + xmlFileWriter.println(""); + + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(tempLogFile))); + String line; + while ((line = reader.readLine()) != null) { + if (line.startsWith("[TP-DATA]")) { + handleCsvData(ReportPlugin.REPORT_PLUGIN_THROUGHPUT, line.substring("[TP-DATA]".length())); + parsePerfCsvData("tpdata", line.substring("[TP-DATA]".length())); + } else if (line.startsWith("[CPU-DATA]")) { + handleCsvData(ReportPlugin.REPORT_PLUGIN_CPU, line.substring("[CPU-DATA]".length())); + parsePerfCsvData("cpudata", line.substring("[CPU-DATA]".length())); + } else if (line.startsWith("[INFO]")) { + xmlFileWriter.println("" + line + ""); + } else { + xmlFileWriter.println("" + line + ""); + } + } + + xmlFileWriter.println(""); + xmlFileWriter.println(""); + } + + protected void writeXmlPerfSummary() { + // Write throughput summary + Map summary = getSummary(ReportPlugin.REPORT_PLUGIN_THROUGHPUT); + + xmlFileWriter.println(""); + xmlFileWriter.println(""); + + String val, clientName, clientVal; + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_TOTAL_TP); + System.out.println("System Total Throughput: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_TOTAL_CLIENTS); + System.out.println("System Total Clients: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_TP); + System.out.println("System Average Throughput: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_EMM_TP); + System.out.println("System Average Throughput Excluding Min/Max: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_CLIENT_TP); + System.out.println("System Average Client Throughput: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_SYS_AVE_CLIENT_EMM_TP); + System.out.println("System Average Client Throughput Excluding Min/Max: " + val); + xmlFileWriter.println("" + val + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Min Client Throughput Per Sample: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Max Client Throughput Per Sample: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_TOTAL_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Min Client Total Throughput: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_TOTAL_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Max Client Total Throughput: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_AVE_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Min Average Client Throughput: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_AVE_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Max Average Client Throughput: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MIN_CLIENT_AVE_EMM_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Min Average Client Throughput Excluding Min/Max: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + val = (String)summary.get(ThroughputReportPlugin.KEY_MAX_CLIENT_AVE_EMM_TP); + clientName = val.substring(0, val.indexOf("=")); + clientVal = val.substring(val.indexOf("=") + 1); + System.out.println("Max Average Client Throughput Excluding Min/Max: clientName=" + clientName + ", value=" + clientVal); + xmlFileWriter.println("clientName=" + clientName + ",value=" + clientVal + ""); + + xmlFileWriter.println(""); + xmlFileWriter.println(""); + } + + protected void writeMap(String name, Map map) { + xmlFileWriter.println(""); + xmlFileWriter.println(""); + for (Iterator i=map.keySet().iterator(); i.hasNext();) { + String propKey = (String)i.next(); + Object propVal = map.get(propKey); + xmlFileWriter.println("" + propVal.toString() + ""); + } + xmlFileWriter.println(""); + xmlFileWriter.println(""); + } + + protected void parsePerfCsvData(String elementName, String csvData) { + StringTokenizer tokenizer = new StringTokenizer(csvData, ",;"); + String xmlElement; + + xmlElement = "<" + elementName; + String data, key, val; + while (tokenizer.hasMoreTokens()) { + data = tokenizer.nextToken(); + key = data.substring(0, data.indexOf("=")); + val = data.substring(data.indexOf("=") + 1); + xmlElement += (" " + key + "='" + val + "'"); + } + xmlElement += " />"; + xmlFileWriter.println(xmlElement); + } +} Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/XmlFilePerfReportWriter.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java?rev=419366&r1=419365&r2=419366&view=diff ============================================================================== --- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java (original) +++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java Wed Jul 5 15:30:19 2006 @@ -1,29 +1,29 @@ -/** - * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed 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.activemq.tool.reports.plugins; - -import java.util.Map; - -public class CpuReportPlugin implements ReportPlugin { - public void handleCsvData(String csvData) { - // Do nothing - } - - public Map getSummary() { - return null; // Do nothing - } -} +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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.activemq.tool.reports.plugins; + +import java.util.Map; + +public class CpuReportPlugin implements ReportPlugin { + public void handleCsvData(String csvData) { + // Do nothing + } + + public Map getSummary() { + return null; // Do nothing + } +} Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/CpuReportPlugin.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java?rev=419366&r1=419365&r2=419366&view=diff ============================================================================== --- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java (original) +++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java Wed Jul 5 15:30:19 2006 @@ -1,27 +1,27 @@ -/** - * - * Copyright 2005-2006 The Apache Software Foundation - * - * Licensed 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.activemq.tool.reports.plugins; - -import java.util.Map; - -public interface ReportPlugin { - public static final int REPORT_PLUGIN_THROUGHPUT = 0; - public static final int REPORT_PLUGIN_CPU = 1; - - public void handleCsvData(String csvData); - public Map getSummary(); -} +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed 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.activemq.tool.reports.plugins; + +import java.util.Map; + +public interface ReportPlugin { + public static final int REPORT_PLUGIN_THROUGHPUT = 0; + public static final int REPORT_PLUGIN_CPU = 1; + + public void handleCsvData(String csvData); + public Map getSummary(); +} Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/reports/plugins/ReportPlugin.java ------------------------------------------------------------------------------ svn:eol-style = native