[jboss-cvs] JBossAS SVN: r107375 - in projects/jboss-jca/branches/performance: apps and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 4 06:35:28 EDT 2010


Author: jeff.zhang
Date: 2010-08-04 06:35:27 -0400 (Wed, 04 Aug 2010)
New Revision: 107375

Added:
   projects/jboss-jca/branches/performance/apps/
   projects/jboss-jca/branches/performance/apps/.classpath
   projects/jboss-jca/branches/performance/apps/.project
   projects/jboss-jca/branches/performance/apps/build.xml
   projects/jboss-jca/branches/performance/apps/src/
   projects/jboss-jca/branches/performance/apps/src/main/
   projects/jboss-jca/branches/performance/apps/src/main/java/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/
   projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/BenchmarkReport.java
   projects/jboss-jca/branches/performance/apps/src/main/resources/
Modified:
   projects/jboss-jca/branches/performance/build.xml
   projects/jboss-jca/branches/performance/servers/build.xml
Log:
[JBJCA-394] Generate report from performance data, simple init tool

Added: projects/jboss-jca/branches/performance/apps/.classpath
===================================================================
--- projects/jboss-jca/branches/performance/apps/.classpath	                        (rev 0)
+++ projects/jboss-jca/branches/performance/apps/.classpath	2010-08-04 10:35:27 UTC (rev 107375)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="eclipse-target/classes"/>
+</classpath>

Added: projects/jboss-jca/branches/performance/apps/.project
===================================================================
--- projects/jboss-jca/branches/performance/apps/.project	                        (rev 0)
+++ projects/jboss-jca/branches/performance/apps/.project	2010-08-04 10:35:27 UTC (rev 107375)
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>jboss-jca-performance-apps</name>
+  <comment>JBoss JCA performance applications module</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>

Added: projects/jboss-jca/branches/performance/apps/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/apps/build.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/apps/build.xml	2010-08-04 10:35:27 UTC (rev 107375)
@@ -0,0 +1,113 @@
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+-->
+<project name="ironjacamar-performance-apps" 
+         default="jars" 
+         xmlns:ivy="antlib:org.apache.ivy.ant">
+
+  <!-- ================================= 
+       Properties              
+       ================================= -->
+  <property name="build.apps.dir" value="${build.dir}/apps" />
+
+  <!-- ================================= 
+       Target: compile
+       ================================= -->
+  <target name="compile">
+    <mkdir dir="${build.apps.dir}" />
+    <mkdir dir="${build.apps.dir}/impl" />
+
+    <javac srcdir="src/main"
+           destdir="${build.apps.dir}/impl"
+           classpathref="lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}">
+      <compilerarg value="-Xlint"/>
+    </javac> 
+  </target>
+
+  <!-- ================================= 
+       Target: jars 
+       ================================= -->
+  <target name="jars" depends="compile">
+    <mkdir dir="${build.apps.dir}/jars" />
+
+    <copy todir="${build.apps.dir}/jars">
+      <fileset dir="${build.apps.dir}/impl"
+               includes="**"/>
+    </copy>
+
+    <jar destfile="${target.dir}/ironjacamar-performance-apps.jar"
+         basedir="${build.apps.dir}/jars">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar Deployers (Fungal)"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+  </target>
+
+  <!-- ================================= 
+       Target: benchmark-report
+       ================================= -->
+  <target name="benchmark-report">
+    <copy todir="${build.dir}">
+      <fileset dir="src/main/resources/" includes="*"/>
+    </copy>
+    <path id="benchmark.report.classpath">
+      <fileset dir="${target.dir}" includes="ironjacamar-performance-apps.jar"/>
+    </path>
+
+    <java classname="org.jboss.jca.performance.apps.BenchmarkReport" dir="${build.dir}">
+      <arg value="${root.dir}"/>
+      <arg value="${kit.version}"/>
+      <arg value="${report.num}"/>
+      <classpath refid="benchmark.report.classpath"/>
+    </java>
+
+  </target>
+
+  <!-- ================================= 
+       Target: docs
+       ================================= -->
+  <target name="docs" depends="compile">
+    <mkdir dir="${target.dir}/docs/performance"/>
+    <javadoc packagenames="org.*"
+             sourcepath="src/main/java"
+             destdir="${target.dir}/docs/performance"
+             author="true"
+             version="true"
+             windowtitle="JBoss JCA performance"
+             doctitle="JBoss JCA performance"
+             use="true"
+             additionalparam="-author -version"
+             classpath="${build.apps.dir}/impl"
+             classpathref="lib.path.id"
+             bottom="Copyright &#169; 2008-2010 Red Hat Middleware LLC (http://www.jboss.com/)">
+      <link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
+    </javadoc>
+    <copy todir="${target.dir}/docs/performance" overwrite="true">
+      <fileset dir="${tools.dir}/api"/>
+    </copy>
+  </target>
+
+</project>

Added: projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/BenchmarkReport.java
===================================================================
--- projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/BenchmarkReport.java	                        (rev 0)
+++ projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/BenchmarkReport.java	2010-08-04 10:35:27 UTC (rev 107375)
@@ -0,0 +1,272 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jca.performance.apps;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A BenchmarkReport.
+ * 
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class BenchmarkReport
+{
+
+   private List<Data> workmanagerData = new ArrayList<Data>();
+   private List<Data> workmanagerBlockData = new ArrayList<Data>();
+   String serverVersion;
+   
+   /**
+    * main
+    *
+    * @param args param
+    */
+   public static void main(String[] args)
+   {
+      if (args.length < 3)
+         usage("Wrong number of arguments.");
+      
+
+      String dataFilename = args[0] + File.separator + "runs" + File.separator + args[1] + File.separator + "raw"
+         + File.separator + args[2] + File.separator + "data.txt";
+      String reportDir = args[0] + File.separator + "reports" + File.separator + args[1] + File.separator + "benchmark"
+         + File.separator + args[2];
+      
+      try
+      {
+         FileInputStream fin = new FileInputStream(dataFilename);
+         InputStreamReader isr = new InputStreamReader(fin);
+         BufferedReader br = new BufferedReader(isr);
+
+         BenchmarkReport report = new BenchmarkReport();
+         report.serverVersion = args[1];
+         report.readData(br);
+         
+         File path = new File(reportDir);
+         if (!path.exists())
+         {
+            if (!path.mkdirs())
+               throw new IOException("outdir can't be created");
+         }
+         
+         FileWriter fw = new FileWriter(reportDir + File.separator + "report.txt");
+         report.generateTextReport(fw);
+         fin.close();
+         fw.close();
+      }
+      catch (IOException ioe)
+      {
+         ioe.printStackTrace();
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   /**
+    * generateTextReport
+    * 
+    * @param fw writer
+    * @throws IOException
+    */
+   private void generateTextReport(FileWriter fw) throws IOException
+   {
+      String split[] = serverVersion.split("-");
+      if (split[0].equals("jbas"))
+         fw.write("JBoss Application Server ");
+      else if (split[0].equals("jbjca"))
+         fw.write("JBoss IronJacamar Server ");
+      
+      if (split[1].equals("daily"))
+         fw.write("SNAPSHOT");
+      else
+         fw.write(split[1]);
+      writeEol(fw);
+      
+      if (workmanagerData.size() > 0)
+      {
+         fw.write("WorkManager test cases");
+         writeEol(fw);
+         writeEol(fw);
+         
+         writeHeader(fw);
+         writeData(fw, workmanagerData);
+      }
+      
+      if (workmanagerBlockData.size() > 0)
+      {
+         fw.write("WorkManager with clock test cases");
+         writeEol(fw);
+         writeEol(fw);
+         
+         writeHeader(fw);
+         writeData(fw, workmanagerBlockData);
+      }
+   }
+
+   /**
+    * write data table header
+    * 
+    * @param fw writer
+    * @throws IOException
+    */
+   private void writeHeader(FileWriter fw) throws IOException
+   {
+      writeSperate(fw);
+      fw.write("Units");
+      writeSperate(fw);
+      fw.write("Time (ms)");
+      writeSperate(fw);
+      writeEol(fw);
+   }
+
+   /**
+    * write end of line
+    * 
+    * @param fw writer
+    * @throws IOException
+    */
+   private void writeEol(FileWriter fw) throws IOException
+   {
+      fw.write('\n');
+   }
+   
+   /**
+    * write sperate
+    * 
+    * @param fw writer
+    * @throws IOException
+    */
+   private void writeSperate(FileWriter fw) throws IOException
+   {
+      fw.write("\t\t");
+   }
+
+   /**
+    * write data
+    * 
+    * @param fw writer
+    * @param data list of data
+    * @throws IOException
+    */
+   private void writeData(FileWriter fw, List<Data> data) throws IOException
+   {
+      for (Data item : data)
+      {
+         fw.write(item.getTrans());
+         writeSperate(fw);
+         fw.write(item.getNumber());
+         writeSperate(fw);
+         fw.write(item.getTime());
+         writeEol(fw);
+      }
+   }
+   
+   /**
+    * read data from file
+    * 
+    * @param br reader
+    * @throws IOException
+    */
+   private void readData(BufferedReader br) throws IOException
+   {
+      String str;
+      while ((str = br.readLine()) != null)
+      {
+         String part[] = str.split(",");
+         if (part[0].equals("workmanager"))
+         {
+            workmanagerData.add(new Data(part[2], part[3], part[4]));
+         }
+         else if (part[0].equals("workmanager_block"))
+         {
+            workmanagerBlockData.add(new Data(part[2], part[3], part[4]));
+         }
+      }
+   }
+
+   /**
+    * print usage
+    *
+    * @param msg usage message
+    */
+   static void usage(String msg)
+   {
+      System.err.println(msg);
+      System.err.println("Usage: java " + BenchmarkReport.class.getName() + " rootDir serverVersion runNumber");
+      System.exit(1);
+   }
+   
+   class Data
+   {
+      private String trans;
+      private String number;
+      private String time;
+      
+      public Data(String trans, String number, String time)
+      {
+         this.trans = trans;
+         this.number = number;
+         this.time = time;
+      }
+      
+      /**
+       * Get the trans.
+       * 
+       * @return the trans.
+       */
+      public String getTrans()
+      {
+         return trans;
+      }
+
+
+      /**
+       * Get the number.
+       * 
+       * @return the number.
+       */
+      public String getNumber()
+      {
+         return number;
+      }
+
+      /**
+       * Get the time.
+       * 
+       * @return the time.
+       */
+      public String getTime()
+      {
+         return time;
+      }
+   }
+}

Modified: projects/jboss-jca/branches/performance/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/build.xml	2010-08-04 10:03:08 UTC (rev 107374)
+++ projects/jboss-jca/branches/performance/build.xml	2010-08-04 10:35:27 UTC (rev 107375)
@@ -155,6 +155,7 @@
   <target name="jars" depends="resolve">
     <ant dir="rars" inheritRefs="true" target="jars"/>
     <ant dir="extensions" inheritRefs="true" target="jars"/>
+    <ant dir="apps" inheritRefs="true" target="jars"/>
   </target>
   
   <!-- ================================= 
@@ -183,6 +184,13 @@
     <ant dir="servers" inheritRefs="true" target="benchmark-daily"/>
   </target>
 
+  <target name="benchmark-report" depends="jars">
+    <ant dir="apps" inheritRefs="true" target="benchmark-report">
+      <property name="kit.version" value="jbjca-daily"/>
+      <property name="report.num" value="1"/>
+    </ant>
+  </target>
+
   <!-- ================================= 
        Target: profiler
        ================================= -->

Modified: projects/jboss-jca/branches/performance/servers/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/servers/build.xml	2010-08-04 10:03:08 UTC (rev 107374)
+++ projects/jboss-jca/branches/performance/servers/build.xml	2010-08-04 10:35:27 UTC (rev 107375)
@@ -504,6 +504,11 @@
     </sequential>
     </parallel>
 
+    <ant dir="../apps" inheritRefs="true" target="benchmark-report">
+      <property name="kit.version" value="${jbas.version}"/>
+      <property name="report.num" value="${run.number}"/>
+    </ant>
+
   </target>
 
   <target name="benchmark-prepare-jbjca">
@@ -558,6 +563,10 @@
       <arg line="shutdown.${ext}"/>
     </exec>
 
+    <ant dir="../apps" inheritRefs="true" target="benchmark-report">
+      <property name="kit.version" value="${jbjca.version}"/>
+      <property name="report.num" value="${run.number}"/>
+    </ant>
   </target>
 
   <target name="benchmark" depends="os-check">



More information about the jboss-cvs-commits mailing list