[jboss-cvs] JBossAS SVN: r108356 - in projects/jboss-jca/branches/performance: apps/src/main/java/org/jboss/jca/performance/apps and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 27 02:01:59 EDT 2010
Author: jeff.zhang
Date: 2010-09-27 02:01:59 -0400 (Mon, 27 Sep 2010)
New Revision: 108356
Added:
projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/ProfilerIndexReport.java
projects/jboss-jca/branches/performance/apps/src/main/resources/jbas-launch.properties
projects/jboss-jca/branches/performance/apps/src/main/resources/jbjca-launch.properties
Modified:
projects/jboss-jca/branches/performance/apps/build.xml
projects/jboss-jca/branches/performance/servers/build.xml
Log:
[JBJCA-424] add profiler index.html include setting properties
Modified: projects/jboss-jca/branches/performance/apps/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/apps/build.xml 2010-09-27 05:57:54 UTC (rev 108355)
+++ projects/jboss-jca/branches/performance/apps/build.xml 2010-09-27 06:01:59 UTC (rev 108356)
@@ -52,6 +52,17 @@
<mkdir dir="${build.apps.dir}/jars" />
<copy todir="${build.apps.dir}/jars">
+ <fileset dir="src/main/resources" includes="*.properties"/>
+ </copy>
+
+ <copy tofile="${build.apps.dir}/jars/jbas-profiler.properties">
+ <fileset dir="${build.dir}/../servers/src/main/resources/jbas" includes="jboss-profiler.properties"/>
+ </copy>
+ <copy tofile="${build.apps.dir}/jars/jbjca-profiler.properties">
+ <fileset dir="${build.dir}/../servers/src/main/resources/jbjca" includes="jboss-profiler.properties"/>
+ </copy>
+
+ <copy todir="${build.apps.dir}/jars">
<fileset dir="${build.apps.dir}/impl"
includes="**"/>
</copy>
@@ -117,6 +128,24 @@
</target>
<!-- =================================
+ Target: profiler-index-report
+ ================================= -->
+ <target name="profiler-index-report">
+ <copy todir="${root.dir}/reports/${kit.version}/profiler/${report.num}">
+ <fileset dir="src/main/resources" includes="*.css"/>
+ </copy>
+ <path id="benchmark.report.classpath">
+ <fileset dir="${target.dir}" includes="ironjacamar-performance-apps.jar"/>
+ </path>
+ <java classname="org.jboss.jca.performance.apps.ProfilerIndexReport" 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">
Added: projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/ProfilerIndexReport.java
===================================================================
--- projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/ProfilerIndexReport.java (rev 0)
+++ projects/jboss-jca/branches/performance/apps/src/main/java/org/jboss/jca/performance/apps/ProfilerIndexReport.java 2010-09-27 06:01:59 UTC (rev 108356)
@@ -0,0 +1,213 @@
+/*
+ * 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.File;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+
+/**
+ * A ProfilerIndexReport.
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ProfilerIndexReport
+{
+ static final int DIR_NOT_EXIST = 1;
+ /**
+ * main
+ *
+ * @param args param
+ */
+ public static void main(String[] args)
+ {
+ if (args.length < 3)
+ usage("Wrong number of arguments.");
+
+ String reportDir = args[0] + File.separator + "reports" + File.separator + args[1] + File.separator + "profiler"
+ + File.separator + args[2];
+
+ try
+ {
+ ProfilerIndexReport report = new ProfilerIndexReport();
+
+ File path = new File(reportDir);
+ if (!path.exists())
+ {
+ System.exit(DIR_NOT_EXIST);
+ }
+
+ File files[];
+ files = path.listFiles(new FilenameFilter()
+ {
+ @Override
+ public boolean accept(File dir, String name)
+ {
+ if (name.endsWith("rar"))
+ return true;
+ return false;
+ }
+ });
+
+ String dirs[] = new String[files.length];
+ for (int i = 0; i< files.length; i++)
+ dirs[i] = files[i].getName();
+
+ FileWriter fw = new FileWriter(reportDir + File.separator + "index.html");
+
+ report.generateReport(fw, args[1], dirs);
+ fw.close();
+ }
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * generateTextReport
+ *
+ * @param fw writer
+ * @param serverType server type
+ * @param dirs directories
+ * @throws IOException
+ */
+ void generateReport(FileWriter fw, String serverType, String[] dirs) throws IOException
+ {
+ String type = serverType.substring(0, serverType.indexOf('-'));
+
+ fw.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
+ writeEol(fw);
+ fw.write("<html><head><title>benchmark report</title>");
+ writeEol(fw);
+ fw.write("<link rel=\"stylesheet\" type=\"text/css\" id=\"css\" href=\"html.css\">");
+ writeEol(fw);
+ fw.write("</head><body>");
+ writeEol(fw);
+ fw.write("<h1>" + serverType + " profiler reports:</h1>");
+ writeEol(fw);
+ for (int i = 0; i < dirs.length; i++)
+ {
+ fw.write("<li><a href=\"" + dirs[i] + "/index.html\">" + dirs[i] + "</a></li>");
+ writeEol(fw);
+ }
+
+ fw.write("<h1>Profiler properties:</h1>");
+ writeEol(fw);
+
+ URL profilerFile = ProfilerIndexReport.class.getResource("/" + type + "-profiler.properties");
+ String profilerString = readFileIntoString(profilerFile);
+ fw.write("<pre>" + profilerString + "</pre>");
+
+ fw.write("<h1>How to launch profiler running:</h1>");
+ writeEol(fw);
+
+ URL launchFile = ProfilerIndexReport.class.getResource("/" + type + "-launch.properties");
+ String launchString = readFileIntoString(launchFile);
+ fw.write("<pre>" + launchString + "</pre>");
+
+ fw.write("</body></html>");
+ }
+
+ /**
+ * write end of line
+ *
+ * @param fw writer
+ * @throws IOException
+ */
+ public void writeEol(FileWriter fw) throws IOException
+ {
+ fw.write('\n');
+ }
+
+ /**
+ * print usage
+ *
+ * @param msg usage message
+ */
+ static void usage(String msg)
+ {
+ System.err.println(msg);
+ System.err.println("Usage: java " + HtmlBenchmarkReport.class.getName() + " rootDir serverVersion runNumber");
+ System.exit(1);
+ }
+
+ /**
+ * Reads the contents of a file into a string variable.
+ *
+ * @param input url
+ * @return string of return
+ * @throws IOException ioException
+ */
+ public static String readFileIntoString(URL input) throws IOException
+ {
+
+ InputStream stream = null;
+ InputStreamReader reader = null;
+ try
+ {
+ stream = input.openStream();
+ reader = new InputStreamReader(stream);
+ return readStreamIntoString(reader);
+ }
+ finally
+ {
+ if (reader != null)
+ reader.close();
+ if (stream != null)
+ stream.close();
+ }
+ }
+
+ /**
+ * Reads the contents of a stream into a string variable.
+ *
+ * @param reader url
+ * @return string of return
+ * @throws IOException ioException
+ */
+ private static String readStreamIntoString(Reader reader) throws IOException
+ {
+ StringBuilder s = new StringBuilder();
+ char a[] = new char[0x10000];
+ while (true)
+ {
+ int l = reader.read(a);
+ if (l == -1)
+ break;
+ if (l <= 0)
+ throw new IOException();
+ s.append(a, 0, l);
+ }
+ return s.toString();
+ }
+}
Added: projects/jboss-jca/branches/performance/apps/src/main/resources/jbas-launch.properties
===================================================================
--- projects/jboss-jca/branches/performance/apps/src/main/resources/jbas-launch.properties (rev 0)
+++ projects/jboss-jca/branches/performance/apps/src/main/resources/jbas-launch.properties 2010-09-27 06:01:59 UTC (rev 108356)
@@ -0,0 +1,16 @@
+ <target name="jbas-config-profiler" depends="jbas-config" if="jbas.home">
+ <server:config javaHome="${env.JAVA_HOME}" jbossHome="${jbas.home}">
+ <server name="default" host="localhost">
+ <jvmarg value="-javaagent:${jbas.home}/bin/profiler/jboss-profiler.jar"/>
+ <jvmarg value="-Djboss-profiler.properties=${jbas.home}/bin/jboss-profiler.properties" />
+ <jvmarg value="-Xms128m" />
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=512m" />
+ <jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
+ <jvmarg value="-XX:-UseGCOverheadLimit" />
+
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jbas.home}/lib/endorsed" />
+ </server>
+ </server:config>
+ </target>
Added: projects/jboss-jca/branches/performance/apps/src/main/resources/jbjca-launch.properties
===================================================================
--- projects/jboss-jca/branches/performance/apps/src/main/resources/jbjca-launch.properties (rev 0)
+++ projects/jboss-jca/branches/performance/apps/src/main/resources/jbjca-launch.properties 2010-09-27 06:01:59 UTC (rev 108356)
@@ -0,0 +1,7 @@
+# Start IronJacamar
+"$JAVA" $JAVA_OPTS \
+ -Djava.endorsed.dirs="$IRON_JACAMAR_ENDORSED_DIRS" \
+ -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl \
+ -Dlog4j.defaultInitOverride=true \
+ -javaagent:jboss-profiler.jar -Djboss-profiler.properties=jboss-profiler.properties \
+ -jar ironjacamar-sjc.jar "$@"
\ No newline at end of file
Modified: projects/jboss-jca/branches/performance/servers/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/servers/build.xml 2010-09-27 05:57:54 UTC (rev 108355)
+++ projects/jboss-jca/branches/performance/servers/build.xml 2010-09-27 06:01:59 UTC (rev 108356)
@@ -398,6 +398,10 @@
<arg line="shutdown.${ext}"/>
</exec>
+ <ant dir="../apps" inheritRefs="true" target="profiler-index-report">
+ <property name="kit.version" value="${jbjca.version}"/>
+ <property name="report.num" value="${run.number}"/>
+ </ant>
</target>
<target name="profiler-jbas" depends="profiler-prepare-jbas, profiler-prepare, jbas-config-profiler">
@@ -455,6 +459,11 @@
<echo message="Stoping server..."/>
<server:stop name="default"/>
+
+ <ant dir="../apps" inheritRefs="true" target="profiler-index-report">
+ <property name="kit.version" value="${jbas.version}"/>
+ <property name="report.num" value="${run.number}"/>
+ </ant>
</target>
<!-- =================================
More information about the jboss-cvs-commits
mailing list