[jboss-svn-commits] JBL Code SVN: r32916 - in labs/jbosstm/workspace/whitingjr/trunk/performance: lib and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 17 13:45:27 EDT 2010
Author: whitingjr
Date: 2010-05-17 13:45:27 -0400 (Mon, 17 May 2010)
New Revision: 32916
Added:
labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jcommon-1.0.16.jar
labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jfreechart-1.0.13.jar
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/chart/
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/chart/ChartDstat.java
Modified:
labs/jbosstm/workspace/whitingjr/trunk/performance/build.xml
labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/task/RecursiveTask.java
Log:
Added support to generate charts based on Dstat data.
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/build.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/build.xml 2010-05-17 17:39:32 UTC (rev 32915)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/build.xml 2010-05-17 17:45:27 UTC (rev 32916)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<project name="JBoss TM performance comparison project" default="copy-logs" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+<project name="JBoss TM performance comparison project" default="htm">
<!--
This project executes the Hibernate sample application Caveat Emptor. There are two versions
and this project uses the version based on JPA. By running the sample test case and additional
@@ -41,13 +41,9 @@
<!--
Viewing the profiling results.
- To view the results the GUI called jipViewer needs to be called. Download the binaries
- for JIP from
- http://jiprof.sourceforge.net/
- Inside the client folder is the script to start jipViewer passing the generated XML file.
- usage: jipViewer.sh 20091123-114548-raw.xml &
- A second XML file is generated based on a transformation of the raw xml file. eg.
- 20091123-114548-analysis.xml
+ Use either the profilers GUI to view the captured data.
+ The CPU metrics can be viewed using the generated chart of the Dstat process. A
+ browser ready htm file is generated.
-->
<property name="build.classes.dir" value="build/classes" />
<property name="test.output.dir" value="target" />
@@ -106,6 +102,8 @@
<pathelement path="lib/commons-lang-2.5.jar" />
<pathelement path="lib/commons-exec-1.0.1.jar" />
<pathelement path="lib/thirdparty-all.jar" />
+ <pathelement path="lib/jfreechart-1.0.13.jar" />
+ <pathelement path="lib/jcommon-1.0.16.jar" />
<path refid="database.driver" />
<path refid="profiler.library" />
</path>
@@ -383,18 +381,10 @@
</tstamp>
<mkdir dir="${log.output.dir}/tx-type" />
<mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}" />
- <condition property="installation-location" value="co-located">
- <equals arg1="${resource.A.db.installation}" arg2="${resource.B.db.installation}" />
- </condition>
- <condition property="installation-location" value="remote">
- <not>
- <equals arg1="${resource.A.db.installation}" arg2="${resource.B.db.installation}" />
- </not>
- </condition>
+ <property name="installation-location" value="${resource.A.db.installation}-${resource.B.db.installation}"/>
<mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}" />
<mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler" />
<mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}" />
<condition property="vendor-count" value="single-vendor">
<equals arg1="${resource.A.db.vendor}" arg2="${resource.B.db.vendor}" />
</condition>
@@ -403,7 +393,7 @@
<equals arg1="${resource.A.db.vendor}" arg2="${resource.B.db.vendor}" />
</not>
</condition>
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}" />
<condition property="db-vendor-mix" value="${resource.A.db.vendor}">
<equals arg1="${resource.A.db.vendor}" arg2="${resource.B.db.vendor}" />
</condition>
@@ -412,134 +402,38 @@
<equals arg1="${resource.A.db.vendor}" arg2="${resource.B.db.vendor}" />
</not>
</condition>
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" />
- <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}/conf" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" />
+ <mkdir dir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}/conf" />
- <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}/conf">
+ <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}/conf">
<fileset refid="configuration.path.1" />
<fileset refid="configuration.path.2" />
</copy>
- <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" file="${profile-file}"/>
- <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${resource.A.db.installation}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" file="${dstat-file}"/>
+ <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" file="${profile-file}"/>
+ <copy todir="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}" file="${dstat-file}"/>
</target>
+
+ <target name="htm" depends="copy-logs">
+ <java classname="org.jboss.jbossts.chart.ChartDstat">
+ <classpath>
+ <path refid="run.classpath" />
+ </classpath>
+ <arg value="${log.output.dir}/tx-type/${resource.A.jdbc-datasource}/installation/${installation-location}/profiler/${profiler}/${vendor-count}/${db-vendor-mix}/thread-count/${threads}/${DSTAMP}/${DSTAMP}-${time-stamp}"/>
+ <arg value="${dstat-file}"/>
+ <arg value="${DSTAMP}-${time-stamp}"/>
+ </java>
+ </target>
- <!--target name="categorise" depends="profile" unless="ignore-categorise">
-
- <property name="xpaths-csv" value="${testcase.xpaths},${db-vendor.method.xpaths.A},${db-vendor.method.xpaths.B}" />
- <tstamp />
- <echo message="db vendor package[${db-vendor-package.xpath}]">
- </echo>
-
- <tstamp>
- <format property="time-stamp" pattern="kkmmss" />
- </tstamp>
- <mkdir dir="logs/${DSTAMP}" />
-
- <mkdir dir="logs/${DSTAMP}/${DSTAMP}-${time-stamp}" />
- <mkdir dir="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/conf" />
-
- <copy todir="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/conf">
- <fileset refid="configuration.path.1" />
- <fileset refid="configuration.path.2" />
- </copy>
-
- <copy file="logs/profiled/DATE-TIME-profile.xml" tofile="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-raw.xml" />
-
- <xslt style="src/main/resources/xsl/analyseresults.xsl" in="logs/profiled/DATE-TIME-profile.xml" out="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-02.xml">
- <outputproperty name="indent" value="yes" />
- <param name="db-vendor-package.A" expression="${db-vendor-package.xpath.A}" />
- <param name="db-vendor-package.B" expression="${db-vendor-package.xpath.B}" />
- <param name="category0-method" expression="${category0.methods}" />
- <param name="categoryB-method" expression="${categoryB.methods}" />
- <param name="categoryC-method" expression="${categoryC.methods}" />
- <param name="categoryD-method" expression="${categoryD.methods}" />
- <param name="xpaths" expression="${xpaths-csv}" />
- </xslt>
- <copy file="src/main/resources/xsl/csv-parser.xsl" todir="logs/${DSTAMP}/${DSTAMP}-${time-stamp}"/>
-
- <copy file="src/main/resources/xsl/average-results.xsl" tofile="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/average-results.xsl">
- <filterchain>
- <expandproperties />
- </filterchain>
- </copy>
- <xslt style="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/average-results.xsl" in="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-02.xml" out="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-03.xml" />
-
- <copy file="src/main/resources/xsl/agregate.xsl" tofile="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/agregate.xsl">
- <filterchain>
- <expandproperties />
- </filterchain>
- </copy>
- <xslt style="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/agregate.xsl" in="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-03.xml" out="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-04.xml" />
-
- <xslt style="src/main/resources/xsl/convert-xml-to-csv.xsl" in="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis-04.xml" out="logs/${DSTAMP}/${DSTAMP}-${time-stamp}/${DSTAMP}-${time-stamp}-profile-analysis.csv">
- <param name="db-vendor-package.A" expression="${db-vendor-package.xpath.A}" />
- <param name="db-vendor-package.B" expression="${db-vendor-package.xpath.B}" />
- </xslt>
- </target-->
-
<target name="usage">
<echo>Usage: ant ${required-args} [${optional-args}]</echo>
</target>
- <!--target name="transform-switch-package">
- <xslt style="src/main/resources/xsl/package-switch-compactor.xsl" in="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-raw.xml" out="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-compacted.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/flatten-frames.xsl" in="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-compacted.xml" out="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-flattened.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/sort-frames.xsl" in="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-flattened.xml" out="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-sorted.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/distinct-classes.xsl" in="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-sorted.xml" out="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-distinct.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/as-csv.xsl" in="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-distinct.xml" out="logs/20100125-0919/20100125-0919-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-csv.xml">
- </xslt>
- </target>
-
- <target name="distinct">
- <xslt style="src/main/resources/xsl/sort-frames.xsl" in="logs/combined-test-framework-classes.xml" out="logs/combined-test-framework-classes-sorted.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/distinct-classes.xsl" in="logs/combined-test-framework-classes-sorted.xml" out="logs/combined-test-framework-classes-distinct.xml">
- </xslt>
- <xslt style="src/main/resources/xsl/as-csv.xsl" in="logs/combined-test-framework-classes-distinct.xml" out="logs/combined-test-framework-classes.csv">
- </xslt>
- </target>
-
- <target name="process-data">
- <copy file="src/main/resources/xsl/merge-thread-results.xsl" tofile="logs/${date}/${datetime}/merge-thread-results.xsl">
- <filterchain>
- <expandproperties />
- </filterchain>
- </copy>
- <xslt style="logs/${date}/${datetime}/merge-thread-results.xsl" in="logs/${date}/${datetime}/${datetime}-profile-analysis-01.xml" out="logs/${date}/${datetime}/${datetime}-profile-analysis-02.xml" />
-
- <copy file="src/main/resources/xsl/average-results.xsl" tofile="logs/${date}/${datetime}/average-results.xsl">
- <filterchain>
- <expandproperties />
- </filterchain>
- </copy>
- <xslt style="logs/${date}/${datetime}/average-results.xsl" in="logs/${date}/${datetime}/${datetime}-profile-analysis-02.xml" out="logs/${date}/${datetime}/${datetime}-profile-analysis-03.xml" />
-
- <copy file="src/main/resources/xsl/agregate.xsl" tofile="logs/${date}/${datetime}/agregate.xsl">
- <filterchain>
- <expandproperties />
- </filterchain>
- </copy>
- <xslt style="logs/${date}/${datetime}/agregate.xsl" in="logs/${date}/${datetime}/${datetime}-profile-analysis-03.xml" out="logs/${date}/${datetime}/${datetime}-profile-analysis-04.xml" />
-
- <xslt style="src/main/resources/xsl/convert-xml-to-csv.xsl" in="logs/${date}/${datetime}/${datetime}-profile-analysis-04.xml" out="logs/${date}/${datetime}/${datetime}-profile-analysis.csv">
- <param name="db-vendor-package.A" expression="${db-vendor-package.xpath.A}" />
- <param name="db-vendor-package.B" expression="${db-vendor-package.xpath.B}" />
- </xslt>
-
- <copy file="logs/profiled/DATE-TIME-profile.xml" tofile="logs/${date}/${datetime}/${DSTAMP}-${TSTAMP}-${resource.A.db.vendor}-${resource.B.db.vendor}-profile-raw.xml" />
-
- </target-->
-
<!--
Use this task to concatenate the profiling data from several executions of the profiling system.
Move the batched runs to a directory outside of the performance project on your system. Then
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jcommon-1.0.16.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jcommon-1.0.16.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jfreechart-1.0.13.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbosstm/workspace/whitingjr/trunk/performance/lib/jfreechart-1.0.13.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/chart/ChartDstat.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/chart/ChartDstat.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/chart/ChartDstat.java 2010-05-17 17:45:27 UTC (rev 32916)
@@ -0,0 +1,210 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jbossts.chart;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.LineIterator;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.ChartRenderingInfo;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.entity.StandardEntityCollection;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.title.TextTitle;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+import org.jfree.ui.RectangleEdge;
+import org.jfree.ui.VerticalAlignment;
+
+public class ChartDstat
+{
+ private Logger logger = Logger.getLogger(ChartDstat.class);
+ public static void main(String[] args)
+ {
+ ChartDstat chart = new ChartDstat();
+ try
+ {
+ File logDir = new File( args[0]);
+ chart.createHTMLFile( logDir, new File(logDir, args[1]), args[2] );
+ }
+ catch (IOException ioe)
+ {
+ chart.logger.error(ioe.getMessage(), ioe);
+ }
+ }
+
+ /**
+ * This method generates the browser html file.
+ *
+ * @param directory
+ * @param dstatFile
+ * @param uniqueFileName unique file name
+ */
+ private void createHTMLFile(File directory, File dstatFile, String uniqueFileName )
+ throws IOException
+ {
+
+ if (directory.isDirectory() && directory.canWrite() && dstatFile.canRead())
+ {
+ /* chart */
+ JFreeChart chart = ChartFactory.createAreaChart("Dstat", "Time (seconds)", "Processor %", getCategoryDataSet(dstatFile), PlotOrientation.VERTICAL, true, false, false);
+ chart.setBackgroundPaint(Color.white);
+ TextTitle subTitle = new TextTitle("Chart showing the CPU percentage spent during the profiling run.");
+ subTitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
+ subTitle.setPosition(RectangleEdge.TOP);
+ subTitle.setVerticalAlignment(VerticalAlignment.BOTTOM);
+ chart.addSubtitle(subTitle);
+ final CategoryPlot plot = chart.getCategoryPlot();
+ plot.setForegroundAlpha(0.5f);
+
+ plot.setBackgroundPaint(Color.lightGray);
+ plot.setDomainGridlinesVisible(true);
+ plot.setDomainGridlinePaint(Color.white);
+ plot.setRangeGridlinesVisible(true);
+ plot.setRangeGridlinePaint(Color.white);
+
+ final CategoryAxis domainAxis = plot.getDomainAxis();
+ domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
+ domainAxis.setLowerMargin(0.0);
+ domainAxis.setUpperMargin(0.0);
+ final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
+ /* image creation */
+ final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
+ File chartFileName = new File(String.format("%1$s/%2$s.%3$s", directory.getAbsolutePath(), uniqueFileName, "png"));
+ ChartUtilities.saveChartAsPNG(chartFileName, chart, 1000, 400, info);
+
+ File htmlFileName = new File(String.format("%1$s/%2$s.%3$s", directory.getAbsolutePath(), uniqueFileName, "htm"));
+ OutputStream out = null;
+ try
+ {
+ out = new BufferedOutputStream(new FileOutputStream(htmlFileName));
+ PrintWriter writer = new PrintWriter(out);
+ writer.println(String.format("<HTML><HEAD><TITLE>CPU usage.</TITLE></HEAD><BODY><IMG SRC='%1$s.png' WIDTH='1000' HEIGHT='400' BORDER='0' /></BODY></HTML>", uniqueFileName));
+ writer.flush();
+ }
+ finally
+ {
+ IOUtils.closeQuietly(out);
+ }
+ this.logger.info(String.format("Created browser ready chart located here [%1$s/%2$s.%3$s]", directory.getAbsolutePath(), uniqueFileName, "htm"));
+ }
+ else
+ {
+ logger.error(String.format("Could not create html file, is directory [%1$b], can write to directory[%2$b], can read data file[%3$b].", directory.isDirectory(), directory.canWrite(), dstatFile.canRead()));
+ }
+
+ }
+
+ private CategoryDataset getCategoryDataSet(File dstatFile)
+ {
+ double[][] data = getDataSet(dstatFile);
+ DefaultCategoryDataset returnValue = new DefaultCategoryDataset();
+
+ for (int row = 0; row < data[0].length; row += 1)
+ {
+ returnValue.addValue(data[Elements.USER.getPosition()][row], Elements.USER.toString(), String.valueOf(row));
+ returnValue.addValue(data[Elements.SYSTEM.getPosition()][row], Elements.SYSTEM.toString(), String.valueOf(row));
+ returnValue.addValue(data[Elements.IDLE.getPosition()][row], Elements.IDLE.toString(), String.valueOf(row));
+ returnValue.addValue(data[Elements.WAIT.getPosition()][row], Elements.WAIT.toString(), String.valueOf(row));
+ }
+
+ return returnValue;
+ }
+
+ private double[][] getDataSet(File dstatFile)
+ {
+ double[][] returnValue = null;
+ LineIterator lineIter = null;
+ List<String> lines = new ArrayList<String>();
+ try
+ {
+ lineIter = FileUtils.lineIterator(dstatFile);
+
+ while (lineIter.hasNext())
+ {// loading the data file into memory
+ String line = lineIter.nextLine();
+ if (StringUtils.isNotBlank(line) && !StringUtils.contains(line, '"'))
+ {
+ lines.add(line);
+ }
+ }
+
+ returnValue = new double[4][lines.size()] ;
+
+ for (String line : lines)
+ {
+ int index = lines.indexOf(line);
+ String[] data = ((String) line).split(",");
+ returnValue[Elements.USER.getPosition()][index] = Double.parseDouble(data[Elements.USER.getPosition()]) ;
+ returnValue[Elements.SYSTEM.getPosition()][index] = Double.parseDouble(data[Elements.SYSTEM.getPosition()]) ;
+ returnValue[Elements.IDLE.getPosition()][index] = Double.parseDouble(data[Elements.IDLE.getPosition()]) ;
+ returnValue[Elements.WAIT.getPosition()][index] = Double.parseDouble(data[Elements.WAIT.getPosition()]) ;
+ }
+ }
+ catch (Exception e)
+ {
+ logger.error(e.getMessage(), e);
+ }
+ finally
+ {
+ LineIterator.closeQuietly(lineIter);
+ }
+
+ return returnValue;
+ }
+
+ public enum Elements
+ {
+ USER (0), SYSTEM (1), IDLE(2) , WAIT(3) ;
+
+ private int position;
+ private Elements(int pos)
+ {
+ this.position = pos;
+ }
+ public int getPosition()
+ {
+ return this.position;
+ }
+ }
+}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/task/RecursiveTask.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/task/RecursiveTask.java 2010-05-17 17:39:32 UTC (rev 32915)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/test/java/org/jboss/jbossts/performance/task/RecursiveTask.java 2010-05-17 17:45:27 UTC (rev 32916)
@@ -30,6 +30,7 @@
import org.apache.log4j.NDC;
import org.jboss.jbossts.performance.configuration.JPAConfiguration;
import org.jboss.jbossts.performance.resource.SynchronizeTask;
+import org.jboss.jbossts.performance.xa.managed.XAWrappedConnection;
import org.testng.Assert;
/**
@@ -78,8 +79,8 @@
* this thread to execute the task. nano seconds */
this.taskConfiguration.getTestConfiguration().getResults().add(( totalTime.toLong()/this.recurseCount));// serialized modification, insertion order not important
}
- DbUtils.closeQuietly(this.taskConfiguration.getConnectionHandler().getConnectionA());
- DbUtils.closeQuietly(this.taskConfiguration.getConnectionHandler().getConnectionB());
+ DbUtils.closeQuietly(((XAWrappedConnection)this.taskConfiguration.getConnectionHandler().getConnectionA()).getWrappedConnection());//really release the connection
+ DbUtils.closeQuietly(((XAWrappedConnection)this.taskConfiguration.getConnectionHandler().getConnectionB()).getWrappedConnection());//really release the connection
this.taskConfiguration.getTestConfiguration().getCompletionBarrier().await();// await all threads have finished
}
}
More information about the jboss-svn-commits
mailing list