[jboss-cvs] JBoss Profiler SVN: r425 - in trunk: docbook/en/images and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 19 20:13:38 EST 2008
Author: Huijuan Shao
Date: 2008-02-19 20:13:38 -0500 (Tue, 19 Feb 2008)
New Revision: 425
Added:
trunk/docbook/en/images/Screenshot- methods detail.png
trunk/docbook/en/images/Screenshot-CallingTreeApplet.png
trunk/docbook/en/images/Screenshot-DetailClassSummary.png
trunk/docbook/en/images/Screenshot-DetailMethodList.png
trunk/docbook/en/images/Screenshot-DetailMethodSummary.png
trunk/docbook/en/images/Screenshot-DetailPackageSummary.png
trunk/docbook/en/images/Screenshot-GroupDefinitionInput.png
trunk/docbook/en/images/Screenshot-GroupDetailMethod.png
trunk/docbook/en/images/Screenshot-GroupList.png
trunk/docbook/en/images/Screenshot-SequenceDiagramApplet.png
trunk/docbook/en/images/Screenshot-class applet.png
trunk/docbook/en/images/Screenshot-class summary.png
trunk/docbook/en/images/Screenshot-method summary.png
trunk/docbook/en/images/Screenshot-methods list.png
trunk/docbook/en/images/Screenshot-methods tree.png
trunk/docbook/en/images/Screenshot-package applet.png
trunk/docbook/en/images/Screenshot-package summary.png
trunk/docbook/en/images/Screenshot_GroupExport.png
trunk/docbook/en/images/Screenshot_GroupImport.png
trunk/java/libs/appletsLibs/plugin.jar
trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphApplet.java
trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphAppletTest.java
trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet.java
trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet2.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphCallings.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphGroup.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphReference.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTree.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTreeNode.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGraphCell.java
trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGroup.java
trunk/java/src/engine/org/jboss/profiler/util/GroupMatcher.java
trunk/java/src/engine/org/jboss/profiler/util/GroupUtil.java
trunk/java/src/engine/org/jboss/profiler/util/SPYGroupComparator.java
trunk/java/src/engine/org/jboss/profiler/util/SPYGroupNameConvert.java
trunk/java/src/engine/org/jboss/profiler/util/SPYJBTMethodComparator.java
trunk/java/src/engine/org/jboss/profiler/util/SPYTreeNodeComparator.java
trunk/java/src/engine/org/jboss/profiler/util/UserGroupUtil.java
trunk/java/src/tests/TestDefaultPackage.java
trunk/java/src/tests/TestPackageAndDefaultPackage.java
trunk/java/src/web/org/jboss/profiler/web/form/TracerFilterForm.java
trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServer.java
trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServerTest.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupAppletServlet.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDispatchServlet.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDownloadServlet.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupInfoServlet.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupServlet.java
trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupUploadServlet.java
trunk/java/webRoot/JspException.jsp
trunk/java/webRoot/classSummary.jsp
trunk/java/webRoot/detailClassSummary.jsp
trunk/java/webRoot/detailMethodSummary.jsp
trunk/java/webRoot/detailPackageSummary.jsp
trunk/java/webRoot/groupPath.jsp
trunk/java/webRoot/methodSummary.jsp
trunk/java/webRoot/packageSummary.jsp
trunk/java/webRoot/packageViewException.jsp
trunk/java/webRoot/referenceAddNewGroup.html
trunk/java/webRoot/referenceAppletView.jsp
trunk/java/webRoot/referenceException.jsp
trunk/java/webRoot/referenceMethodView.jsp
trunk/java/webRoot/referenceSelect.jsp
trunk/java/webRoot/referenceSelectedgroups.html
trunk/java/webRoot/referenceView.jsp
trunk/java/webRoot/traceTransactionMenu.inc
trunk/java/webRoot/traceTree.inc
trunk/java/webRoot/traceTreeDetail_top.inc
trunk/java/webRoot/traceTree_top.inc
trunk/java/webRoot/transactionMethodGroupedDetail.jsp
trunk/java/webRoot/transactionMethodsDetail.jsp
trunk/java/webRoot/transactionMethodsFrame.jsp
Modified:
trunk/.classpath
trunk/build.xml
trunk/docbook/en/modules/webinterface.xml
trunk/java/webRoot/WEB-INF/web.xml
trunk/java/webRoot/allTransactions.jsp
trunk/java/webRoot/transactionMethods.jsp
trunk/jvmti-lib/native-tests/org/jboss/profiler/jvmtitest/JVMTITest.java
Log:
Enhanced tracer of profiler, including summarizing and grouping functions.
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/.classpath 2008-02-20 01:13:38 UTC (rev 425)
@@ -9,7 +9,8 @@
<classpathentry kind="src" path="java/src/tests"/>
<classpathentry kind="src" path="java/src/web"/>
<classpathentry kind="src" path="java/src/productionProfiler"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry excluding="java/src/proxyDriver/|jvmti-lib/java-src/|java/src/console/|java/src/mbean/|java/src/engine/|java/src/appletGraph/|java/src/tests/|java/src/web/|java/src/productionProfiler/" kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java5"/>
<classpathentry kind="lib" path="java/libs/appletsLibs/jgraph.jar"/>
<classpathentry kind="lib" path="java/libs/web/commons-beanutils.jar"/>
<classpathentry kind="lib" path="java/libs/web/commons-collections.jar"/>
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/build.xml 2008-02-20 01:13:38 UTC (rev 425)
@@ -73,7 +73,7 @@
<javac srcdir="${src}/proxyDriver" debug="${debug.property}" destdir="${build.classesdir}/proxyDriver" classpathref="build.classpath" compiler="modern"/>
<javac srcdir="${src}/productionProfiler" debug="${debug.property}" destdir="${build.classesdir}/productionProfiler" classpathref="build.classpath" compiler="modern"/>
<javac srcdir="../jvmti-lib/java-src" destdir="${build.classesdir}/jvmti-classes" classpathref="build.classpath" debug="on" compiler="modern" source="1.3" target="1.3"/>
- <javac srcdir="../jvmti-lib/native-tests" destdir="${build.classesdir}/jvmti-classes-test" classpathref="build.classpath" />
+ <javac srcdir="../jvmti-lib/native-tests" destdir="${build.classesdir}/jvmti-classes-test" classpathref="build.classpath" compiler="modern"/>
<copy todir="${build.classesdir}/web">
Added: trunk/docbook/en/images/Screenshot- methods detail.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot- methods detail.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-CallingTreeApplet.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-CallingTreeApplet.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-DetailClassSummary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-DetailClassSummary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-DetailMethodList.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-DetailMethodList.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-DetailMethodSummary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-DetailMethodSummary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-DetailPackageSummary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-DetailPackageSummary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-GroupDefinitionInput.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-GroupDefinitionInput.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-GroupDetailMethod.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-GroupDetailMethod.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-GroupList.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-GroupList.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-SequenceDiagramApplet.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-SequenceDiagramApplet.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-class applet.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-class applet.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-class summary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-class summary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-method summary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-method summary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-methods list.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-methods list.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-methods tree.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-methods tree.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-package applet.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-package applet.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot-package summary.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot-package summary.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot_GroupExport.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot_GroupExport.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docbook/en/images/Screenshot_GroupImport.png
===================================================================
(Binary files differ)
Property changes on: trunk/docbook/en/images/Screenshot_GroupImport.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/docbook/en/modules/webinterface.xml
===================================================================
--- trunk/docbook/en/modules/webinterface.xml 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/docbook/en/modules/webinterface.xml 2008-02-20 01:13:38 UTC (rev 425)
@@ -518,9 +518,11 @@
</listitem>
</itemizedlist>
- <para>You can click on the arrow icon to detail each transaction. You
- will see "transaction details view".</para>
+ <para></para>
+ <para>You can click on the arrow icon to get the details of each
+ transaction.You will see "method summary" view at first.</para>
+
<figure>
<title></title>
@@ -530,78 +532,1275 @@
<mediaobject>
<imageobject>
<imagedata align="center"
- fileref="images/Screenshot-Tracing_Detail.png" />
+ fileref="images/Screenshot-method%20summary.png" />
</imageobject>
</mediaobject>
</screenshot>
</figure>
- <para>The table has the following fields.</para>
+ <para>The upper part (head with the grey background) has the blue links
+ to “package summary”, “class summary”, “method summary”, “package
+ applet”, “class applet”, ”methods list” and ”methods tree”.</para>
+ <para>In the middle, input the package name you want to filter, all the
+ filtered packages’ information will display in the lower table.</para>
+
+ <para>The lower table has the following fields</para>
+
<itemizedlist>
<listitem>
- <para>Methods Order</para>
+ <para>Method Name</para>
- <para>Methods executed in the transaction are listed in sequence.
- Indented methods mean nests. If you have specified any executed
- method(s) on "search view" mentioned above, it/they is/are drawn in
- different color from other methods.</para>
+ <para>Name of summarized method, which appears only once in the
+ table.</para>
</listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of methods with the same method
+ name.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of duration of methods with the same method name by
+ millisecond.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" for the
+ summarized methods which include an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of method running time (milliseconds) of all methods with
+ the same method name.</para>
+
+ <para>The method running time for each method means: Duration in
+ milliseconds of each method’s total time minus all its calling
+ methods’ total time. “UNKNOWN” will be shown for an incomplete
+ method or for a method which calls an incomplete method, if you have
+ chosen "both" or "incomplete" of "transaction type" item on "search
+ view".</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view" , “UNKNOWN” will be shown if any
+ incomplete method shared the same method name.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time, calculated as Total Running Time /
+ Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of all methods with the same method name
+ in nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time, calculated as Total CPU Time / Executed
+ Count.</para>
+ </listitem>
</itemizedlist>
+ <para>Click “package summary” of head, you will get the package summary
+ page:</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-package%20summary.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>Package information in the table has the following fields:</para>
+
<itemizedlist>
<listitem>
- <para>Start Time</para>
+ <para>Package Name</para>
- <para>Start time of each method.</para>
+ <para>Name of summarized package, which appears only once in the
+ table.If there's no package name for some methods, the package name
+ is set to be "default".</para>
</listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of all packages with the same package
+ name.</para>
+
+ <para>The running times for each package are the sum of running
+ times of all methods which belong to it.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of total time (milliseconds) of all packages which share
+ the same package name.</para>
+
+ <para>The Total Time for each package is the sum of total time of
+ all methods which belongs to this package.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any
+ package with this package name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of Method Running Time (milliseconds) of all packages
+ which share the same package name.</para>
+
+ <para>The Method Running Time for each package is the sum of total
+ time of all methods which belongs to this package.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any
+ package with this package name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time for package, calculated as Total Running
+ Time / Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of packages with the same package name
+ in nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time for package, calculated as Total CPU Time /
+ Executed Count.</para>
+ </listitem>
</itemizedlist>
+ <para>Click “package applet” of the clickable blue link, you will see
+ the package applet which shows the package caller-callee
+ relationship.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-package%20applet.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The package applet includes the following elements:</para>
+
<itemizedlist>
<listitem>
+ <para>Box</para>
+
+ <para>Colored box with package name and package CPU percentage. The
+ package CPU percentage is the CPU time percentage of current package
+ over all packages, calculated as Total CPU Time / sum of Total CPU
+ Time.</para>
+ </listitem>
+
+ <listitem>
+ <para>Arrow</para>
+
+ <para>The arrow shows the caller-callee relationship between the
+ packages, it navigates from the caller package to the callee
+ package.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The colored box can be moved and resized by mouse.</para>
+
+ <para>Click “class summary” of the head, the class summary view
+ shows.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-class%20summary.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>This lower package information table has the following
+ fields:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Class Name</para>
+
+ <para>Name of summarized classes, which appears only once in the
+ table.</para>
+ </listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of all classes with the same class name.
+ The running times for each class calculates as the sum of running
+ times of all methods which belong to it.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of duration of the class by millisecond. Duration here is
+ the result of class exited time minus class entered time. If a class
+ called itself, the total time of the class been called is not added
+ to the caller class’s total time. “UNKNOWN” will be shown for an
+ incomplete class.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of Method Running Time (milliseconds) of all classes with
+ the same class name.</para>
+
+ <para>The Method Running Time for each class is the sum of total
+ time of all methods which belongs to this class.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any class
+ with this class name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time for class, calculated as Total Running
+ Time / Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of classes with the same class name in
+ nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time for class , calculated as Total CPU Time /
+ Executed Count.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Click “class applet” of head, the class applet shows the
+ call-callee relationship of all classes.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-class%20applet.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The class applet includes the following elements:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Box</para>
+
+ <para>Colored box with class name and class CPU percentage. The
+ class CPU percentage is the CPU time percentage of current package
+ over all classes, calculated as Total CPU Time / sum of Total CPU
+ Time.</para>
+ </listitem>
+
+ <listitem>
+ <para>Arrow</para>
+
+ <para>The arrow shows the caller-callee relationship between the
+ classes, it navigates from the caller class to the callee
+ class.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The colored box can be moved and resized by mouse.</para>
+
+ <para>Click “methods list” of head, the method list shows.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-methods%20list.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The table in the middle has the following fields:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Methods Order</para>
+
+ <para>Methods executed in the transaction are listed in sequence. If
+ you have specified any executed method(s) on "search view" mentioned
+ above, it/they is/are drawn in different color from other
+ methods.</para>
+ </listitem>
+
+ <listitem>
+ <para>Depth</para>
+
+ <para>Called depth in the transaction. The depth of the 1st method
+ is 1.</para>
+ </listitem>
+
+ <listitem>
+ <para>Start Time</para>
+
+ <para>Start time of each method.</para>
+ </listitem>
+
+ <listitem>
<para>End Time</para>
<para>Finish time of each method. If you have chose "both" or
"incomplete" of "transaction type" item on "search view", this field
says "NOT EXIT" for any incomplete methods.</para>
</listitem>
- </itemizedlist>
- <itemizedlist>
<listitem>
+ <para>Method Running Time</para>
+
+ <para>Duration (milliseconds) of each method’s total time minus all
+ calling methods’ total time.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" for any
+ incomplete methods.</para>
+ </listitem>
+
+ <listitem>
<para>Total Time</para>
<para>Duration of each method by the millisecond. If you have chose
"both" or "incomplete" of "transaction type" item on "search view",
this field says "UNKNOWN" for any incomplete methods.</para>
</listitem>
- </itemizedlist>
- <itemizedlist>
<listitem>
<para>CPU Time</para>
<para>CPU usage time of each method.</para>
</listitem>
- </itemizedlist>
- <itemizedlist>
<listitem>
<para>#Locks</para>
<para>The number of locks in each method if any. If not, this field
is empty.</para>
</listitem>
- </itemizedlist>
- <itemizedlist>
<listitem>
<para>Lock Time</para>
<para>Duration of the locks in each method in millisecond. If there
- is are no locks, this field is empty.</para>
+ are no locks, this field is empty.</para>
</listitem>
</itemizedlist>
+
+ <para>Click on the arrow or method name in the method list, detailed
+ methods list shows. And the background of the clicked method turns
+ pink.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-%20methods%20detail.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The fields in detailed methods page list as:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Relative Running Time</para>
+
+ <para>Duration in milliseconds from the Start Time of the first
+ method to Start Time of current method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Depth</para>
+
+ <para>The called depth in the transaction.</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Name</para>
+
+ <para>Name of Method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Order</para>
+
+ <para>The sequence no of selected transaction.</para>
+ </listitem>
+
+ <listitem>
+ <para>Detailed Start Time</para>
+
+ <para>Start time of each running period of the method. Here if one
+ method doesn’t call any other method, the detailed start time is the
+ same with the Start Time of method. If one method calls other
+ methods, the runtime of each method is separated into several
+ periods. The Detailed Start Time is the start time of one
+ period.</para>
+ </listitem>
+
+ <listitem>
+ <para>Detailed End Time</para>
+
+ <para>Finish time of each running period of the method. Here if one
+ method doesn’t call any other method, the detailed end time is the
+ same with the End Time of method. If one method calls other methods,
+ the runtime of each method is separated into several periods. The
+ Detailed End Time is the end time of one period. “NOT EXIT” will be
+ shown for an incomplete period, if you have chosen "both" or
+ "incomplete" of "transaction type" item on "search view".</para>
+ </listitem>
+
+ <listitem>
+ <para>Running Time</para>
+
+ <para>Duration in milliseconds each method has elapsed from start to
+ finish. “UNKNOWN” will be shown for an incomplete method, if you
+ have chosen "both" or "incomplete" of "transaction type" item on
+ "search view".</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Running Time</para>
+
+ <para>Duration in milliseconds of each method’s total time minus all
+ its calling methods’ total time. “UNKNOWN” will be shown for an
+ incomplete method or for a method which calls an incomplete method,
+ if you have chosen "both" or "incomplete" of "transaction type" item
+ on "search view".</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Click “methods tree” of head, the methods tree page shows.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-methods tree.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The upper is the head which links to other pages.</para>
+
+ <para>In the lower part, the left side is a tree explorer. “+” means the
+ node has child or children, you can expand the child nodes by clicking
+ on it. Note that the “+” changes to “-” after you clicked on it, and a
+ list of its child or children shows below the node immediately.</para>
+
+ <para>The lower right part lists the information of current clicked
+ method and all its called methods. This information here is also the
+ same with methods list page.</para>
+
+ <para>Click any underlined method name in the methods list, the detailed
+ methods information will also demonstrate just as the click of methods
+ list.</para>
+
+ <para>The column break between the tree explorer and methods list is
+ movable from right to left and vice versa.</para>
+
+ <para></para>
+
+ <para>Click "detail" of head, the detailed method summary table
+ shows.And the head is changed too.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-DetailMethodSummary.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The fields in detailed methods page list as:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>No</para>
+
+ <para>The sequence NO of summarized detailed method.</para>
+ </listitem>
+ </itemizedlist>
+
+ <itemizedlist>
+ <listitem>
+ <para>Method Name</para>
+
+ <para>Name of summarized method, which appears only once in the
+ table.</para>
+ </listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of methods with the same method
+ name.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of duration of methods with the same method name by
+ millisecond.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" for the
+ summarized methods which include an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of method running time (milliseconds) of all methods with
+ the same method name.</para>
+
+ <para>The method running time for each method means: Duration in
+ milliseconds of each method’s total time minus all its calling
+ methods’ total time. “UNKNOWN” will be shown for an incomplete
+ method or for a method which calls an incomplete method, if you have
+ chosen "both" or "incomplete" of "transaction type" item on "search
+ view".</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view" , “UNKNOWN” will be shown if any
+ incomplete method shared the same method name.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time, calculated as Total Running Time /
+ Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of all methods with the same method name
+ in nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time, calculated as Total CPU Time / Executed
+ Count</para>
+ </listitem>
+ </itemizedlist>
+
+ <para></para>
+
+ <para>Click “class detail” of the head, the detailed class summary view
+ shows.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-class%20summary.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>This lower package information table has the following
+ fields:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Class Name</para>
+
+ <para>Name of summarized classes, which appears only once in the
+ table.</para>
+ </listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of all classes with the same class name.
+ The running times for each class calculates as the sum of running
+ times of all methods which belong to it.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of duration of the class by millisecond. Duration here is
+ the result of class exited time minus class entered time. If a class
+ called itself, the total time of the class been called is not added
+ to the caller class’s total time. “UNKNOWN” will be shown for an
+ incomplete class.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of Method Running Time (milliseconds) of all classes with
+ the same class name.</para>
+
+ <para>The Method Running Time for each class is the sum of total
+ time of all methods which belongs to this class.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any class
+ with this class name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time for class, calculated as Total Running
+ Time / Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of classes with the same class name in
+ nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time for class , calculated as Total CPU Time /
+ Executed Count.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para></para>
+
+ <para>Click “package detail” of head, you will get the summarized
+ detailed package page:</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-DetailPackageSummary.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>Package information in the table has the following fields:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Package Name</para>
+
+ <para>Name of summarized package, which appears only once in the
+ table.If there's no package name for some methods, the package name
+ is set to be "default".</para>
+ </listitem>
+
+ <listitem>
+ <para>Executed Count</para>
+
+ <para>Sum of running times of all packages with the same package
+ name.</para>
+
+ <para>The running times for each package are the sum of running
+ times of all methods which belong to it.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Time</para>
+
+ <para>Sum of total time (milliseconds) of all packages which share
+ the same package name.</para>
+
+ <para>The Total Time for each package is the sum of total time of
+ all methods which belongs to this package.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any
+ package with this package name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total Running Time</para>
+
+ <para>Sum of Method Running Time (milliseconds) of all packages
+ which share the same package name.</para>
+
+ <para>The Method Running Time for each package is the sum of total
+ time of all methods which belongs to this package.</para>
+
+ <para>If you have chosen "both" or "incomplete" of "transaction
+ type" item on "search view", this field says "UNKNOWN" if any
+ package with this package name includes an incomplete method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg Running Time</para>
+
+ <para>Average running time for package, calculated as Total Running
+ Time / Executed Count.</para>
+ </listitem>
+
+ <listitem>
+ <para>Total CPU Time</para>
+
+ <para>Sum of CPU usage time of packages with the same package name
+ in nanosecond. Similar to Total Time, the callee’s CPU time is
+ included.</para>
+ </listitem>
+
+ <listitem>
+ <para>Avg CPU Time</para>
+
+ <para>Average CPU time for package, calculated as Total CPU Time /
+ Executed Count.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para></para>
+
+ <para>Click the "group list" or "group detail method" or "calling tree
+ applet" or "sequence diagram applet"of the head, if no group is defined,
+ we have to define the group at first. Click the "add" button, a group
+ definition dialogue is poped out,input the group information.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-GroupDefinitionInput.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>In the group information dialogue, some information should be
+ input or chosen.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Group Name</para>
+
+ <para>The name of group.</para>
+ </listitem>
+ </itemizedlist>
+
+ <itemizedlist>
+ <listitem>
+ <para>Priority</para>
+
+ <para>The priority is an integer number between 10 and 100. The
+ higher number means the higher priority. When a method name meets
+ both conditions of two different groups, it will be grouped into the
+ one with higher priority. If the priorities are equal, it will be
+ grouped into the one defined earlier or earliest.</para>
+ </listitem>
+
+ <listitem>
+ <para>Search Area</para>
+
+ <para>The domain in which to match the pattern string, the value of
+ which can be ""full","package","class" or "method". The pattern
+ string is a string used to match the method's name. As the method's
+ name can be devided into different domains as package domain, class
+ domain, method domain and full domain, you are required to specify
+ which domain to match the pattern string.</para>
+ </listitem>
+
+ <listitem>
+ <para>Rule: include</para>
+
+ <para>Include those methods which match the pattern string of the
+ package domain, class domain, method domain or full domain.</para>
+ </listitem>
+
+ <listitem>
+ <para>Rule: exclude</para>
+
+ <para>Exclude those methods which match the pattern string of the
+ package domain, class domain, method domain or full domain.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The input string of include and exclude should conform to some
+ rules. The meaning of them are as follows.</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>' '</para>
+
+ <para>The symbol to compose the search unit. One or more search
+ units build up one search condition.</para>
+ </listitem>
+ </itemizedlist>
+
+ <itemizedlist>
+ <listitem>
+ <para>*</para>
+
+ <para>If the * appears in the ‘ ’, it represents any Java
+ identifier. For example, ‘*abc*’ means including abc, ‘abc*’ means
+ starting with abc and ‘*abc’ means ending with abc. If * appears
+ between ‘ ‘, it represents AND relationship. For example ‘*abc’ *
+ ‘def*’ means ending with abc AND starting with def.</para>
+ </listitem>
+
+ <listitem>
+ <para>+</para>
+
+ <para>It only appears between ‘ ‘ and represents OR relationship.
+ For example: ‘*abc’ + ‘def*’ means ending with abc OR starting with
+ def.</para>
+ </listitem>
+
+ <listitem>
+ <para>^ ^</para>
+
+ <para>It only appears in the ‘ ‘ and should appear in a pair. It
+ means excluding the string between them. For example ‘^abc^’ means
+ excluding abc.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Click “OK” button in the group information input dialog to save
+ the definition. Then click “Done” button to close the group information
+ dialog.</para>
+
+ <para></para>
+
+ <para>The group definition can be added, deleted by click the
+ "add","edit","delete" button.</para>
+
+ <para>Click the "export" button, the group definition is exported to an
+ XML file named tracing.xml.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo>u</screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot_GroupExport.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>Click “browse”button to choose the predefined group definition
+ file, for example the exported XML file tracing.xml.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot_GroupImport.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The group definition file should be defined in XML format as
+ following.</para>
+
+ <para><?xml version="1.0"?> </para>
+
+ <para><group> </para>
+
+ <para><groupinfo> </para>
+
+ <para><groupname>Group1</groupname> </para>
+
+ <para><priority>10</priority> </para>
+
+ <para><includefullcondition>’java.lang.*’</includefullcondition>
+ </para>
+
+ <para><includepackagecondition></includepackagecondition>
+ </para>
+
+ <para><includeclasscondition></includeclasscondition></para>
+
+ <para><includemethodcondition></includemethodcondition>
+ </para>
+
+ <para><excludefullcondition></excludefullcondition> </para>
+
+ <para><excludepackagecondition></excludepackagecondition>
+ </para>
+
+ <para><excludeclasscondition></excludeclasscondition>
+ </para>
+
+ <para><excludemethodcondition></excludemethodcondition>
+ </para>
+
+ <para></groupinfo> </para>
+
+ <para></group></para>
+
+ <para>Click the "display" button, the group definition shows in the web
+ interface.</para>
+
+ <para>Click the "submit" button, the groups information displays.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-GroupList.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The fields in group list are:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Sequence No.&Caller</para>
+
+ <para>The caller name with the prefix of sequence number. If a
+ caller method has been classified into a group, the group name will
+ be shown in this column. If a caller method doesn't belong to any
+ group, the method's full name will be shown in the caller
+ column.</para>
+ </listitem>
+
+ <listitem>
+ <para>Callee</para>
+
+ <para>If a callee method has been classified into a group, the group
+ name will be shown as the callee. Otherwise, the method's full name
+ will be shown in this column.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>At the bottom of this page, click the blue link "select new
+ group","edit group", "export", we can define new group, edit group,
+ export the group information into XML file.</para>
+
+ <para>Click "group detail method" of the head, the grouped detail method
+ flow shows.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-GroupDetailMethod.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The fields in detailed methods page list as:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Relative Running Time</para>
+
+ <para>Duration in milliseconds from the Start Time of the first
+ method to Start Time of current method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Depth</para>
+
+ <para>The called depth in the transaction.</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Name</para>
+
+ <para>Name of Method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Order</para>
+
+ <para>The sequence no of selected transaction.</para>
+ </listitem>
+
+ <listitem>
+ <para>Detailed Start Time</para>
+
+ <para>Start time of each running period of the method. Here if one
+ method doesn’t call any other method, the detailed start time is the
+ same with the Start Time of method. If one method calls other
+ methods, the runtime of each method is divided into several periods.
+ The Detailed Start Time is the start time of one period.</para>
+ </listitem>
+
+ <listitem>
+ <para>Detailed End Time</para>
+
+ <para>Finish time of each running period of the method. Here if one
+ method doesn’t call any other method, the detailed end time is the
+ same with the End Time of method. If one method calls other methods,
+ the runtime of each method is separated into several periods. The
+ Detailed End Time is the end time of one period. “NOT EXIT” will be
+ shown for an incomplete period, if you have chosen "both" or
+ "incomplete" of "transaction type" item on "search view".</para>
+ </listitem>
+
+ <listitem>
+ <para>Running Time</para>
+
+ <para>Duration in milliseconds each method has elapsed from start to
+ finish. “UNKNOWN” will be shown for an incomplete method, if you
+ have chosen "both" or "incomplete" of "transaction type" item on
+ "search view".</para>
+ </listitem>
+
+ <listitem>
+ <para>Method Running Time</para>
+
+ <para>Duration in milliseconds of each method’s total time minus all
+ its calling methods’ total time. “UNKNOWN” will be shown for an
+ incomplete method or for a method which calls an incomplete method,
+ if you have chosen "both" or "incomplete" of "transaction type" item
+ on "search view".</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Click “calling tree applet” of head, the package applet shows the
+ package caller-callee relationship in form of calling tree.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-CallingTreeApplet.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The package applet includes the following elements:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Box</para>
+
+ <para>Colored box with package name or method name.</para>
+ </listitem>
+
+ <listitem>
+ <para>Calling line</para>
+
+ <para>The solid line navigates from caller to callee.</para>
+ </listitem>
+
+ <listitem>
+ <para>Returning line</para>
+
+ <para>The dotted line navigates from callee to caller, just means
+ method return.</para>
+ </listitem>
+
+ <listitem>
+ <para>Time info</para>
+
+ <para>Navigator line(calling line or returning line) navigates from
+ the start method to the end method.</para>
+
+ <para>This shows the start time of the start method, and elapsed
+ time between these two methods(start time of end method minus end
+ time of start method). It's in format of "start time(elapsed
+ time)".</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Click "sequence diagram applet", the package applet shows the
+ package calling-callee relationship like sequence diagram.</para>
+
+ <figure>
+ <title></title>
+
+ <screenshot>
+ <screeninfo></screeninfo>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center"
+ fileref="images/Screenshot-SequenceDiagramApplet.png" />
+ </imageobject>
+ </mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>The package applet includes the following elements:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Box</para>
+
+ <para>Colored box with package name or method name, which appears
+ only once.</para>
+ </listitem>
+
+ <listitem>
+ <para>Life line bar</para>
+
+ <para>The life line of a group or method.</para>
+ </listitem>
+
+ <listitem>
+ <para>Calling line</para>
+
+ <para>The solid line navigates from caller to callee.</para>
+ </listitem>
+
+ <listitem>
+ <para>Returning line</para>
+
+ <para>The dotted line navigates from callee to caller, just means
+ method return.</para>
+ </listitem>
+
+ <listitem>
+ <para>Time info</para>
+
+ <para>Navigator line(calling line or returning line) navigates from
+ the start method to the end method.</para>
+
+ <para>This shows the start time of the start method, and elapsed
+ time between these two methods(start time of end method minus end
+ time of start method). It's in format of "start time(elapsed
+ time)".</para>
+ </listitem>
+ </itemizedlist>
</sect2>
</sect1>
@@ -610,4 +1809,4 @@
<para></para>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Added: trunk/java/libs/appletsLibs/plugin.jar
===================================================================
(Binary files differ)
Property changes on: trunk/java/libs/appletsLibs/plugin.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphApplet.java
===================================================================
--- trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphApplet.java (rev 0)
+++ trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphApplet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,309 @@
+package org.jboss.profiler.graphapplet;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.GroupGraphReference;
+import org.jgraph.JGraph;
+import org.jgraph.graph.ConnectionSet;
+import org.jgraph.graph.DefaultEdge;
+import org.jgraph.graph.DefaultGraphCell;
+import org.jgraph.graph.DefaultGraphModel;
+import org.jgraph.graph.DefaultPort;
+import org.jgraph.graph.GraphConstants;
+import org.jgraph.graph.ParentMap;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class GroupGraphApplet extends JApplet {
+ boolean isStandalone = false;
+
+ DefaultGraphModel graphModel = new DefaultGraphModel();
+
+ JGraph jgraph = new JGraph(graphModel);
+
+ JScrollPane jScrollPane1 = new JScrollPane(jgraph);
+
+ java.text.NumberFormat numberFormat = java.text.NumberFormat.getInstance();
+
+ private void openModel() {
+ try {
+ // Intersections model
+ ConnectionSet intersectionSet = new ConnectionSet();
+
+ // Attributes
+ java.util.HashMap attributes = new java.util.HashMap();
+
+ java.net.URL url = new java.net.URL(this.getCodeBase().toString()
+ + getParameter("url"));
+ java.io.InputStream inp = url.openStream();
+ java.io.ObjectInputStream obj = new java.io.ObjectInputStream(inp);
+ GroupGraphCallings callings = (GroupGraphCallings) obj.readObject();
+
+ String strgroupType = this.retrieveGroupType(this
+ .getParameter("url"));
+
+ //to cancel the redirect when there is only default package
+ /*if (null != strgroupType && strgroupType.equals("package")) {
+ if (this.isPackageAllDefault(callings.getGroups())) {
+ this.redirectPage();
+ return;
+ }
+ }*/
+
+ DefaultGraphCell elements[] = new DefaultGraphCell[callings
+ .getGroups().size()
+ + callings.getReferences().size()];
+
+ int currentLevel = 0;
+ int currentCell = 0;
+ int currentElement = 0;
+
+ Iterator iter = callings.getGroups().iterator();
+ HashMap hashGroups = new HashMap();
+
+ int tmpLevel = 0;
+ while (iter.hasNext()) {
+ GroupGraphGroup graphgroup = (GroupGraphGroup) iter.next();
+
+ if (graphgroup.getLevel() != currentLevel) {
+ currentLevel = graphgroup.getLevel();
+ currentCell = 0;
+ } else {
+ currentCell++;
+ }
+
+ DefaultGraphCell graphcell = new DefaultGraphCell(graphgroup);
+ graphcell.add(new DefaultPort("port/Center"));
+ graphcell.add(new DefaultPort("port/Left"));
+ Color color = null;
+ switch (currentCell) {
+ case 0:
+ color = Color.red;
+ tmpLevel++;
+ break;
+ case 1:
+ color = Color.yellow;
+ break;
+ default:
+ color = Color.blue;
+ break;
+ }
+ attributes.put(graphcell, createBounds(tmpLevel, currentCell,
+ color));
+ elements[currentElement++] = graphcell;
+ hashGroups.put(graphgroup, graphcell);
+ }// end of hashGroups iteration. This means to add the groups
+ // infor into the applet
+
+ Map simpleArrow = GraphConstants.createMap();
+ GraphConstants
+ .setLineEnd(simpleArrow, GraphConstants.ARROW_CLASSIC);
+ GraphConstants.setBeginSize(simpleArrow, 10);
+ GraphConstants.setDashPattern(simpleArrow, new float[] { 3, 3 });
+ GraphConstants.setFont(simpleArrow, GraphConstants.defaultFont
+ .deriveFont(10));
+
+ GroupGraphGroup key = new GroupGraphGroup();
+ iter = callings.getReferences().iterator();
+
+ String msg = "msg";
+ while (iter.hasNext()) {
+ GroupGraphReference referenceCalling = (GroupGraphReference) iter
+ .next();
+ DefaultGraphCell cellcallee = null;
+ DefaultGraphCell cellcalled = null;
+ Iterator iter2 = hashGroups.keySet().iterator();
+ while (iter2.hasNext()) {
+ GroupGraphGroup group = (GroupGraphGroup) iter2.next();
+ if (group.getGroupID() == referenceCalling.getGroupCallee())
+ cellcallee = (DefaultGraphCell) hashGroups.get(group);
+ if (group.getGroupID() == referenceCalling.getGroupCalled())
+ cellcalled = (DefaultGraphCell) hashGroups.get(group);
+ if (cellcallee != null && cellcalled != null)
+ break;
+ }
+
+ if (cellcallee != null && cellcalled != null) {
+
+ DefaultEdge relationship = new DefaultEdge();
+
+ elements[currentElement++] = relationship;
+
+ intersectionSet.connect(relationship, cellcallee
+ .getChildAt(0), cellcalled.getChildAt(0));
+ attributes.put(relationship, simpleArrow);
+ }// end of if
+ }// end of reference iteration
+
+ graphModel.insert(elements, attributes, intersectionSet,
+ new ParentMap(), new javax.swing.undo.UndoableEdit[0]);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(this, e.getMessage());
+ }
+
+ }
+
+ /**
+ * Returns an attributeMap for the specified position (line,column) and
+ * color.
+ */
+ public static Map createBounds(int line, int column, Color c) {
+ Map map = GraphConstants.createMap();
+ GraphConstants.setBounds(map, new Rectangle(column * 230 + 10,
+ line * 60 + 10, 190, 30));
+ System.out.println("line current level" + line + "column current cell"
+ + column + " x and y are: " + (column * 230 + 10) + ","
+ + (line * 60) + 10);
+ GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
+ GraphConstants.setBackground(map, c.darker());
+ GraphConstants.setForeground(map, Color.white);
+ GraphConstants.setFont(map, GraphConstants.defaultFont.deriveFont(
+ Font.BOLD, 12));
+ GraphConstants.setOpaque(map, true);
+ return map;
+ }
+
+ // Get a parameter value
+ public String getParameter(String key, String def) {
+ return isStandalone ? System.getProperty(key, def)
+ : (getParameter(key) != null ? getParameter(key) : def);
+ }
+
+ // Construct the applet
+ public GroupGraphApplet() {
+ }
+
+ // Initialize the applet
+ public void init() {
+ try {
+ openModel();
+ jbInit();
+ jgraph.setEditable(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // Component initialization
+ private void jbInit() throws Exception {
+ this.setSize(new Dimension(400, 300));
+ jgraph.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ jgraph_mouseClicked(e);
+ }
+ });
+
+ this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
+ }
+
+ // Start the applet
+ public void start() {
+ }
+
+ // Stop the applet
+ public void stop() {
+ }
+
+ // Destroy the applet
+ public void destroy() {
+ }
+
+ // Get Applet information
+ public String getAppletInfo() {
+ return "Applet Information";
+ }
+
+ // Get parameter info
+ public String[][] getParameterInfo() {
+ return null;
+ }
+
+ // static initializer for setting look & feel
+ static {
+ try {
+ // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+ } catch (Exception e) {
+ }
+ }
+
+ void jgraph_mouseMoved(MouseEvent ev) {
+ try {
+ Object obj = jgraph.getFirstCellForLocation(ev.getX(), ev.getY());
+ if (obj != null && obj instanceof DefaultGraphCell) {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ GroupGraphGroup graphGroup = (GroupGraphGroup) graphCell
+ .getUserObject();
+ JOptionPane.showMessageDialog(this, graphGroup.getGroupName());
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+
+ void jgraph_mouseClicked(MouseEvent ev) {
+ try {
+ // for debug
+ // JOptionPane.showMessageDialog(this, "here1");
+
+ if (ev.getClickCount() == 2) {
+ // for debug
+ // JOptionPane.showMessageDialog(this, "here2");
+
+ Object obj = jgraph.getFirstCellForLocation(ev.getX(), ev
+ .getY());
+ if (obj != null && obj instanceof DefaultGraphCell) {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ GroupGraphGroup graphGroup = (GroupGraphGroup) graphCell
+ .getUserObject();
+ JOptionPane.showMessageDialog(this, graphGroup
+ .getGroupName());
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+
+ private String retrieveGroupType(String vstrUrl) {
+ if (null == vstrUrl) {
+ return null;
+ }
+ String strModel = "&group=";
+ int index = vstrUrl.indexOf(strModel);
+ if(index < 0)
+ {
+ return null;
+ }
+ String strSubUrl = vstrUrl.substring(index+strModel.length(), vstrUrl.length());
+ int inttmp = strSubUrl.indexOf("&");
+ if(inttmp < 0)
+ {
+ return strSubUrl;
+ }
+ String strgroupType = strSubUrl.substring(0, inttmp);
+ return strgroupType;
+
+ }
+
+}
Added: trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphAppletTest.java
===================================================================
--- trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphAppletTest.java (rev 0)
+++ trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/GroupGraphAppletTest.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,325 @@
+/*
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.profiler.graphapplet;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+
+import javax.swing.JTextArea;
+
+import org.jgraph.JGraph;
+import org.jgraph.graph.ConnectionSet;
+import org.jgraph.graph.DefaultEdge;
+import org.jgraph.graph.DefaultGraphCell;
+import org.jgraph.graph.DefaultGraphModel;
+import org.jgraph.graph.DefaultPort;
+import org.jgraph.graph.GraphConstants;
+import org.jgraph.graph.ParentMap;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.GroupGraphReference;
+
+/**
+ * Applet that uses JGraph to present the Graph view of our current model
+ * @author Clebert Suconic
+ */
+public class GroupGraphAppletTest extends JApplet {
+ boolean isStandalone = false;
+ DefaultGraphModel graphModel = new DefaultGraphModel();
+ JGraph jgraph = new JGraph(graphModel);
+ //JGraph jgraph = new JGraph();
+ JScrollPane jScrollPane1 = new JScrollPane(jgraph);
+ //JTextArea textarea;
+
+ java.text.NumberFormat numberFormat = java.text.NumberFormat.getInstance();
+
+ private void openModel() {
+ try {
+ // Intersections model
+ ConnectionSet intersectionSet = new ConnectionSet();
+
+ // Attributes
+ java.util.HashMap attributes = new java.util.HashMap();
+
+ java.net.URL url =
+ new java.net.URL(
+ this.getCodeBase().toString() + getParameter("url"));
+ java.io.InputStream inp = url.openStream();
+ java.io.ObjectInputStream obj = new java.io.ObjectInputStream(inp);
+ GroupGraphCallings callings = (GroupGraphCallings) obj.readObject();
+ callings.printDebug();
+
+ DefaultGraphCell elements[] =
+ new DefaultGraphCell[callings.getGroups().size()
+ + callings.getReferences().size()];
+
+ int currentLevel = -1;
+ int currentCell = -1;
+ int currentElement = 0;
+
+ Iterator iter = callings.getGroups().iterator();
+
+ HashMap hashGroups = new HashMap();
+
+ while (iter.hasNext()) {
+ GroupGraphGroup graphgroup = (GroupGraphGroup) iter.next();
+
+ if (graphgroup.getLevel() != currentLevel) {
+ currentLevel = graphgroup.getLevel();
+ currentCell = 0;
+ } else {
+ currentCell++;
+ }
+
+ DefaultGraphCell graphcell = new DefaultGraphCell(graphgroup);
+
+ //graphcell.add(new DefaultPort("port/Center"));
+ //graphcell.add(new DefaultPort("port/Left"));
+ Color color = null;
+ switch (currentCell) {
+ case 0 :
+ color = Color.red;
+ break;
+ case 1 :
+ color = Color.yellow;
+ break;
+ default :
+ color = Color.blue;
+ break;
+ }
+ attributes.put(
+ graphcell,
+ createBounds(currentLevel, currentCell, color));
+
+ elements[currentElement++] = graphcell;
+
+ hashGroups.put(graphgroup, graphcell);
+ }//end of hashGroups iteration. This means to add the groups infor into the applet
+
+ Map simpleArrow = GraphConstants.createMap();
+ GraphConstants.setLineEnd(
+ simpleArrow,
+ GraphConstants.ARROW_CLASSIC);
+ GraphConstants.setBeginSize(simpleArrow, 10);
+ GraphConstants.setDashPattern(simpleArrow, new float[] { 3, 3 });
+ GraphConstants.setFont(
+ simpleArrow,
+ GraphConstants.defaultFont.deriveFont(10));
+
+ GroupGraphGroup key = new GroupGraphGroup();
+ iter = callings.getReferences().iterator();
+
+ String msg = "msg";
+
+
+ while (iter.hasNext()) {
+ GroupGraphReference referenceCalling = (GroupGraphReference) iter.next();
+ DefaultGraphCell cellcallee = null;
+ DefaultGraphCell cellcalled = null;
+
+ GroupGraphGroup calledGroup=null;
+
+ Iterator iter2 = hashGroups.keySet().iterator();
+
+ while (iter2.hasNext()) {
+ GroupGraphGroup group = (GroupGraphGroup) iter2.next();
+ if (group.getGroupID()==referenceCalling.getGroupCallee())
+ cellcallee = (DefaultGraphCell) hashGroups.get(group);
+ if (group.getGroupID()==referenceCalling.getGroupCalled()){
+ cellcalled = (DefaultGraphCell) hashGroups.get(group);
+ calledGroup= group;
+ }
+ if (cellcallee!=null && cellcalled!=null)
+ break;
+ }
+
+ //key.setGroupID(referenceCalling.getGroupCallee());
+ //DefaultGraphCell cellcallee =
+ // (DefaultGraphCell) hashGroups.get(key);
+
+ //for debug
+ if (cellcallee!=null) msg += "cellcallee exists. ";
+ else msg += "no cellcallee! ";
+
+ //key.setGroupID(referenceCalling.getGroupCalled());
+ //DefaultGraphCell cellcalled =
+ // (DefaultGraphCell) hashGroups.get(key);
+
+ if (cellcalled!=null) msg += "cellcallee exists.\n";
+ else msg += "no callcallee!\n";
+
+ if (cellcallee!=null && cellcalled!=null) {
+
+ DefaultEdge relationship = new DefaultEdge();
+ /*DefaultEdge relationship =
+ new DefaultEdge(
+ numberFormat.format(
+ (double)calledGroup.getTotalTime()/totalTime)
+ + "%");*/
+
+ elements[currentElement++] = relationship;
+
+ intersectionSet.connect(
+ relationship,
+ cellcallee.getChildAt(0),
+ cellcalled.getChildAt(0));
+ attributes.put(relationship, simpleArrow);
+ }//end of if
+ }//end of reference iteration
+
+
+ //textarea = new JTextArea(msg);
+
+ graphModel.insert(
+ elements,
+ attributes,
+ intersectionSet,
+ new ParentMap(),
+ new javax.swing.undo.UndoableEdit[0]);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(this, e.getMessage());
+ }
+
+ }
+
+ /**
+ * Returns an attributeMap for the specified position (line,column) and color.
+ */
+ public static Map createBounds(int line, int column, Color c) {
+ Map map = GraphConstants.createMap();
+ GraphConstants.setBounds(
+ map,
+ new Rectangle(column * 130 + 10, (line-1) * 60 + 10, 90, 30));
+ GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
+ GraphConstants.setBackground(map, c.darker());
+ GraphConstants.setForeground(map, Color.white);
+ GraphConstants.setFont(
+ map,
+ GraphConstants.defaultFont.deriveFont(Font.BOLD, 12));
+ GraphConstants.setOpaque(map, true);
+ return map;
+ }
+
+ //Get a parameter value
+ public String getParameter(String key, String def) {
+ return isStandalone
+ ? System.getProperty(key, def)
+ : (getParameter(key) != null ? getParameter(key) : def);
+ }
+ //Initialize the applet
+ public void init() {
+ try {
+ openModel();
+ jbInit();
+ jgraph.setEditable(false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ //Component initialization
+ private void jbInit() throws Exception {
+ this.setSize(new Dimension(400, 300));
+ //jgraph.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
+ //public void mouseMoved(MouseEvent e) {
+ // jgraph_mouseMoved(e);
+ //}
+
+ jgraph.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ jgraph_mouseClicked(e);
+ }
+ });
+ this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
+
+ //this.getContentPane().add(textarea, BorderLayout.CENTER);
+ }
+ //Start the applet
+ public void start() {
+ }
+ //Stop the applet
+ public void stop() {
+ }
+ //Destroy the applet
+ public void destroy() {
+ }
+ //Get Applet information
+ public String getAppletInfo() {
+ return "Applet Information";
+ }
+ //Get parameter info
+ public String[][] getParameterInfo() {
+ return null;
+ }
+
+ //static initializer for setting look & feel
+ static {
+ try {
+ //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+ } catch (Exception e) {
+ }
+ }
+
+ void jgraph_mouseMoved(MouseEvent ev) {
+ try
+ {
+ Object obj = jgraph.getFirstCellForLocation(ev.getX(), ev.getY());
+ if (obj != null && obj instanceof DefaultGraphCell)
+ {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ GroupGraphGroup graphGroup = (GroupGraphGroup) graphCell.getUserObject();
+ // JOptionPane.showMessageDialog(this, graphGroup.getGroupName());
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+
+ void jgraph_mouseClicked(MouseEvent ev)
+ {
+ try
+ {
+ //for debug
+ //JOptionPane.showMessageDialog(this, "here1");
+
+ if (ev.getClickCount()==2)
+ {
+ //for debug
+ //JOptionPane.showMessageDialog(this, "here2");
+
+ Object obj = jgraph.getFirstCellForLocation(ev.getX(), ev.getY());
+ if (obj != null && obj instanceof DefaultGraphCell)
+ {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ GroupGraphGroup graphGroup = (GroupGraphGroup) graphCell.getUserObject();
+ JOptionPane.showMessageDialog(this, graphGroup.getGroupName());
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+}
Added: trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet.java
===================================================================
--- trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet.java (rev 0)
+++ trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,256 @@
+/**
+ *@author Huijuan Shao
+ */
+package org.jboss.profiler.graphapplet;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+
+import netscape.javascript.JSObject;
+
+import org.jboss.profiler.tracerModel.UserGraphCell;
+import org.jgraph.JGraph;
+import org.jgraph.graph.ConnectionSet;
+import org.jgraph.graph.DefaultEdge;
+import org.jgraph.graph.DefaultGraphCell;
+import org.jgraph.graph.DefaultGraphModel;
+import org.jgraph.graph.DefaultPort;
+import org.jgraph.graph.GraphConstants;
+
+
+public class UserGroupApplet extends JApplet{
+ private final int UP_BOUND = 10000;
+ private int cnt = 0;
+
+
+ //private JTabbedPane jtabPane = null;
+ private JScrollPane jscPane = null;
+ public UserGroupApplet(){
+
+ }
+
+ private DefaultGraphCell newCell(HashMap vattrMap,UserGraphCell vcell, int viposy){
+ DefaultGraphCell graphcell = new DefaultGraphCell(vcell);
+ graphcell.add(new DefaultPort("port/Center"));
+ graphcell.add(new DefaultPort("port/Left"));
+ Map map = GraphConstants.createMap();
+ GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
+ GraphConstants.setBounds(map,new Rectangle((vcell.idepth-1)*150+2,viposy*30,150,18));
+ GraphConstants.setBackground(map, Color.RED.darker());
+ GraphConstants.setForeground(map, Color.white);
+ GraphConstants.setFont(map,GraphConstants.defaultFont.deriveFont(Font.BOLD, 12));
+ vattrMap.put(graphcell,map);
+ GraphConstants.setOpaque(map, true);
+ return graphcell;
+ }
+
+ private DefaultEdge newEdge(HashMap vattrMap, ConnectionSet vedteSet,
+ DefaultGraphCell vcalleer, DefaultGraphCell vcallee, boolean vdash){
+
+ Map simpleArrowMap = GraphConstants.createMap();
+ GraphConstants.setLineEnd(
+ simpleArrowMap,
+ GraphConstants.ARROW_CLASSIC);
+
+ GraphConstants.setBeginSize(simpleArrowMap,10);
+ GraphConstants.setLabelPosition(simpleArrowMap,new Point(GraphConstants.PERCENT,500));
+ GraphConstants.setFont(simpleArrowMap,GraphConstants.defaultFont.deriveFont(Font.PLAIN, 10));
+ //GraphConstants.setDashPattern(simpleArrowMap, new float[] { 30, 3 });
+ //GraphConstants.setFont(simpleArrowMap,GraphConstants.defaultFont.deriveFont(10));
+ if(vdash){
+ GraphConstants.setDashPattern(simpleArrowMap, new float[] { 10, 8 });
+ }
+
+ //GraphConstants.setFont(simpleArrowMap,GraphConstants.defaultFont.deriveFont(10));
+ SimpleDateFormat f= new SimpleDateFormat("yyMMdd hh:mm:ss:S");
+ UserGraphCell callercell = (UserGraphCell)vcalleer.getUserObject();
+ String date = f.format(new Date(callercell.istarttime));
+ DefaultEdge relationEdge = new DefaultEdge(date+"("+(callercell.iendtime - callercell.istarttime)+")");
+
+ vedteSet.connect(relationEdge,vcalleer.getChildAt(0),vcallee.getChildAt(1));
+ vattrMap.put(relationEdge, simpleArrowMap);
+ return relationEdge;
+ }
+
+ public ArrayList getuserGroupList(){
+
+ ArrayList groupList = null;
+ try {
+ java.net.URL url;
+ url = new java.net.URL(this.getCodeBase().toString()+ getParameter("url"));
+ java.io.InputStream inp = url.openStream();
+ java.io.ObjectInputStream obj = new java.io.ObjectInputStream(inp);
+ groupList = (ArrayList) obj.readObject();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ return groupList;
+ }
+
+ public void processCallingRelations(ArrayList vdetailmethdsList){
+
+ int ioutlen = 0;
+ if(null != vdetailmethdsList){
+ ioutlen = vdetailmethdsList.size();
+ }
+ if(ioutlen == 0){
+ JOptionPane.showMessageDialog(this,"There's no group selected, please select groupfirst");
+ return;
+ }
+ if(ioutlen > UP_BOUND){
+ int selectnum = JOptionPane.showConfirmDialog(this,"There're too many cells in the graph, applet may run out of memory, continue?");
+ if(selectnum == JOptionPane.NO_OPTION || selectnum == JOptionPane.CANCEL_OPTION){
+ this.redirectPage();
+ return;
+ }
+ }
+ this.addcallingGraph(vdetailmethdsList);
+ }
+
+ private void addcallingGraph(ArrayList vgroupedmethodList){
+
+ DefaultGraphModel graphModel = new DefaultGraphModel();
+ JGraph jgraph = new JGraph(graphModel);
+ this.jscPane = new UserJscrollPane(jgraph);
+ this.getContentPane().add(this.jscPane);
+ int iLen = 0;
+ if(null != vgroupedmethodList){
+ iLen = vgroupedmethodList.size();
+ if(iLen < 1){
+ return;
+ }
+ }
+
+ HashMap attributesMap = new HashMap();
+ ConnectionSet edgeSet = new ConnectionSet();
+ DefaultGraphCell previousCell = null;
+ DefaultGraphCell[] graphElements = null;
+ int elemindex = 0;
+ boolean isreturn = false;
+ if(iLen >= 1){
+ graphElements = new DefaultGraphCell[iLen*2-1];
+ }
+ for(int i = 0; i < iLen; i++){
+ UserGraphCell curusrCell = (UserGraphCell)vgroupedmethodList.get(i);
+ DefaultGraphCell curcell = this.newCell(attributesMap,curusrCell,i);
+ if(previousCell != null){
+ if(((UserGraphCell)previousCell.getUserObject()).idepth > curusrCell.idepth){
+ isreturn = true;
+ }
+ else{
+ isreturn = false;
+ }
+ }
+ graphElements[elemindex++] = curcell;
+ DefaultEdge curedge = null;
+ if(null != previousCell){
+ curedge = this.newEdge(attributesMap, edgeSet, previousCell,curcell,isreturn);
+ graphElements[elemindex++] = curedge;
+ }
+ previousCell = curcell;
+ }
+ graphModel.insert(graphElements,attributesMap,edgeSet,null,null);
+ //this.setAllEdgeLabels(attributesMap);
+ graphModel.edit(attributesMap,edgeSet,null,null);
+ }
+
+ private void setAllEdgeLabels(HashMap vattrMap){
+
+ Iterator edgeitr = vattrMap.keySet().iterator();
+ while(edgeitr.hasNext()){
+ DefaultGraphCell cell = (DefaultGraphCell)edgeitr.next();
+ if(!(cell instanceof DefaultEdge)){
+ continue;
+ }
+ DefaultEdge edge = (DefaultEdge)cell;
+ GraphConstants.setLabelPosition(edge.getAttributes(),new Point(GraphConstants.PERCENT,500));
+ //edge.setUserObject(srcoffset.getY()+":"+dstoffset.getY());
+ }
+ }
+
+
+ public void init() {
+ //this.jtabPane = new JTabbedPane();
+ //jscPane = new JScrollPane();
+ //this.getContentPane().add(this.jscPane);
+ }
+ //Start the applet
+ public void start() {
+ this.processCallingRelations(this.getuserGroupList());
+ }
+ //Stop the applet
+ public void stop() {
+ this.jscPane = null;
+ }
+ //Destroy the applet
+ public void destroy() {
+ //this.getContentPane().remove(this.jtabPane);
+ //this.jtabPane = null;
+ }
+
+ private void redirectPage() {
+ try { // create JSObject
+ JSObject.getWindow(this).eval(
+ "window.location.replace('./referenceSelect.jsp')");
+ // JSObject.getWindow(this).eval("alert('"+this.retrieveGroupType(this
+ // .getParameter("url"))+"')");
+ }
+ catch (Exception ex) { // Error on create JSObject
+ showStatus("Error call javascript err=" + ex);
+ }
+ }
+
+ class UserJscrollPane extends JScrollPane{
+ private JGraph jgraph;
+ public UserJscrollPane(JGraph vjgraph){
+ super(vjgraph);
+ this.jgraph = vjgraph;
+ jgraph.setEditable(false);
+
+ jgraph.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ jgraph_mouseClicked(e);
+ }
+ });
+ }
+
+ void jgraph_mouseClicked(MouseEvent ev) {
+ try {
+ if (ev.getClickCount() == 2) {
+ Object obj = jgraph.getFirstCellForLocation(ev.getX(), ev.getY());
+ if (obj != null && obj instanceof DefaultGraphCell && !(obj instanceof DefaultEdge)) {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ UserGraphCell userGraph = (UserGraphCell) graphCell.getUserObject();
+ JOptionPane.showMessageDialog(this,userGraph.strmethodName);
+ }
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+ }
+
+
+}
+
Added: trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet2.java
===================================================================
--- trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet2.java (rev 0)
+++ trunk/java/src/appletGraph/org/jboss/profiler/graphapplet/UserGroupApplet2.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,526 @@
+package org.jboss.profiler.graphapplet;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+
+import netscape.javascript.JSObject;
+
+import org.jboss.profiler.tracerModel.UserGraphCell;
+import org.jgraph.JGraph;
+import org.jgraph.graph.ConnectionSet;
+import org.jgraph.graph.DefaultEdge;
+import org.jgraph.graph.DefaultGraphCell;
+import org.jgraph.graph.DefaultGraphModel;
+import org.jgraph.graph.DefaultPort;
+import org.jgraph.graph.GraphConstants;
+
+/**
+ *@author Huijuan Shao
+ */
+public class UserGroupApplet2 extends JApplet{
+ private final int UP_BOUND = 10000;
+ private final int VERTEX_WIDTH = 100;
+ private final int VERTEX_HEIGHT = 20;
+ private final int TOP_MARGIN = 1;
+ private final int LEFT_MARGIN = 1;
+ private final int VERTEX_INIT_X = this.LEFT_MARGIN;
+ private final int VERTEX_INIT_Y = this.TOP_MARGIN;
+ private final int VERTEX_GAP = this.VERTEX_WIDTH+2;
+ private JScrollPane jscPane = null;
+ public UserGroupApplet2(){
+
+ }
+
+
+ private DefaultEdge newEdge(HashMap vattrMap, ConnectionSet vedteSet,
+ UserGraphBar vcalleer, UserGraphBar vcallee, boolean vdash, UserGraphCell vusergraphCell){
+
+ Map simpleArrowMap = GraphConstants.createMap();
+ DefaultPort srcPort = null;
+ DefaultPort dstPort = null;
+ ArrayList list = new ArrayList();
+
+ if(vcalleer == vcallee){
+ srcPort = (DefaultPort) vcalleer.getPort(vcalleer.getTotalports()-2);
+ dstPort = (DefaultPort) vcallee.getPort(vcallee.getTotalports()-1);
+ list.add(new Point(10,10));
+ list.add(new Point(10,10));
+ list.add(new Point(10,10));
+ // list.add(new Point(60,70));
+ list.add(new Point(10,10));
+ //GraphConstants.setLineStyle(simpleArrowMap,GraphConstants.STYLE_QUADRATIC);
+ //GraphConstants.setRouting(simpleArrowMap,new DefaultEdge.DefaultRouting());
+ GraphConstants.setPoints(simpleArrowMap,list);
+ }
+ else{
+ srcPort = (DefaultPort) vcalleer.getPort(vcalleer.getTotalports()-1);
+ dstPort = (DefaultPort) vcallee.getPort(vcallee.getTotalports()-1);
+ }
+
+ GraphConstants.setLineEnd(
+ simpleArrowMap,
+ GraphConstants.ARROW_CLASSIC);
+ GraphConstants.setFont(simpleArrowMap,GraphConstants.defaultFont.deriveFont(Font.PLAIN, 10));
+
+ GraphConstants.setBeginSize(simpleArrowMap,10);
+ if(vdash){
+ GraphConstants.setDashPattern(simpleArrowMap, new float[] { 10, 8 });
+ }
+ //GraphConstants.setFont(simpleArrowMap,GraphConstants.defaultFont.deriveFont(10));
+ SimpleDateFormat f= new SimpleDateFormat("yyMMdd hh:mm:ss:S");
+ String date = f.format(new Date(vusergraphCell.istarttime));
+ DefaultEdge relationEdge = new DefaultEdge(date+"("+(vusergraphCell.iendtime-vusergraphCell.istarttime)+")");
+
+ vedteSet.connect(relationEdge,srcPort,dstPort);
+ vattrMap.put(relationEdge, simpleArrowMap);
+ return relationEdge;
+ }
+
+ private void setAllEdgePoints(HashMap vattrMap, DefaultGraphModel vmodel){
+
+ Iterator edgeitr = vattrMap.keySet().iterator();
+ while(edgeitr.hasNext()){
+ DefaultEdge edge = (DefaultEdge)edgeitr.next();
+ DefaultPort srcport = (DefaultPort) vmodel.getSource(edge);
+ DefaultPort dstport = (DefaultPort) vmodel.getTarget(edge);
+ DefaultGraphCell srccell = (DefaultGraphCell)srcport.getParent();
+ DefaultGraphCell dstcell = (DefaultGraphCell)dstport.getParent();
+
+ Rectangle srcrect = GraphConstants.getBounds(srccell.getAttributes());
+ Rectangle dstrect = GraphConstants.getBounds(dstcell.getAttributes());
+ Point srcoffset = GraphConstants.getOffset(srcport.getAttributes());
+ Point dstoffset = GraphConstants.getOffset(dstport.getAttributes());
+
+ GraphConstants.setLabelPosition(edge.getAttributes(),new Point(10,5));
+ //edge.setUserObject(srcoffset.getY()+":"+dstoffset.getY());
+
+ Map map = (Map)vattrMap.get(edge);
+
+ List list = GraphConstants.getPoints(map);
+ if(list == null){
+ continue;
+ }
+
+ ((Point)list.get(1)).x = (int) (srcrect.getX()+srcrect.width+20);
+ ((Point)list.get(1)).y = (int) (srcoffset.getY()*srcrect.getHeight()/1000+srcrect.getY());
+ ((Point)list.get(2)).x = (int) (dstrect.getX()+dstrect.width+20);
+ ((Point)list.get(2)).y = (int) (dstoffset.getY()*dstrect.getHeight()/1000+dstrect.getY());
+ // GraphConstants.setBounds(vattrMap,rect);
+ }
+ }
+
+ public ArrayList getuserGroupList(){
+ ArrayList groupList = new ArrayList();
+
+ try {
+ java.net.URL url;
+ url = new java.net.URL(this.getCodeBase().toString()+ getParameter("url"));
+ java.io.InputStream inp = url.openStream();
+ java.io.ObjectInputStream obj = new java.io.ObjectInputStream(inp);
+ groupList = (ArrayList) obj.readObject();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ return groupList;
+ }
+
+ /**
+ *
+ * @param vdetailmethdsList "[groupname][depth:methodname]" e.g."[Group1][1:f1][2:f3][3:f5]..."
+ */
+ public void processCallingRelations(ArrayList vdetailmethdsList){
+
+ int ioutlen = 0;
+ if(null != vdetailmethdsList){
+ ioutlen = vdetailmethdsList.size();
+ }
+ if(ioutlen == 0){
+ JOptionPane.showMessageDialog(this,"There's no group selected, please select groupfirst");
+ return;
+ }
+ if(ioutlen > UP_BOUND){
+ int selectnum = JOptionPane.showConfirmDialog(this,"There're too many cells in the graph, applet may run out of memory, continue?");
+ if(selectnum == JOptionPane.NO_OPTION || selectnum == JOptionPane.CANCEL_OPTION){
+ this.redirectPage();
+ return;
+ }
+ }
+ this.addcallingGraph(vdetailmethdsList);
+ }
+
+ private void addcallingGraph(ArrayList vgroupedmethodList){
+ DefaultGraphModel graphModel = new DefaultGraphModel();
+ JGraph jgraph = new JGraph(graphModel);
+ this.jscPane = new UserJscrollPane(jgraph);
+ this.getContentPane().add(this.jscPane);
+ int iLen = 0;
+ if(null != vgroupedmethodList){
+ iLen = vgroupedmethodList.size();
+ if(iLen < 1){
+ return;
+ }
+ }
+
+ HashMap existbarsMap = new HashMap();
+ HashMap edgesattrMap = new HashMap();
+
+ ConnectionSet edgeSet = new ConnectionSet();
+ UserGraphBar previousBar = null;
+ UserGraphCell previousCell = null;
+ int iseq = 1;
+ int iposx = 0;
+ boolean isreturning = false;
+ boolean isright = false;
+ for(int i = 0; i < iLen; i++){
+ UserGraphCell curuserCell = (UserGraphCell)vgroupedmethodList.get(i);
+ UserGraphBar curbar = null;
+ if(!existbarsMap.containsKey(curuserCell.strmethodName)){
+ curbar = new UserGraphBar(curuserCell,
+ iseq,
+ this.VERTEX_INIT_X+this.VERTEX_GAP*iposx
+ ,this.VERTEX_INIT_Y,
+ this.VERTEX_WIDTH,
+ this.VERTEX_HEIGHT);
+ existbarsMap.put(curuserCell.strmethodName,curbar);
+ iposx++;
+ }
+ else {
+ curbar = (UserGraphBar)existbarsMap.get(curuserCell.strmethodName);
+ }
+
+ if(previousBar != null ){
+ DefaultGraphCell barhead = previousBar.getHead();
+ if (previousCell.idepth > curuserCell.idepth){
+ isreturning = true;
+ }
+ else{
+ isreturning = false;
+ }
+ Map tmpMap = (Map)previousBar.getAttrsMap().get(previousBar.getHead());
+ int previousX = GraphConstants.getBounds(tmpMap).x;
+ tmpMap = (Map)curbar.getAttrsMap().get(curbar.getHead());
+ int curX = GraphConstants.getBounds(tmpMap).x;
+ if(previousX < curX){
+ isright = true;
+ }
+ else{
+ isright = false;
+ }
+ }
+
+ int srcportx = 0;
+ int dstportx = 0;
+ if(isright){
+ srcportx = 1000;
+ dstportx = 0;
+ }
+ else{
+ srcportx = 0;
+ dstportx = 1000;
+ }
+ boolean iscurexpanded = false;
+ boolean ispreexpanded = false;
+ DefaultEdge curedge = null;
+
+ if(null != previousBar){
+ if(previousBar == curbar){
+ dstportx = 1000;
+ srcportx = 1000;
+ iscurexpanded = curbar.addPort(dstportx,iseq++);
+ ispreexpanded = previousBar.addPort(srcportx,iseq);
+ }
+ else{
+ iscurexpanded = curbar.addPort(dstportx,iseq);
+ ispreexpanded = previousBar.addPort(srcportx,iseq);
+ }
+
+ if(iscurexpanded || ispreexpanded){
+ Iterator itr = existbarsMap.values().iterator();
+ while(itr.hasNext()){
+ UserGraphBar bar = (UserGraphBar)itr.next();
+ if(bar == curbar || bar == previousBar){
+ continue;
+ }
+ else{
+ bar.addBlankBar();
+ }
+ }
+ }
+ curedge = this.newEdge(edgesattrMap, edgeSet, previousBar,curbar,isreturning,previousCell);
+ iseq++;
+ }
+ previousBar = curbar;
+ previousCell = curuserCell;
+ }
+ //this.setAllPortsPad(barattrMap,(double)GraphConstants.PERCENT/iseq);
+
+ Iterator itr = existbarsMap.values().iterator();
+ while(itr.hasNext()){
+ UserGraphBar bar = (UserGraphBar)itr.next();
+ bar.validate(iseq-1);
+ bar.addToModel(graphModel);
+ }
+ ArrayList edgearray = new ArrayList(edgesattrMap.keySet());
+ graphModel.insert(edgearray.toArray(),edgesattrMap,edgeSet,null,null);
+ //this.insertBarsToModel(barattrmapList,graphModel);
+ this.setAllEdgePoints(edgesattrMap,graphModel);
+ graphModel.getRootCount();
+ graphModel.edit(edgesattrMap,edgeSet,null,null);
+ }
+
+ public void init() {
+ //this.jtabPane = new JTabbedPane();
+ }
+
+ //Start the applet
+ public void start() {
+ this.processCallingRelations(this.getuserGroupList());
+ }
+
+ //Stop the applet
+ public void stop() {
+ this.jscPane = null;
+ }
+ //Destroy the applet
+ public void destroy() {
+ //this.getContentPane().remove(this.jtabPane);
+ //this.jtabPane = null;
+ }
+
+ private void redirectPage() {
+ try { // create JSObject
+ JSObject.getWindow(this).eval(
+ "window.location.replace('./referenceSelect.jsp')");
+ // JSObject.getWindow(this).eval("alert('"+this.retrieveGroupType(this
+ //.getParameter("url"))+"')");
+ }
+ catch (Exception ex) { // Error on create JSObject
+ showStatus("Error call javascript err=" + ex);
+ }
+ }
+
+
+
+
+
+
+
+
+
+ class UserJscrollPane extends JScrollPane{
+ private JGraph jgraph;
+ public UserJscrollPane(JGraph vjgraph){
+ super(vjgraph);
+ this.jgraph = vjgraph;
+ jgraph.setEditable(false);
+
+ jgraph.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ jgraph_mouseClicked(e);
+ }
+ });
+ }
+ void jgraph_mouseClicked(MouseEvent ev) {
+ try {
+ if (ev.getClickCount() == 2) {
+ Object obj =
+ jgraph.getFirstCellForLocation(ev.getX(), ev.getY());
+ if (obj != null && obj instanceof DefaultGraphCell && !(obj instanceof DefaultEdge)) {
+ DefaultGraphCell graphCell = (DefaultGraphCell) obj;
+ Object tmpobj = graphCell.getUserObject();
+ if(tmpobj instanceof UserGraphCell){
+ UserGraphCell userGraph = (UserGraphCell)tmpobj;
+ JOptionPane.showMessageDialog(this,userGraph.strmethodName);
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(this, ex.toString());
+ }
+ }
+
+ }
+ public class UserGraphBar{
+ public static final int ROWS_PERBAR = 900;
+ private static final int UNIT_HIGHT = 20;
+ private static final int BAR_WIDTH = 15;
+ private DefaultGraphCell head;
+ private ArrayList bodyList = new ArrayList();
+ private HashMap attrsMap = new HashMap();
+ // private int activebarIndex;
+ private int totalports;
+ public UserGraphBar(UserGraphCell cell, int vrownum,int posx, int posy, int width,int height){
+ this.head = this.newCell(cell,posx,posy,width,height);
+ while(this.bodyList.size()*ROWS_PERBAR < vrownum){
+ this.bodyList.add(this.newBar());
+ }
+ }
+ public void addBlankBar(){
+ this.bodyList.add(this.newBar());
+ }
+ /**
+ * @return true if new bar is added to current bar
+ */
+ public boolean addPort(int vposx, int vrownum){
+ DefaultGraphCell graphcell = null;
+ boolean isnewbaradded = false;
+ int actualrow = vrownum%ROWS_PERBAR;
+ while(bodyList.size()*ROWS_PERBAR < vrownum){
+ bodyList.add(this.newBar());
+ isnewbaradded = true;
+ }
+ graphcell = (DefaultGraphCell)bodyList.get(this.bodyList.size()-1);
+ if(actualrow == 0 && vrownum>0){
+ actualrow = ROWS_PERBAR;
+ }
+ DefaultPort port = this.newPort(vposx,actualrow);
+ graphcell.add(port);
+ totalports++;
+ return isnewbaradded;
+ }
+ public DefaultPort getPort(int index){
+ int i = 0;
+ int totalchildcount = 0;
+ for(; i<this.bodyList.size(); i++){
+ DefaultGraphCell bar = (DefaultGraphCell)bodyList.get(i);
+ totalchildcount += bar.getChildCount();
+ if(totalchildcount -1 >= index){
+ break;
+ }
+ }
+ if(i == bodyList.size()){
+ return null;
+ }
+ DefaultGraphCell bar = (DefaultGraphCell)bodyList.get(i);
+ totalchildcount -= bar.getChildCount();
+
+ DefaultPort port = (DefaultPort)bar.getChildAt(index-totalchildcount);
+ return port;
+ }
+
+
+ public void validate(int totalrows){
+ Map headattrMap = (Map)this.attrsMap.get(this.head);
+ Rectangle rect = GraphConstants.getBounds(headattrMap);
+ for(int i = 0; i < this.bodyList.size(); i++){
+ int barrowcount = ROWS_PERBAR;
+ if(i == this.bodyList.size() - 1){
+ barrowcount = totalrows - ROWS_PERBAR*i;
+ }
+ DefaultGraphCell bar = (DefaultGraphCell)this.bodyList.get(i);
+ Map barattrMap = (Map)this.attrsMap.get(bar);
+ Rectangle barRect = new Rectangle(rect.x+rect.width/2-BAR_WIDTH/2,
+ rect.y+rect.height+ROWS_PERBAR*i*UNIT_HIGHT,
+ BAR_WIDTH,
+ barrowcount*UNIT_HIGHT);
+ GraphConstants.setBounds(barattrMap,barRect);
+
+
+ Iterator itr = bar.getChildren().iterator();
+ while(itr.hasNext()){
+ DefaultPort port = (DefaultPort)itr.next();
+ Point offset = GraphConstants.getOffset(port.getAttributes());
+ offset.y = offset.y*GraphConstants.PERCENT/barrowcount;
+ }
+
+ }
+
+
+
+ }
+ public void addToModel(DefaultGraphModel model){
+ DefaultGraphCell elements[] = new DefaultGraphCell[this.bodyList.size()+1];
+ for(int i=0; i<bodyList.size(); i++){
+ elements[i] = (DefaultGraphCell)bodyList.get(i);
+ }
+ elements[this.bodyList.size()] = this.head;
+ model.insert(elements,this.attrsMap,null,null,null);
+
+
+ }
+ public int getTotalports() {
+ return totalports;
+ }
+ public void setTotalports(int totalports) {
+ this.totalports = totalports;
+ }
+ public HashMap getAttrsMap() {
+ return attrsMap;
+ }
+ public void setAttrsMap(HashMap attrsMap) {
+ this.attrsMap = attrsMap;
+ }
+ public ArrayList getBodyList() {
+ return bodyList;
+ }
+ public void setBodyList(ArrayList bodyList) {
+ this.bodyList = bodyList;
+ }
+ public DefaultGraphCell getHead() {
+ return head;
+ }
+ public void setHead(DefaultGraphCell head) {
+ this.head = head;
+ }
+ private DefaultGraphCell newCell(UserGraphCell cell, int posx,int posy,int width, int height){
+
+ DefaultGraphCell graphcell = new DefaultGraphCell(cell);
+ Map map = GraphConstants.createMap();
+ GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
+ GraphConstants.setBounds(map,new Rectangle(posx,posy,width,height));
+ GraphConstants.setBackground(map, Color.RED.darker());
+ GraphConstants.setForeground(map, Color.white);
+ GraphConstants.setFont(map,GraphConstants.defaultFont.deriveFont(Font.BOLD, 12));
+ this.attrsMap.put(graphcell,map);
+ GraphConstants.setOpaque(map, true);
+ return graphcell;
+
+ }
+ private DefaultGraphCell newBar(){
+
+ DefaultGraphCell graphcell = new DefaultGraphCell();
+ Map map = GraphConstants.createMap();
+ GraphConstants.setBorder(map, BorderFactory.createRaisedBevelBorder());
+ GraphConstants.setBounds(map,new Rectangle(0,0,2,2));
+ GraphConstants.setBackground(map, Color.RED.darker());
+ GraphConstants.setForeground(map, Color.white);
+ GraphConstants.setFont(map,GraphConstants.defaultFont.deriveFont(Font.BOLD, 12));
+ this.attrsMap.put(graphcell,map);
+ GraphConstants.setOpaque(map, true);
+ return graphcell;
+
+ }
+ private DefaultPort newPort(int vposx, int row){
+ DefaultPort dp = new DefaultPort();
+ GraphConstants.setOffset(dp.getAttributes(),new Point(vposx,row));
+ return dp;
+ }
+
+ }
+
+
+}
+
+
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphCallings.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphCallings.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphCallings.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,430 @@
+package org.jboss.profiler.tracerModel;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.profiler.util.GroupUtil;
+import org.jboss.profiler.util.GroupMatcher;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class GroupGraphCallings implements Serializable
+{
+
+ /** the groups information,each element is GroupGraphGroup */
+ private ArrayList groups;
+
+ /**The references of each group, GroupGraphReference */
+ private ArrayList references;
+
+ /**
+ * to store the group type(method, class or package).
+ */
+ private String strgroupType = "";
+
+ public String getStrgroupType() {
+ return strgroupType;
+ }
+ public void setStrgroupType(String strgroupType) {
+ this.strgroupType = strgroupType;
+ }
+ /**
+ * @return Returns the groups.
+ */
+ public ArrayList getGroups() { return groups; }
+ /**
+ * @param groups The groups to set.
+ */
+ public void setGroups(ArrayList groups) { this.groups = groups; }
+
+ /**
+ * @return Returns the references.
+ */
+ public ArrayList getReferences() { return references; }
+ /**
+ * @param references The references to set.
+ */
+ public void setReferences(ArrayList references) { this.references = references; }
+
+ public void printDebug()
+ {
+ System.out.println("Groups:");
+ Iterator iter = groups.iterator();
+ while (iter.hasNext()){
+ GroupGraphGroup group = (GroupGraphGroup) iter.next();
+ System.out.println("id=" + group.getGroupID() +
+ " name=" + group.getName() +
+ " groupName=" + group.getGroupName() +
+ " level=" + group.getLevel());
+ System.out.print("methodList=");
+ for (int i=0; i<group.getMethodList().size(); i++)
+ System.out.print(((Integer)group.getMethodList().get(i)).toString() + ",");
+ System.out.print("\n");
+ }
+
+ System.out.println("References:");
+ iter = references.iterator();
+ while (iter.hasNext()){
+ GroupGraphReference reference = (GroupGraphReference) iter.next();
+ System.out.println("id callee="+reference.getGroupCallee() + this.getGroupByID(reference.getGroupCallee()).getGroupName() +
+ " id called="+reference.getGroupCalled() + this.getGroupByID(reference.getGroupCalled()).getGroupName());
+ }
+ }
+
+
+ /**
+ * @param vstrGroupName - group name.
+ * @return GroupGraphGroup, null if there's no such GroupGraphgroup
+ * this function locates the GroupGraphGroup by groupname and return it
+ */
+ public GroupGraphGroup getGroupByName(String vstrGroupName){
+ GroupGraphGroup foundGroup = null;
+ for(int i = 0; i<this.groups.size(); i++){
+ foundGroup = (GroupGraphGroup)this.groups.get(i);
+ if(foundGroup.getGroupName().equals(vstrGroupName)){
+ return foundGroup;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param vid group id
+ * @return GroupGraphGroup, null if there's no such GroupGraphgroup
+ * this function locates the GroupGraphGroup by groupid and return it
+ */
+ public GroupGraphGroup getGroupByID(int vid){
+ GroupGraphGroup foundGroup = null;
+ for(int i = 0; i<this.groups.size(); i++){
+ foundGroup = (GroupGraphGroup)this.groups.get(i);
+ if(foundGroup.getGroupID() == vid){
+ return foundGroup;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return an ArrayList of references between groups,For example, if the returned array is named arrRet,
+ * then arrRet[2] is an ArrayList of the groupids called by the group of groupid 2.
+ * 1.this method is to convert this.references to a new structure as this.references would be inefficient
+ * in using.
+ * 2.the method uses groupId to be the index of array which will be returned as ArrayList[], so the groupid
+ * must be integer >= 0.
+ */
+ public ArrayList[] processReferences(){
+ int iMaxIndex = 0;
+ for(int i = 0; i < this.references.size(); i++){
+ GroupGraphReference curRef = (GroupGraphReference)this.references.get(i);
+ iMaxIndex = curRef.getGroupCallee() > iMaxIndex?curRef.getGroupCallee():iMaxIndex;
+ iMaxIndex = curRef.getGroupCalled() > iMaxIndex?curRef.getGroupCalled():iMaxIndex;
+ }
+ if(iMaxIndex <= 0){
+ return null;
+ }
+ ArrayList[] referenceArray = new ArrayList[iMaxIndex + 1];
+ for(int i = 0; i<iMaxIndex + 1; i++){
+ referenceArray[i] = new ArrayList();
+ }
+ for(int i = 0; i < this.references.size(); i++){
+ GroupGraphReference curRef = (GroupGraphReference)this.references.get(i);
+ int icalleeId = curRef.getGroupCallee();
+ int icalledId = curRef.getGroupCalled();
+ referenceArray[icalleeId].add(Integer.valueOf(icalledId));
+ }
+ return referenceArray;
+ }
+
+ /**
+ * @param the group
+ * @return a HashMap which stores the calling relationship of each group with group name be the key.
+ * <key,value>: <group Name, ArrayList of group names>
+ */
+ public LinkedHashMap getGroupedReferncesFromArray(String vstrGroupNames[])
+ {
+ if(null == vstrGroupNames){
+ return null;
+ }
+ LinkedHashMap groupedReferncesMap = new LinkedHashMap();
+ ArrayList[] groupRefsList = this.processReferences();
+ ArrayList othercalleeList = new ArrayList();
+
+ for(int i = 0; i<vstrGroupNames.length; i++){
+ GroupGraphGroup curCallerGroup = this.getGroupByName(vstrGroupNames[i]);
+ ArrayList curCalleeNamesList = new ArrayList();
+
+ if(null != curCallerGroup){
+ ArrayList curCalleeList = groupRefsList[curCallerGroup.getGroupID()];
+ for(int inIndex = 0; inIndex < curCalleeList.size(); inIndex++){
+ int igroupId = ((Integer)curCalleeList.get(inIndex)).intValue();
+ GroupGraphGroup curCalleeGroup = this.getGroupByID(igroupId);
+
+
+ if(!this.isMemberInGroup(curCalleeGroup.getGroupName(),vstrGroupNames)){
+ if(!curCalleeNamesList.contains("other"))
+ curCalleeNamesList.add("other");
+ }
+ else
+ curCalleeNamesList.add(curCalleeGroup.getGroupName());
+ }
+ groupedReferncesMap.put(curCallerGroup.getGroupName(), curCalleeNamesList );
+ }
+ }
+
+ int ilen = 0;
+ if(null != this.groups){
+ ilen = this.groups.size();
+ }
+ for(int index = 0; index<ilen; index++){
+ GroupGraphGroup curGroup = (GroupGraphGroup)this.groups.get(index);
+ if(!this.isMemberInGroup(curGroup.getGroupName(),vstrGroupNames)){
+ ArrayList tmpcalleeList = groupRefsList[curGroup.getGroupID()];
+ int innerlen = 0;
+ if(null != tmpcalleeList){
+ innerlen = tmpcalleeList.size();
+ }
+ for(int innerindex = 0;innerindex < innerlen; innerindex++){
+ String strcalleeName = this.getGroupByID(((Integer)tmpcalleeList.get(innerindex)).intValue())
+ .getGroupName();
+ if(this.isMemberInGroup(strcalleeName,vstrGroupNames)){
+ if(!othercalleeList.contains(strcalleeName)){
+ othercalleeList.add(strcalleeName);
+ }
+ }
+ }
+
+ }
+ }
+
+ if (othercalleeList.size() > 0){
+ groupedReferncesMap.put("other",othercalleeList);
+ }
+ return groupedReferncesMap;
+ }
+
+ /**
+ * setup one HashMap to store the groups information according to the UserGroup.
+ * The HashMap stores the calling relationship of each group with group name as the key.
+ * @param vusrGroupList the input UserGroup arraylist.
+ * @return The group calling relationship HashMap
+ */
+
+ public HashMap setusergroupMethods(ArrayList vusrGroupList){
+ int imethodsNum = this.groups.size();
+ int iusrgrouplen = vusrGroupList.size();
+ ArrayList[] methodNamesLists = new ArrayList[iusrgrouplen];
+ HashMap usrgroupname2calleeMap = new HashMap();
+ UserGroup othergroup = null;
+
+ for(int i =0; i< iusrgrouplen; i++){
+ methodNamesLists[i] = new ArrayList();
+ if(((UserGroup)vusrGroupList.get(i)).getStrGroupName() == null){
+ othergroup = (UserGroup)vusrGroupList.get(i);
+ continue;
+ }
+ }
+
+
+ for(int i = 0; i<imethodsNum; i++){
+ String strcurMethodName = ((GroupGraphGroup)this.groups.get(i)).getGroupName();
+ UserGroup matchedusrgroup = null;
+ for(int inindex = 0; inindex< iusrgrouplen; inindex++){
+ UserGroup curusrGroup = (UserGroup)vusrGroupList.get(inindex);
+ if(curusrGroup.getStrGroupName() == null){
+ continue;
+ }
+
+ GroupMatcher groupMatcher=new GroupMatcher(curusrGroup,strcurMethodName);
+
+ if(groupMatcher.matches()){
+ if(matchedusrgroup == null){
+ matchedusrgroup = curusrGroup;
+ }
+ if(matchedusrgroup.getIpriority() < curusrGroup.getIpriority()){
+ matchedusrgroup = curusrGroup;
+ }
+ else if(matchedusrgroup.getIpriority() == curusrGroup.getIpriority()){
+ if(matchedusrgroup.getIgroupSeqNo() > curusrGroup.getIgroupSeqNo()){
+ matchedusrgroup = curusrGroup;
+ }
+ }
+ else {
+ continue;
+ }
+ }
+ }
+
+ if(matchedusrgroup != null){
+ matchedusrgroup.getMemberNames().add(strcurMethodName);
+ Integer callerid = Integer.valueOf(((GroupGraphGroup)this.groups.get(i)).getGroupID());
+ usrgroupname2calleeMap.put(callerid, matchedusrgroup);
+ }
+ else{
+ if(othergroup == null){
+ othergroup = new UserGroup();
+ vusrGroupList.add(othergroup);
+ }
+ othergroup.getMemberNames().add(strcurMethodName);
+ }
+ }
+ return usrgroupname2calleeMap;
+ }
+
+ /**
+ * @param vusrGroupList the user input groups information, each element is UserGroup
+ * @return the arraylist of each UserGroup's callee list
+ */
+ public ArrayList getCallingRelations(ArrayList vusrGroupList){
+
+ HashMap usrgroupname2calleeMap = this.setusergroupMethods(vusrGroupList);
+ return this.getgroupedCalleeList(usrgroupname2calleeMap,vusrGroupList);
+ }
+
+
+ /**
+ * @param vstrGroupNames
+ * @return true if the GroupName is in the GroupsNames. false if the GroupName is NOT in the GroupNames.
+ */
+ private boolean isMemberInGroup(String vstrGroupName,String vstrGroupNames[]){
+ boolean bret = false;
+ for(int i = 0; i < vstrGroupNames.length; i++){
+ if(vstrGroupNames[i].equals(vstrGroupName)){
+ bret = true;
+ break;
+ }
+ }
+ return bret;
+ }
+
+ /**
+ * get the callee list of groups according to user input groups, and the map <groupid,user input groups>
+ * @param method2groupMap each method is referenced by GroupGraphGroup and UserGroup
+ * These groups are connected by the GroupID.
+ * method2groupMap stores the map of UserGroup and the GroupID as the key.
+ * @param vusrGroupList user input groups information arraylist, each element is UserGroup
+ * @return a HashMap which stores the calling relationship of each group with group name be the key.
+ * <key,value>: <method name, ArrayList of method names>
+ */
+ private ArrayList getgroupedCalleeList(HashMap method2groupMap, ArrayList vusrGroupList)
+ {
+ UserGroup otheruserGroup = new UserGroup();
+ vusrGroupList.add(otheruserGroup);
+ for(int i =0; i< vusrGroupList.size(); i++){
+ UserGroup tmpusrGroup = (UserGroup)vusrGroupList.get(i);
+ if(tmpusrGroup.getStrGroupName() != null){
+ tmpusrGroup.getMethodRefMap().put(tmpusrGroup.getStrGroupName(),new ArrayList());
+ }
+ else{
+ vusrGroupList.remove(otheruserGroup);
+ otheruserGroup = tmpusrGroup;
+ }
+ }
+
+ ArrayList[] referencesList = this.processReferences();
+
+ for(int i = 0; i < this.groups.size(); i++){
+ GroupGraphGroup curgroup = (GroupGraphGroup)this.groups.get(i);
+ String callerName = null;
+
+ UserGroup usrgroup = (UserGroup)method2groupMap.get(Integer.valueOf(curgroup.getGroupID()));
+ if( usrgroup != null){
+ callerName = usrgroup.getStrGroupName();
+ }
+ else{
+ usrgroup = otheruserGroup;
+ callerName = curgroup.getGroupName();
+ }
+ ArrayList calleesList = referencesList[curgroup.getGroupID()];
+ ArrayList calleeNamesList = (ArrayList)usrgroup.getMethodRefMap().get(callerName);
+ if(calleeNamesList == null){
+ calleeNamesList = new ArrayList();
+ }
+ for(int inindex = 0; inindex < calleesList.size(); inindex++){
+ Integer curcalleeid = (Integer)calleesList.get(inindex);
+ UserGroup calleegroup = (UserGroup)method2groupMap.get(curcalleeid);
+ String curcalleeName = null;
+ if(calleegroup != null){
+ curcalleeName = calleegroup.getStrGroupName();
+ }
+ else{
+ curcalleeName = (this.getGroupByID(curcalleeid.intValue())).getGroupName();
+ }
+ if(!calleeNamesList.contains(curcalleeName)){
+ calleeNamesList.add(curcalleeName);
+ }
+ }
+ usrgroup.getMethodRefMap().put(callerName, calleeNamesList);
+ }
+ ArrayList othergroupmemberList = new ArrayList(otheruserGroup.getMethodRefMap().keySet());
+ otheruserGroup.setMemberNames(othergroupmemberList);
+ return vusrGroupList;
+ }
+
+/**
+ * set the references for each user input groups by inserting the methodRefMap into each UserGroup
+ * of the arrayList.
+ * @see UserGroup.
+ * @param vusrGroupList the user input groups information arraylist. Every element is UserGroup.
+ */
+ public void groupRefForUsergroup(ArrayList vusrGroupList){
+ int imethodsNum = this.groups.size();
+ int iusrgrouplen = vusrGroupList.size();
+ ArrayList[] methodNamesLists = new ArrayList[iusrgrouplen];
+
+ for(int i =0; i< iusrgrouplen; i++){
+ methodNamesLists[i] = new ArrayList();
+ }
+
+ for(int i = 0; i<imethodsNum; i++){
+ String strcurMethodName = ((GroupGraphGroup)this.groups.get(i)).getGroupName();
+ int matchIndex = -1;
+ int imatchqNum = -1;
+ int imatchprio = -1;
+ for(int inindex = 0; inindex< iusrgrouplen; inindex++){
+ UserGroup curusrGroup = (UserGroup)vusrGroupList.get(inindex);
+ GroupMatcher groupMatcher=new GroupMatcher(curusrGroup,strcurMethodName);
+ //if the input required methodName matches the current groups
+ if(groupMatcher.matches()){
+
+ if(imatchprio < curusrGroup.getIpriority()){
+ matchIndex = inindex;
+ imatchprio = curusrGroup.getIpriority();
+ imatchqNum = curusrGroup.getIgroupSeqNo();
+ }
+ else if(imatchprio == curusrGroup.getIpriority()){
+ if(imatchqNum > curusrGroup.getIgroupSeqNo()){
+ matchIndex = inindex;
+ imatchqNum = curusrGroup.getIgroupSeqNo();
+ }
+ }
+ else {
+ continue;
+ }
+ }
+ }
+
+ if(matchIndex >= 0){
+ //add this into the group.
+ methodNamesLists[matchIndex].add(strcurMethodName);
+ }
+ }
+
+
+ for(int i =0; i< iusrgrouplen; i++){
+ String[] methodNameArray = new String[methodNamesLists[i].size()];
+ methodNamesLists[i].toArray(methodNameArray);
+ HashMap curMap = this.getGroupedReferncesFromArray(methodNameArray);
+ ((UserGroup)vusrGroupList.get(i)).setMethodRefMap(curMap);
+ }
+ }
+
+}
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphGroup.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphGroup.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphGroup.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,114 @@
+package org.jboss.profiler.tracerModel;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * Groups information.
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class GroupGraphGroup implements Serializable
+{
+
+ private String name;
+
+ private String groupName;
+
+ private int level;
+
+ private int groupID;
+
+ private ArrayList methodList;
+
+ public String toString() { return name; }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() { return name; }
+
+ /**
+ * @param name The name to set. */
+ public void setName(String name) { this.name = name; }
+
+ /**
+ * @return Returns the groupName. */
+ public String getGroupName() { return groupName; }
+
+ /**
+ * @param groupName The groupName to set. */
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ /**
+ * @return Returns the level.
+ */
+ public int getLevel() { return level; }
+
+ /**
+ * @param level The level to set. */
+ public void setLevel(int level) { this.level = level; }
+
+ /**
+ * @return Returns the groupID.
+ */
+ public int getGroupID() { return groupID; }
+
+ /**
+ * @param groupID The groupID to set. */
+ public void setGroupID(int groupID) { this.groupID = groupID; }
+
+ /**
+ * @return Returns the methodList.
+ */
+ public ArrayList getMethodList() { return methodList; }
+
+ /**
+ * @param methodList The methodList to set.
+ */
+ public void setMethodList(ArrayList methodList) {
+ this.methodList = methodList;
+ }
+
+ public void addMethodList(Integer methodNum)
+ {
+ if (getMethodList()==null)
+ this.methodList = new ArrayList();
+ this.methodList.add((Integer)methodNum);
+ }
+
+ long runningTime;
+ public long getRunningTime(){
+ return this.runningTime;
+ }
+ public void setRunningTime(long runningTime){
+ this.runningTime=runningTime;
+ }
+
+ long totalTime;
+ public long getTotalTime(){
+ return this.totalTime;
+ }
+ public void setTotalTime(long totalTime){
+ this.totalTime=totalTime;
+ }
+
+
+ int counts;
+ public int getCounts(){
+ return this.counts;
+ }
+ public void setCounts(int counts){
+ this.counts=counts;
+ }
+
+ long totalCPUTime;
+ public long getTotalCPUTime(){
+ return this.totalCPUTime;
+ }
+ public void setTotalCPUTime(long totalCPUTime){
+ this.totalCPUTime=totalCPUTime;
+ }
+}
+
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphReference.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphReference.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/GroupGraphReference.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,36 @@
+package org.jboss.profiler.tracerModel;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class GroupGraphReference implements Serializable
+{
+ /**
+ */
+private int groupCallee;
+ /**
+ */
+private int groupCalled;
+
+ /**
+ * @return Returns the groupCallee.
+ */
+public int getGroupCallee() { return groupCallee; }
+ /**
+ * @param groupCallee The groupCallee to set.
+ */
+public void setGroupCallee(int groupCallee) { this.groupCallee = groupCallee; }
+
+ /**
+ * @return Returns the groupCalled.
+ */
+public int getGroupCalled() { return groupCalled; }
+ /**
+ * @param groupCalled The groupCalled to set.
+ */
+public void setGroupCalled(int groupCalled) { this.groupCalled = groupCalled; }
+
+}
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTree.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTree.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTree.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,326 @@
+package org.jboss.profiler.tracerModel;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Properties;
+import java.util.Stack;
+
+import org.jboss.profiler.model.JBPMethod;
+import org.jboss.profiler.util.GroupUtil;
+import org.jboss.profiler.util.SPYGroupNameConvert;
+
+import java.util.Hashtable;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class JBTTransactionTree {
+ private JBTTransactionTreeNode rootNode;
+
+ /**
+ * The construction of JBTTransactionTree is to build a binary tree for a
+ * depths array.
+ */
+ public JBTTransactionTree(JBTTransaction jbtTransaction) {
+
+ ArrayList methodsArray = jbtTransaction.getMethods();
+
+ JBTTransactionTreeNode processedNode = null, currentNode = null;
+
+ /*
+ * build JBTTransactionTreeNode with number of "size"
+ */
+ for (int i = 0; i < methodsArray.size(); i++) {
+
+ currentNode = new JBTTransactionTreeNode();
+ currentNode.jbtMethod = (JBTMethod) methodsArray.get(i);
+
+ if (i == 0) {
+ // for the root node
+ rootNode = currentNode;
+ processedNode = currentNode;
+ continue;
+ }
+
+ /*
+ * only the root node needs to be created to any node,we have the
+ * create itself
+ */
+ if (processedNode.jbtMethod.getDepth() == currentNode.jbtMethod
+ .getDepth()) {
+ /*
+ * if the depth of next Node is equal than this the depth of
+ * this node that means they are in the same depth.
+ */
+ currentNode.parent = processedNode;
+ currentNode.dparent = processedNode.dparent;
+ processedNode.right = currentNode;
+ } else if (processedNode.jbtMethod.getDepth() < currentNode.jbtMethod
+ .getDepth()) {
+ /**
+ * if the depth of next Node is bigger than this one,
+ * depth[i+1]-depth[i]==1, this node is its sibling, the right
+ * child
+ */
+ currentNode.parent = processedNode;
+ currentNode.dparent = processedNode;
+ processedNode.left = currentNode;
+ } else if (processedNode.jbtMethod.getDepth() > currentNode.jbtMethod
+ .getDepth()) {
+ /*
+ * if the depth[i]>depth[i], this node has to go back. the next
+ * node index of i+1 should be other node's right node
+ */
+ while (processedNode.jbtMethod.getDepth() != currentNode.jbtMethod
+ .getDepth()) {
+ processedNode = processedNode.parent;
+ }
+
+ currentNode.parent = processedNode;
+ currentNode.dparent = processedNode.dparent;
+ processedNode.right = currentNode;
+ }
+
+ /*
+ * this is set for creating next node.The current node is the next
+ * node's parent
+ */
+ processedNode = currentNode;
+ }
+ }
+
+ /**
+ * get the root of the tree @return JBTTransactionTreeNode
+ */
+ public JBTTransactionTreeNode getRoot() {
+ return rootNode;
+ }
+
+ /**
+ * @param the names and sequence No in the tree traverse the tree in mid-order
+ * to set the name and sequenceNO.
+ */
+ public void traverseSetNames(HashMap processMethods) {
+ int line = 1;
+
+ // traverse the tree to print the info and set the name for each tree
+ // node.
+ Stack tmpStack = new Stack();
+ JBTTransactionTreeNode tmpNode = this.getRoot();
+
+ while (tmpNode != null) {
+ // the following content is the same with that in the for
+ JBTMethod transactionMethod = tmpNode.getJBTMethod();
+ String methodName = "";
+
+ Iterator iter2 = processMethods.values().iterator();
+ while (iter2.hasNext()) {
+ JBPMethod processMethod = (JBPMethod) iter2.next();
+ if (processMethod.getMethodID() == transactionMethod
+ .getMethodID()) {
+ methodName = processMethod.getSimplifiedName();
+ break;
+ }
+ }
+
+ tmpNode.setSequenceNo(line);
+
+ tmpNode.setName(methodName);
+
+ line++;
+
+ if (tmpNode.getRight() != null)
+ tmpStack.push(tmpNode.getRight());
+
+ if (tmpNode.getLeft() != null)
+ tmpNode = tmpNode.getLeft();
+ else {
+ if (tmpStack.isEmpty())
+ break;
+ else
+ tmpNode = (JBTTransactionTreeNode) tmpStack.pop();
+ }
+ }// end of while
+ }
+
+ /**
+ *@return traverse to transfer the information of JBTTransactionTreeNode into
+ * arraylist
+ */
+ public ArrayList traverseGetArrayList() {
+ ArrayList nodesArray = new ArrayList();
+
+ // traverse the tree to print the info and set the name for each tree
+ // node.
+ Stack tmpStack = new Stack();
+ JBTTransactionTreeNode tmpNode = this.getRoot();
+
+ while (tmpNode != null) {
+ nodesArray.add(tmpNode);
+
+ if (tmpNode.getRight() != null)
+ tmpStack.push(tmpNode.getRight());
+
+ if (tmpNode.getLeft() != null)
+ tmpNode = tmpNode.getLeft();
+ else {
+ if (tmpStack.isEmpty())
+ break;
+ else
+ tmpNode = (JBTTransactionTreeNode) tmpStack.pop();
+ }
+ }// end of while
+
+ return nodesArray;
+ }
+
+ /**
+ * @return an ArrayList of method flow (the control flow of methods)
+ */
+ public ArrayList traverseForDetail() {
+ if (null == this.rootNode) {
+ return null;
+ }
+ ArrayList detailArray = new ArrayList();
+ JBTTransactionTreeNode currentNode = this.rootNode;
+ JBTTransactionTreeNode processedNode = null;
+ Stack tmpStack = new Stack();
+ while (true) {
+ processedNode = currentNode;
+ if (currentNode.getRight() != null)
+ tmpStack.push(currentNode.getRight());
+
+ if (currentNode.getLeft() != null) {
+ currentNode = currentNode.getLeft();
+
+ detailArray.add(processedNode);
+
+ } else {
+ detailArray.add(processedNode);
+ if (tmpStack.isEmpty()) {
+ while (processedNode.getDparent() != null) {
+ processedNode = processedNode.getDparent();
+
+ detailArray.add(processedNode);
+ }// while
+ break;
+ } else {
+ currentNode = (JBTTransactionTreeNode) tmpStack.pop();
+ while (currentNode.getDparent() != processedNode
+ .getDparent()) {
+ processedNode = processedNode.getDparent();
+
+ detailArray.add(processedNode);
+ }
+ detailArray.add(currentNode.getDparent());
+ }
+ }
+ }
+ return detailArray;
+ }
+
+
+/**@param vstrGroupType can be "package" "class" or "method"
+ *1.rename this method from "traverseForMethodDetail" to "traverseForDetailInfo"
+ *2.merge traverseFroMethodDetail(),traverseForPackageDetail(),traverseForClassDetail() to this method.
+ *3.use GroupGraphGroup to replace HashMap for restoring each group's information
+ * method explanation:
+ * this method
+ 1.calls this.traverseForDetail() to get an ArrayList of detail traversed nodes list(dtnl for brief)
+ 2.group the nodes in dtnl by vstrGroupType (method name, package name or class name) and collects the information(total exec counts, total run time,etc.
+ )when grouping.
+ 3.group name is aquired form the tree node's name;
+ 4.use GroupGraphGroup as the structure
+*/
+ public ArrayList traverseForDetailInfo(String vstrGroupType) {
+ ArrayList detailTraverseNodesList = this.traverseForDetail();
+ LinkedHashMap detailedGroupsMap = new LinkedHashMap();
+ HashMap curGroupCallerMap = new HashMap();
+ GroupGraphGroup curGroup = null;
+ int indexDetTrav = 0;
+ String strGroupName = "";
+ JBTTransactionTreeNode lastNode = null;
+ JBTTransactionTreeNode curNode = null;
+
+ for (; indexDetTrav < detailTraverseNodesList.size(); indexDetTrav++) {
+ lastNode = curNode;
+ curNode = (JBTTransactionTreeNode) detailTraverseNodesList
+ .get(indexDetTrav);
+
+ if(vstrGroupType.equals("package")){
+ strGroupName = GroupUtil.getPackageNameFromMethodName(curNode.getName());
+ if(null == strGroupName){
+ strGroupName = "default";
+ }
+ }
+ else if(vstrGroupType.equals("class")){
+ strGroupName = GroupUtil.getClassNameFromMethodName(curNode.getName());
+ }
+ else {
+ strGroupName = curNode.getName();
+ }
+
+ curGroup = (GroupGraphGroup)detailedGroupsMap.get(strGroupName);
+ if (null != curGroup) {
+
+ /*in order to caculate pure time from detail traversed nodes, we must judge if
+ a detail traversed node is the node been called or the node returned from its child, only
+ the one been called must be added to the total pure time of the group
+ */
+ if(lastNode.dparent != curNode) // if the current node is called by another method, rather than returned from its child
+
+ {
+ long totalRunTime = curGroup.getRunningTime();
+ long totalCPUTime = curGroup.getTotalCPUTime();
+ curGroup.setRunningTime(totalRunTime + curNode.getMethodRunningTime());
+ curGroup.setTotalCPUTime(totalCPUTime+ curNode.getMethodCPUTime());
+ }
+
+ int execCount = curGroup.getCounts();
+ curGroup.setCounts( execCount + 1 );
+ JBTTransactionTreeNode curGroupCaller = (JBTTransactionTreeNode)curGroupCallerMap.get(strGroupName);
+ JBTTransactionTreeNode tmpNode = curNode;
+
+ /*
+ * there is possibility that current method is called by another method with the same metod name, in this
+ * case, the total time of the current node musn't be added to the group's total time.
+ */
+ if(curNode != curGroupCaller)
+ {
+ while(tmpNode.dparent != null )
+ {
+ if(tmpNode.dparent == curGroupCaller )
+ {
+ break;
+ }
+ tmpNode=tmpNode.dparent;
+ }
+ // in the below case the current JBTMethod is not called by another method with the same method name
+ // so the total time is the addition of current node's total time and the current group's total time
+ if(tmpNode.dparent == null && curNode != this.rootNode)
+ {
+ long totalTime = curGroup.getRunningTime();
+ curGroup.setTotalTime(totalTime + curNode.getTotalTime() );
+ curGroupCallerMap.remove(curGroup.getGroupName());
+ curGroupCallerMap.put(curGroup.getGroupName(),curNode);
+ }
+ }
+
+ } else { // else it is a new method name
+ curGroup = new GroupGraphGroup();
+ curGroup.setGroupName(strGroupName);
+ curGroup.setCounts(1);
+ curGroup.setTotalTime(curNode.getTotalTime());
+ curGroup.setRunningTime(curNode.getMethodRunningTime());
+ curGroup.setTotalCPUTime(curNode.getMethodCPUTime());
+ curGroupCallerMap.put(curGroup.getGroupName(),curNode);
+ detailedGroupsMap.put(curGroup.getGroupName(),curGroup);
+ }
+ }
+ return new ArrayList(detailedGroupsMap.values());
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTreeNode.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTreeNode.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/JBTTransactionTreeNode.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,200 @@
+package org.jboss.profiler.tracerModel;
+
+/**The node for the JBTTransactionTree
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class JBTTransactionTreeNode {
+ JBTMethod jbtMethod;
+ /**
+ */
+ String name;
+ long totalTime;
+
+ int sequenceNo;
+ JBTTransactionTreeNode parent;
+ JBTTransactionTreeNode dparent;
+ JBTTransactionTreeNode left;
+ JBTTransactionTreeNode right;
+ JBTTransactionTreeNode(){
+ this.jbtMethod=null;
+ this.name="";
+ this.parent=null;
+ this.dparent=null;
+ this.left=null;
+ this.right=null;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String methodName){
+ this.name=methodName;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName(){
+ return this.name;
+ }
+
+ /**
+ * @param sequenceNo The sequenceNo to set.
+ */
+ public void setSequenceNo(int no){
+ this.sequenceNo=no;
+ }
+
+ /**
+ * @return Returns the sequenceNo.
+ */
+ public int getSequenceNo(){
+ return this.sequenceNo;
+ }
+
+ public void setJBTMethod(JBTMethod jbtMethod){
+ this.jbtMethod=jbtMethod;
+ }
+
+ public JBTMethod getJBTMethod(){
+ return this.jbtMethod;
+ }
+
+ /**
+ * @return Returns the parent.
+ */
+ public JBTTransactionTreeNode getParent(){
+ return this.parent;
+ }
+
+ /**
+ * @param parent The parent to set.
+ */
+ public void setParent(JBTTransactionTreeNode parent){
+ this.parent=parent;
+ }
+
+ /**
+ * @return Returns the dparent.
+ */
+ public JBTTransactionTreeNode getDparent(){
+ return this.dparent;
+ }
+
+ /**
+ * @param dparent The dparent to set.
+ */
+ public void setDparent(JBTTransactionTreeNode dparent){
+ this.dparent=dparent;
+ }
+
+ /**
+ * @return Returns the left.
+ */
+ public JBTTransactionTreeNode getLeft(){
+ return this.left;
+ }
+
+ /**
+ * @param left The left to set.
+ */
+ public void setLeft(JBTTransactionTreeNode left){
+ this.left=left;
+ }
+
+ /**
+ * @return Returns the right.
+ */
+ public JBTTransactionTreeNode getRight(){
+ return this.right;
+ }
+
+ /**
+ * @param right The right to set.
+ */
+ public void setRight(JBTTransactionTreeNode right){
+ this.right=right;
+ }
+
+ /**this is to calculate the running time of each node
+ * it equals the its total time - all its children's total time
+ * If any method has no exit time, that means jbtMethod.getElapseEndTime==-1
+ * the totalTime of it is zero*/
+ public long getMethodRunningTime(){
+ long methodRunningTime=-1,tmpLong=0;
+ JBTTransactionTreeNode tmpNode;
+
+ if(this==null) {
+ return -1;
+ }
+
+ //to any method, whether it has exit should be judged
+ if(this.jbtMethod.getElapsedClockEnd()==-1){
+ return -1;
+ }
+
+ methodRunningTime=this.jbtMethod.getElapsedClockEnd()-this.jbtMethod.getElapsedClockStart();
+
+ if(this.left!=null){
+ tmpNode=this.left;
+
+ while(tmpNode!=null) {
+ if(tmpNode.jbtMethod.getElapsedClockEnd()==-1){
+ //this means this method has no exit, return -1
+ return -1;
+ }
+ //the current totalTime minus all
+ tmpLong=tmpNode.jbtMethod.getElapsedClockEnd()-tmpNode.jbtMethod.getElapsedClockStart();
+ if(tmpLong<0) return -1;
+ methodRunningTime=methodRunningTime- tmpLong;
+ tmpNode=tmpNode.right;
+ }
+ }
+ //if the node.left==null.Then the Running Time is just the total time.
+ return methodRunningTime;
+ }
+
+
+ public long getMethodCPUTime(){
+ long methodCPUTime=-1,tmpLong=0;
+ JBTTransactionTreeNode tmpNode;
+
+ if(this==null) {
+ return -1;
+ }
+
+ //to any method, whether it has exit should be judged
+ if(this.jbtMethod.getElapsedClockEnd()==-1){
+ return -1;
+ }
+
+ methodCPUTime=this.jbtMethod.getClockEnd()-this.jbtMethod.getClockStart();
+
+ if(this.left!=null){
+ tmpNode=this.left;
+
+ while(tmpNode!=null) {
+ if(tmpNode.jbtMethod.getClockEnd()==-1){
+ //this means this method has no exit, return -1
+ return -1;
+ }
+ //the current totalTime minus all
+ tmpLong=tmpNode.jbtMethod.getClockEnd()-tmpNode.jbtMethod.getClockStart();
+ if(tmpLong<0) return -1;
+ methodCPUTime=methodCPUTime- tmpLong;
+ tmpNode=tmpNode.right;
+ }
+ }
+ //if the node.left==null.Then the Running Time is just the total time.
+ return methodCPUTime;
+ }
+
+ /*this seems to be unneeded because the result can derive from
+ * JBTMethod. But in order to validate the data,this method is necessary. */
+ public long getTotalTime(){
+ if(this.jbtMethod.getElapsedClockEnd()==-1 || this.jbtMethod.getElapsedClockStart()==-1)
+ return -1;
+ else
+ return this.jbtMethod.getElapsedClockEnd()-this.jbtMethod.getElapsedClockStart();
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGraphCell.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGraphCell.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGraphCell.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,27 @@
+package org.jboss.profiler.tracerModel;
+import java.io.Serializable;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGraphCell implements Serializable{
+ public int idepth;
+ public int iseqnum;
+ public String strmethodName;
+ public long istarttime;
+ public long iendtime;
+ public int imethodorder;
+ public long methodrunningtime;
+
+ public String toString(){
+ String strret = "";
+ int index = strmethodName.lastIndexOf(".");
+ if(index >= 0){
+ strret = strmethodName.substring(index+1);
+ }
+ else{
+ strret = strmethodName;
+ }
+ return strret;
+ }
+}
\ No newline at end of file
Added: trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGroup.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGroup.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/tracerModel/UserGroup.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,397 @@
+package org.jboss.profiler.tracerModel;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.profiler.util.UserGroupUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class UserGroup {
+ public static String FULL = "fuLl";
+ public static String PACKAGE = "packAgE";
+ public static String CLASS = "cLAss";
+ public static String METHOD = "MethoD";
+ public static String PRIO_TAG = "priority";
+ public static String GROUP_NAME_TAG = "groupname";
+ public static String INCLUDE_FULL_TAG = "includefullcondition";
+ public static String INCLUDE_METHD_TAG ="includemethodcondition";
+ public static String INCLUDE_CLASS_TAG ="includeclasscondition";
+ public static String INCLUDE_PACKAGE_TAG ="includepackagecondition";
+ public static String EXCLUDE_FULL_TAG ="excludefullcondition";
+ public static String EXCLUDE_METHOD_TAG ="excludemethodcondition";
+ public static String EXCLUDE_CLASS_TAG ="excludeclasscondition";
+ public static String EXCLUDE_PACKAGE_TAG ="excludepackagecondition";
+
+ private String strGroupName;
+ private int ipriority;
+ private int igroupSeqNo = -1;
+ private String strifullcond;
+ private String strimethodcond;
+ private String stripackagecond;
+ private String striclasscond;
+ private String strefullcond;
+ private String strepackagecond;
+ private String streclasscond;
+ private String stremethodcond;
+
+ /**
+ * HashMap of references <key, value> :<String caller name , ArrayList callee names list >,this is used
+ * when grouping non-detail calling tree;
+ */
+ private HashMap methodRefMap = new LinkedHashMap();
+ /**
+ * records which member this group contains;
+ */
+ private ArrayList memberNames = new ArrayList();
+ private long grouprunningtime = -1;
+
+ public String propertiesToXML(){
+ String strXML = "";
+ strXML = "<"+this.GROUP_NAME_TAG+">"+this.strGroupName+"</"+this.GROUP_NAME_TAG+">\n"
+ +"<"+this.PRIO_TAG+">"+this.ipriority+"</"+this.PRIO_TAG+">\n"
+ //+"<groupseqnum>"+this.igroupSeqNo+"</groupseqnum>\n"
+ +"<"+this.INCLUDE_FULL_TAG+">"+this.strifullcond+"</"+this.INCLUDE_FULL_TAG+">\n"
+ +"<"+this.INCLUDE_PACKAGE_TAG+">"+this.stripackagecond+"</"+this.INCLUDE_PACKAGE_TAG+">\n"
+ +"<"+this.INCLUDE_CLASS_TAG+">"+this.striclasscond+"</"+this.INCLUDE_CLASS_TAG+">\n"
+ +"<"+this.INCLUDE_METHD_TAG+">"+this.strimethodcond+"</"+this.INCLUDE_METHD_TAG+">\n"
+ +"<"+this.EXCLUDE_FULL_TAG+">"+this.strefullcond+"</"+this.EXCLUDE_FULL_TAG+">\n"
+ +"<"+this.EXCLUDE_PACKAGE_TAG+">"+this.strepackagecond+"</"+this.EXCLUDE_PACKAGE_TAG+">\n"
+ +"<"+this.EXCLUDE_CLASS_TAG+">"+this.streclasscond+"</"+this.EXCLUDE_CLASS_TAG+">\n"
+ +"<"+this.EXCLUDE_METHOD_TAG+">"+this.stremethodcond+"</"+this.EXCLUDE_METHOD_TAG+">\n";
+ return strXML;
+ }
+
+ public String getsearchArea(){
+ String strRet = "";
+ if(!this.strifullcond.equals( "")||!this.strefullcond.equals("")){
+ strRet = "full";
+ }
+ else if(!this.stripackagecond.equals( "")||!this.strepackagecond.equals("")){
+ strRet = "package";
+ }
+ else if(!this.striclasscond.equals("") || !this.streclasscond.equals("")){
+ strRet = "class";
+ }
+ else if(!this.strimethodcond.equals("") || this.stremethodcond.equals("")){
+ strRet = "method";
+ }
+ return strRet;
+ }
+
+ public String getIncludeCondition(){
+ String strRet = "";
+ String strsearchArea = this.getsearchArea();
+ if(strsearchArea.equals("full")){
+ strRet = this.strifullcond;
+ }
+ else if(strsearchArea.equals("package")){
+ strRet = this.stripackagecond;
+ }
+ else if(strsearchArea.equals("class")){
+ strRet = this.striclasscond;
+ }
+ else if(strsearchArea.equals("method")){
+ strRet = this.strimethodcond;
+ }
+ return strRet;
+ }
+
+ public String getExcludeCondition(){
+ String strRet = "";
+ String strsearchArea = this.getsearchArea();
+ if(strsearchArea.equals("full")){
+ strRet = this.strefullcond;
+ }
+ else if(strsearchArea.equals("package")){
+ strRet = this.strepackagecond;
+ }
+ else if(strsearchArea.equals("class")){
+ strRet = this.streclasscond;
+ }
+ else if(strsearchArea.equals("method")){
+ strRet = this.stremethodcond;
+ }
+ return strRet;
+ }
+
+ public String conditionsToRegx(){
+ StringBuffer strmethodRegx = new StringBuffer("");
+ //currently assume the include and exclude are and relation, conditions between different search
+ //areas are and relation also;
+ if(!this.strimethodcond.equals("") || !this.stremethodcond.equals("")){
+ strmethodRegx.append("[method,");
+ if(!strimethodcond.equals("")){
+ strmethodRegx.append(strimethodcond);
+ }
+ if(!this.stremethodcond.equals("")){
+ strmethodRegx.append("&!("+stremethodcond+")");
+ }
+ strmethodRegx.append("]");
+ }
+
+ StringBuffer strclassRegx = new StringBuffer();
+ if(!this.striclasscond.equals("") || !this.streclasscond.equals("")){
+ strclassRegx.append("[class,");
+ if(!striclasscond.equals("")){
+ strclassRegx.append(striclasscond);
+ }
+ if(!streclasscond.equals("")){
+ strclassRegx.append("&!("+streclasscond+")");
+ }
+ strclassRegx.append("]");
+ }
+ StringBuffer strpackageRegx = new StringBuffer();
+ if(!this.stripackagecond.equals("") || !this.strepackagecond.equals("")){
+ strpackageRegx.append("[package,");
+ if(!stripackagecond.equals("")){
+ strpackageRegx.append(stripackagecond);
+ }
+ if(!strepackagecond.equals("")){
+ strpackageRegx.append("&!("+strepackagecond+")");
+ }
+ strpackageRegx.append("]");
+ }
+
+ StringBuffer strfullRegx = new StringBuffer();
+ if(!this.strifullcond.equals("") || !this.strefullcond.equals("")){
+ strfullRegx.append("[full,");
+ if(!strifullcond.equals("")){
+ strfullRegx.append(strifullcond);
+ }
+ if(!strefullcond.equals("")){
+ strfullRegx.append("&!("+strefullcond+")");
+ }
+ strfullRegx.append("]");
+ }
+ String strRegx = strmethodRegx.toString() + strclassRegx.toString() + strpackageRegx.toString() + strfullRegx.toString();
+ if(strRegx.length() == 0){
+ strRegx = "[full,!*]";
+ }
+ return strRegx;
+ }
+
+ public void paresNode(Node vnode){
+ this.strGroupName = this.getPropertyFromNode(vnode,"groupname");
+ this.strifullcond = this.getPropertyFromNode(vnode,"includefullcondition") ;
+ this.strimethodcond = this.getPropertyFromNode(vnode,"includemethodcondition");
+ this.stripackagecond = this.getPropertyFromNode(vnode,"includepackagecondition");
+ this.striclasscond = this.getPropertyFromNode(vnode,"includeclasscondition");
+ this.strefullcond = this.getPropertyFromNode(vnode,"excludefullcondition");
+ this.strepackagecond = this.getPropertyFromNode(vnode,"excludepackagecondition");
+ this.streclasscond = this.getPropertyFromNode(vnode,"excludeclasscondition");
+ this.stremethodcond = this.getPropertyFromNode(vnode,"excludemethodcondition");
+
+ this.strGroupName = this.strGroupName== null?"":this.strGroupName;
+ this.strifullcond = this.strifullcond==null?"":this.strifullcond;
+ this.strimethodcond = this.strimethodcond==null?"":this.strimethodcond;
+ this.stripackagecond = this.stripackagecond==null?"":this.stripackagecond;
+ this.striclasscond = this.striclasscond==null?"":this.striclasscond;
+ this.strefullcond = this.strefullcond==null?"":this.strefullcond;
+ this.strepackagecond = this.strepackagecond==null?"":this.strepackagecond;
+ this.streclasscond = this.streclasscond==null?"":this.streclasscond;
+ this.stremethodcond = this.stremethodcond==null?"":this.stremethodcond;
+
+ String strprio = this.getPropertyFromNode(vnode,"priority");
+ if(null != strprio){
+ this.ipriority = Integer.parseInt(strprio);
+ }
+ }
+
+ private String getPropertyFromNode(Node vnode, String vstrtagName){
+ String strRet = null;
+ Element curNode = (Element)vnode;
+ Element elem = (Element)(curNode.getElementsByTagName(vstrtagName).item(0));
+ if(null != elem){
+ Node elemTxt = elem.getFirstChild();
+ if(null != elemTxt){
+ strRet = elemTxt.getNodeValue();
+ }
+ }
+ return strRet;
+ }
+
+ private String processCondStr(String vstr){
+ String strret = null;
+ if(null != vstr && vstr.equals("-")){
+ strret = "";
+ }
+ else if(vstr == null){
+ strret = "";
+ }
+ else{
+ strret = vstr;
+ }
+ return strret;
+ }
+
+ public void parseString(String vstrcontent){
+ this.strGroupName = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.GROUP_NAME_TAG+">","</"+this.GROUP_NAME_TAG+">")[0];
+ String strprio = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.PRIO_TAG+">","</"+this.PRIO_TAG+">")[0];
+ this.ipriority = Integer.parseInt(strprio);
+ this.strifullcond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.INCLUDE_FULL_TAG+">","</"+this.INCLUDE_FULL_TAG+">")[0];
+ this.strimethodcond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.INCLUDE_METHD_TAG+">","</"+this.INCLUDE_METHD_TAG+">")[0];
+ this.striclasscond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.INCLUDE_CLASS_TAG+">","</"+this.INCLUDE_CLASS_TAG+">")[0];
+ this.stripackagecond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.INCLUDE_PACKAGE_TAG+">","</"+this.INCLUDE_PACKAGE_TAG+">")[0];
+ this.strefullcond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.EXCLUDE_FULL_TAG+">","</"+this.EXCLUDE_FULL_TAG+">")[0];
+ this.stremethodcond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.EXCLUDE_METHOD_TAG+">","</"+this.EXCLUDE_METHOD_TAG+">")[0];
+ this.streclasscond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.EXCLUDE_CLASS_TAG+">","</"+this.EXCLUDE_CLASS_TAG+">")[0];
+ this.strepackagecond = UserGroupUtil.getStringBetween(vstrcontent,"<"+this.EXCLUDE_PACKAGE_TAG+">","</"+this.EXCLUDE_PACKAGE_TAG+">")[0];
+ this.consolidate();
+ }
+
+ private void consolidate(){
+ String searcharea = this.getsearchArea();
+ String strinclude = "";
+ String strexclude = "";
+ if(searcharea.equals("full")){
+ strinclude = this.strifullcond;
+ strexclude = this.strefullcond;
+ this.clearConds();
+ this.strifullcond = strinclude;
+ this.strefullcond = strexclude;
+ }
+ else if(searcharea.equals("class")){
+ strinclude = this.striclasscond;
+ strexclude = this.streclasscond;
+ this.clearConds();
+ this.striclasscond = strinclude;
+ this.streclasscond = strexclude;
+ }
+ else if(searcharea.equals("package")){
+ strinclude = this.stripackagecond;
+ strexclude = this.strepackagecond;
+ this.clearConds();
+ this.stripackagecond = strinclude;
+ this.strepackagecond = strexclude;
+ }
+ else if(searcharea.equals("method")){
+ strinclude = this.strimethodcond;
+ strexclude = this.stremethodcond;
+ this.clearConds();
+ this.strimethodcond = strinclude;
+ this.stremethodcond = strexclude;
+ }
+ }
+
+ private void clearConds(){
+ this.striclasscond = "";
+ this.strifullcond = "";
+ this.strimethodcond = "";
+ this.stripackagecond = "";
+ this.streclasscond = "";
+ this.strefullcond = "";
+ this.stremethodcond = "";
+ this.strepackagecond = "";
+ }
+
+ public static ArrayList getAllTags(){
+ ArrayList array = new ArrayList();
+ array.add(INCLUDE_CLASS_TAG);
+ array.add(INCLUDE_FULL_TAG);
+ array.add(INCLUDE_METHD_TAG);
+ array.add(INCLUDE_PACKAGE_TAG);
+ array.add(EXCLUDE_CLASS_TAG);
+ array.add(EXCLUDE_METHOD_TAG);
+ array.add(EXCLUDE_FULL_TAG);
+ array.add(EXCLUDE_PACKAGE_TAG);
+ array.add(GROUP_NAME_TAG);
+ array.add(PRIO_TAG);
+ return array;
+ }
+
+
+ public HashMap getMethodRefMap() {
+ return methodRefMap;
+ }
+ public void setMethodRefMap(HashMap methodRefMap) {
+ this.methodRefMap = methodRefMap;
+ }
+ public String getStrGroupName() {
+ return strGroupName;
+ }
+ public void setStrGroupName(String strGroupName) {
+ this.strGroupName = strGroupName;
+ }
+ public int getIpriority() {
+ return ipriority;
+ }
+ public void setIpriority(int ipriority) {
+ this.ipriority = ipriority;
+ }
+ public int getIgroupSeqNo() {
+ return igroupSeqNo;
+ }
+ public void setIgroupSeqNo(int igroupSeqNo) {
+ this.igroupSeqNo = igroupSeqNo;
+ }
+ public String getStreclasscond() {
+ return streclasscond;
+ }
+ public void setStreclasscond(String streclasscond) {
+ this.streclasscond = this.processCondStr(streclasscond);
+ }
+ public String getStrefullcond() {
+ return strefullcond;
+ }
+ public void setStrefullcond(String strefullcond) {
+ this.strefullcond = this.processCondStr(strefullcond);
+ }
+ public String getStremethodcond() {
+ return stremethodcond;
+ }
+ public void setStremethodcond(String stremethodcond) {
+ this.stremethodcond = this.processCondStr(stremethodcond);
+ }
+ public String getStrepackagecond() {
+ return strepackagecond;
+ }
+ public void setStrepackagecond(String strepackagecond) {
+ this.strepackagecond = this.processCondStr(strepackagecond);
+ }
+ public String getStriclasscond() {
+ return striclasscond;
+ }
+ public void setStriclasscond(String striclasscond) {
+ this.striclasscond = this.processCondStr(striclasscond);
+ }
+ public String getStrifullcond() {
+ return strifullcond;
+ }
+ public void setStrifullcond(String strifullcond) {
+ this.strifullcond = this.processCondStr(strifullcond);
+ }
+ public String getStrimethodcond() {
+ return strimethodcond;
+ }
+ public void setStrimethodcond(String strimethodcond) {
+ this.strimethodcond = this.processCondStr(strimethodcond);
+ }
+ public String getStripackagecond() {
+ return stripackagecond;
+ }
+ public void setStripackagecond(String stripackagecond) {
+ this.stripackagecond = this.processCondStr(stripackagecond);
+ }
+ public ArrayList getMemberNames() {
+ return memberNames;
+ }
+ public void setMemberNames(ArrayList memberNames) {
+ this.memberNames = memberNames;
+ }
+ public long getGrouprunningtime() {
+ return grouprunningtime;
+ }
+ public void setGrouprunningtime(long grouprunningtime) {
+ this.grouprunningtime = grouprunningtime;
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/util/GroupMatcher.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/GroupMatcher.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/GroupMatcher.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,224 @@
+package org.jboss.profiler.util;
+
+import java.lang.String;
+import java.lang.StringBuilder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.lang.Character;
+
+import org.jboss.profiler.tracerModel.UserGroup;
+
+/**
+ * This class is to match the traced data according to the inputCondition and input search name.
+ * @author Huijuan Shao
+ */
+public class GroupMatcher{
+ private UserGroup userGroup;
+ private String inputSearchName;
+
+ public GroupMatcher(UserGroup userGroup,String inputSearchName){
+ this.userGroup=userGroup;
+ this.inputSearchName=inputSearchName;
+ }
+
+ /**this is used to match the whole of userGroup and the inputSearchName)*/
+ public boolean matches(){
+ boolean includeResult=true, excludeResult=false;
+ String showName=this.getShowName();
+ String includeCondition=userGroup.getIncludeCondition();
+ String excludeCondition=userGroup.getExcludeCondition();
+
+ if(includeCondition==null | includeCondition.equals("")){
+ //System.out.println("Include null! ");
+ includeResult=false;
+ }
+ else{
+ includeResult=this.matches(includeCondition,showName);
+ }
+
+ if(excludeCondition==null| excludeCondition.equals("")){
+ //System.out.println("Exclude null! ");
+ excludeResult=false;
+ }
+ else{
+ excludeResult=this.matches(excludeCondition,showName);
+ }
+
+ return includeResult&& (!excludeResult);
+
+ }
+
+ private boolean matches(String inputCondition,String inputSearchName){
+
+ if(GroupMatcher.isAndPatternStr(inputCondition))
+ return GroupMatcher.getAndResult(inputCondition,inputSearchName);
+ else if(GroupMatcher.isOrPatternStr(inputCondition))
+ return GroupMatcher.getOrResult(inputCondition,inputSearchName);
+ else{
+ System.out.println("Invalid search condition, input again!");
+ return false;
+ }
+ }
+
+ /**process whether the name startWith, endWith, include, exclude some the specified string
+ * eachStr example: '*abc*'
+ * @param subCondition, the unit condition of whole condition, the unit condition is conneted
+ * by AND or OR operations.
+ * @param name, the inputSearchName.
+ **/
+ private static boolean subMatch(String subCondition,String name){
+ boolean flag=false;
+ String str=new String(subCondition.substring(1,subCondition.length()-1));
+ //if there's no input
+ if(str.equals("")) return false;
+
+ if(str.equals("*")) return true;
+ if(str.equals("**"))return true;
+ if(str.equals("^^"))return false;
+
+
+ //exclude condition.^....^. It's important to the subString.
+ if(str.charAt(0)=='^')
+ if(name.contains(new String(str.substring(1,str.length()-1)))) flag=false;
+ else flag=true;
+
+ else if(str.charAt(0)=='*' && str.charAt(str.length()-1)=='*')
+ if(name.contains(new String(str.substring(1,str.length()-1)))) flag=true;
+ else flag=false;
+
+ else if(!(str.charAt(0)=='*')&& (str.charAt(str.length()-1)=='*'))
+ if(name.startsWith(new String(str.substring(0,str.length()-1)))) flag=true;
+ else flag=false;
+
+ else if(str.charAt(0)=='*' && !(str.charAt(str.length()-1)=='*'))
+ if(name.endsWith(new String(str.substring(1,str.length())))) flag=true;
+ else flag=false;
+
+ else //that
+ if(name.equals(str)) flag=true;
+ else flag=false;
+
+ return flag;
+ }
+
+ /**judge the inputString fits for the AND condtion or not.
+ * @para: input the pattern string
+ * @return: true if it is AND pattern.
+ * */
+ private static boolean isAndPatternStr(String inputStr){
+ boolean flag=false;
+ StringBuffer strBuff=new StringBuffer(inputStr);
+ strBuff.append('*');
+
+ //and pattern
+ String andPattern="(\\'([\\w|\\$|\\.|\\*|\\^]*)\\'\\*)*";
+ Pattern pattern=Pattern.compile(andPattern);
+ Matcher matcher=pattern.matcher(strBuff);
+ boolean isMatch = matcher.matches();
+ if(isMatch==false){
+ //System.out.println("The condition is NOT AND pattern.");
+ }
+ else {
+ //System.out.println("The condition is AND pattern.");
+ flag=true;
+ }
+ return flag;
+ }
+
+ /**judge the inputString fits for the OR condtion or not.
+ * @para: input the pattern string
+ * @return: true if it is OR pattern.
+ * */
+ private static boolean isOrPatternStr(String inputStr){
+ boolean flag=false;
+ StringBuffer strBuff=new StringBuffer(inputStr);
+ strBuff.append('+');
+
+ //and pattern
+ String andPattern="(\\'([\\w|\\$|\\.|\\*|\\^]*)\\'\\+)*";
+ Pattern pattern=Pattern.compile(andPattern);
+ Matcher matcher=pattern.matcher(strBuff);
+ boolean isMatch = matcher.matches();
+ if(isMatch==false){
+ System.out.println("The condition is NOT OR pattern.");
+ }
+ else {
+ //System.out.println("The condition is OR pattern.");
+ flag=true;
+ }
+ return flag;
+ }
+
+ /**This method is used to get matching result of inputStr and name.
+ * @para inputStr, the string input by the user.
+ * @para name, the package/class/method name to be matched.
+ * @return true if the condition is satisfied
+ * */
+ private static boolean getAndResult(String inputStr,String name){
+ //this AND pattern is for each group
+ String andPattern="\\'([\\w|\\$|\\.|\\*|\\^]*)\\'";
+ Matcher andMatcher=Pattern.compile(andPattern).matcher(inputStr);
+
+ String tmpStr=new String("");
+ while(andMatcher.find()){
+ tmpStr=andMatcher.group();
+ if(GroupMatcher.subMatch(tmpStr,name)==false) return false;
+ }
+ //System.out.println("And condition match!");
+ return true;
+ }
+
+ /**This method is used to get matching result of inputStr and name.
+ * @para inputStr, the string input by the user.
+ * @para name, the package/class/method name to be matched.
+ * @return true if the condition is satisfied
+ * */
+ private static boolean getOrResult(String inputStr,String name){
+ //this OR pattern is for each group
+ String andPattern="\\'([\\w|\\$|\\.|\\*|\\^]*)\\'";
+ Matcher andMatcher=Pattern.compile(andPattern).matcher(inputStr);
+
+ String tmpStr="";
+ while(andMatcher.find()){
+ tmpStr=andMatcher.group();
+ if(GroupMatcher.subMatch(tmpStr,name)==true) {
+ System.out.println("OR condition match!");
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**get theShowName according to the searchArea*/
+ private String getShowName(){
+ String strArea=this.userGroup.getsearchArea();
+ String vstrFullMethodName=this.inputSearchName;
+
+ String strshownName="";
+ if(strArea.equals("method")){
+ int index = vstrFullMethodName.lastIndexOf(".");
+ if(index > 0 ){
+ strshownName = vstrFullMethodName.substring(index+1, vstrFullMethodName.length());
+ }
+ else{
+ strshownName = vstrFullMethodName;
+ }
+ }
+ else if(strArea.equals("class")){
+ strshownName = GroupUtil.getClassNameFromMethodName(vstrFullMethodName);
+ int tmpIndex = strshownName.lastIndexOf(".");
+ if(tmpIndex >= 0){
+ strshownName = strshownName.substring(tmpIndex+1,strshownName.length());
+ }
+ }
+ else if(strArea.equals("package")){
+ strshownName = GroupUtil.getPackageNameFromMethodName(vstrFullMethodName);
+ }
+ else if(strArea.equals("full")){
+ strshownName = vstrFullMethodName;
+ }
+ return strshownName;
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/util/GroupUtil.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/GroupUtil.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/GroupUtil.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,402 @@
+package org.jboss.profiler.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import org.jboss.profiler.model.JBPMethod;
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.GroupGraphReference;
+import org.jboss.profiler.tracerModel.JBTMethod;
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+import org.jboss.profiler.util.CompareMethods;
+
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+
+/**
+ * This class is for grouping the traced data.
+ * @author Huijuan Shao
+ */
+public class GroupUtil {
+
+ /** group by method but not class/package etc
+ * @param input one JBTTransactionTree, then the grouped methods' relationship returns.
+ * */
+ public GroupGraphCallings generateCallings(JBTTransactionTree tree) {
+ int groupID = 0;
+ ArrayList arrayGroups = new ArrayList();
+ ArrayList arrayRefs = new ArrayList();
+
+ GroupGraphCallings graph = new GroupGraphCallings();
+
+ ArrayList treeArrayList = tree.traverseGetArrayList();
+
+ for (int i = 0; i < treeArrayList.size(); i++) {
+ JBTTransactionTreeNode currentNode = (JBTTransactionTreeNode) treeArrayList.get(i);
+
+ StringBuffer groupName = new StringBuffer();
+ groupName.append(currentNode.getName());
+ if (i == 0) {
+ groupID = 0;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup.setLevel(currentNode.getJBTMethod().getDepth());
+ newGroup.setRunningTime(currentNode.getMethodRunningTime());
+
+ newGroup.setTotalTime(currentNode.getTotalTime());
+ newGroup.setCounts(1);
+ newGroup.setTotalCPUTime(currentNode.getMethodCPUTime());
+ newGroup.setName(groupName.toString());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ } else {
+ int calledID = 0;
+ int currentGroupSize = arrayGroups.size();
+ for (int j = 0; j < currentGroupSize; j++) {
+ GroupGraphGroup existGroup = (GroupGraphGroup) arrayGroups
+ .get(j);
+ if ((existGroup.getGroupName())
+ .equals(groupName.toString())) {
+ calledID = existGroup.getGroupID();
+ existGroup.setCounts(existGroup.getCounts() + 1);
+ existGroup.setRunningTime(existGroup.getRunningTime()
+ + currentNode.getMethodRunningTime());
+
+ existGroup.setTotalTime(currentNode.getTotalTime()
+ + existGroup.getTotalTime());
+ existGroup.setTotalCPUTime(existGroup.getTotalCPUTime()
+ + currentNode.getMethodCPUTime());
+ existGroup.addMethodList(new Integer(i));
+ if (existGroup.getLevel() > currentNode.getJBTMethod()
+ .getDepth())
+ existGroup.setLevel(currentNode.getJBTMethod()
+ .getDepth());
+ arrayGroups.set(j, existGroup);
+ break;
+ }
+ if (j == (currentGroupSize - 1)) {
+ groupID += 1;
+ calledID = groupID;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup
+ .setLevel(currentNode.getJBTMethod().getDepth());
+ newGroup.setRunningTime(currentNode
+ .getMethodRunningTime());
+
+ newGroup.setTotalTime(currentNode.getTotalTime());
+ newGroup.setCounts(1);
+ newGroup
+ .setTotalCPUTime(currentNode.getMethodCPUTime());
+ newGroup.setName(groupName.toString());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ }
+ }
+
+ /**
+ * add references between groups,I
+ * simplely pasted the same code in anothoer
+ * generateCallings(...)
+ */
+ int calleeID = getCalleeGroupID(i, treeArrayList, arrayGroups);
+
+ if (i == 1) {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ }
+ else {
+ int currentRefSize = arrayRefs.size();
+ int k = 0;
+ for (; k < currentRefSize; k++) {
+ GroupGraphReference existRef = (GroupGraphReference) arrayRefs.get(k);
+ if ((existRef.getGroupCallee() == calleeID)
+ && (existRef.getGroupCalled() == calledID)){
+ break;
+ }
+ }
+ if (k == currentRefSize) {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ }
+ }
+ }// end of else
+ }// end of for
+
+ graph.setGroups(arrayGroups);
+ graph.setReferences(arrayRefs);
+ graph.setStrgroupType("method");
+ //graph.printDebug();
+ return graph;
+ }
+
+ /**
+ * @param spyMethods
+ * @param tree, the input tree
+ * @param group, the group classification, by class or package
+ */
+ public GroupGraphCallings generateCallings(HashMap spyMethods,
+ JBTTransactionTree tree, String group) {
+ int groupID = 0;
+ ArrayList arrayGroups = new ArrayList();
+ ArrayList arrayRefs = new ArrayList();
+
+ GroupGraphCallings graph = new GroupGraphCallings();
+
+ ArrayList treeArrayList = tree.traverseGetArrayList();
+
+ long wholeTime = 1;
+
+ for (int i = 0; i < treeArrayList.size(); i++) {
+
+ JBTTransactionTreeNode currentNode = (JBTTransactionTreeNode) treeArrayList
+ .get(i);
+
+ if (i == 0)
+ wholeTime = currentNode.getJBTMethod().getElapsedClockEnd()
+ - currentNode.getJBTMethod().getElapsedClockStart();
+
+ String className = "";
+ Iterator iter = spyMethods.values().iterator();
+ while (iter.hasNext()) {
+ JBPMethod spyMethod = (JBPMethod) iter.next();
+ if (spyMethod.getMethodID() == currentNode.getJBTMethod()
+ .getMethodID()) {
+ className = spyMethod.getSpyClass().getName();
+ break;
+ }
+ }
+
+ StringBuffer groupName = new StringBuffer();
+ groupName.append(className);
+ StringBuffer shownName = new StringBuffer();
+ shownName.append(className);
+
+ SPYGroupNameConvert.convertGroupName(group, groupName, shownName);
+
+ if (i == 0) {
+ groupID = 0;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup.setLevel(currentNode.getJBTMethod().getDepth());
+ newGroup.setRunningTime(currentNode.getMethodRunningTime());
+ newGroup.setTotalTime(currentNode.getTotalTime());
+ newGroup.setCounts(1);
+ newGroup.setTotalCPUTime(currentNode.getMethodCPUTime());
+ newGroup.setName(shownName.toString());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ } else {
+ int calledID = 0;
+ int currentGroupSize = arrayGroups.size();
+ for (int j = 0; j < currentGroupSize; j++) {
+ GroupGraphGroup existGroup = (GroupGraphGroup) arrayGroups
+ .get(j);
+ if ((existGroup.getGroupName())
+ .equals(groupName.toString())) {
+ calledID = existGroup.getGroupID();
+ existGroup.setCounts(existGroup.getCounts() + 1);
+ existGroup.setRunningTime(existGroup.getRunningTime()
+ + currentNode.getMethodRunningTime());
+ existGroup.setTotalTime(currentNode.getTotalTime()
+ + existGroup.getTotalTime());
+ existGroup.setTotalCPUTime(existGroup.getTotalCPUTime()
+ + currentNode.getMethodCPUTime());
+ existGroup.addMethodList(new Integer(i));
+ if (existGroup.getLevel() > currentNode.getJBTMethod()
+ .getDepth())
+ existGroup.setLevel(currentNode.getJBTMethod()
+ .getDepth());
+ arrayGroups.set(j, existGroup);
+ break;
+ }
+ if (j == (currentGroupSize - 1)) {
+ groupID += 1;
+ calledID = groupID;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup
+ .setLevel(currentNode.getJBTMethod().getDepth());
+ newGroup.setRunningTime(currentNode
+ .getMethodRunningTime());
+ newGroup.setTotalTime(currentNode.getTotalTime());
+ newGroup.setCounts(1);
+ newGroup
+ .setTotalCPUTime(currentNode.getMethodCPUTime());
+ newGroup.setName(shownName.toString());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ }
+ }
+
+ int calleeID = getCalleeGroupID(i, treeArrayList, arrayGroups);
+
+ if (i == 1) {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ } else {
+ int currentRefSize = arrayRefs.size();
+ for (int k = 0; k < currentRefSize; k++) {
+ GroupGraphReference existRef = (GroupGraphReference) arrayRefs
+ .get(k);
+ if ((existRef.getGroupCallee() == calleeID)
+ && (existRef.getGroupCalled() == calledID))
+ break;
+ if (k == (currentRefSize - 1)) {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ }
+ }
+ }
+
+ }
+ // for debug
+ // System.out.println("\n---Processing methodID: " + i + "---");
+ graph.setGroups(arrayGroups);
+ graph.setReferences(arrayRefs);
+ //graph.printDebug();
+ }
+
+ String tmpName;
+ float percentage;
+ String percentage1;
+ for (int k = 0; k < arrayGroups.size(); k++) {
+ GroupGraphGroup tmpGroup = (GroupGraphGroup) arrayGroups.get(k);
+ percentage = (float) tmpGroup.getRunningTime() / wholeTime * 100;
+ percentage1 = "" + percentage;
+ tmpName = tmpGroup.getName()
+ + " "
+ + percentage1
+ .substring(0,
+ percentage1.length() < 5 ? percentage1
+ .length() : 5) + "%";
+ tmpGroup.setName(tmpName);
+ }
+
+ TreeSet treeSet = new TreeSet(new CompareMethods());
+ treeSet.addAll(arrayGroups);
+
+ ArrayList listGroups = new ArrayList();
+ listGroups.addAll(treeSet);
+
+ graph.setGroups(listGroups);
+ graph.setReferences(arrayRefs);
+ graph.setStrgroupType(group);
+ // graph.printDebug();
+ return graph;
+ }
+
+ private int getCalleeGroupID(int methodNum, ArrayList treeNodes,
+ ArrayList arrayGroups) {
+
+ JBTTransactionTreeNode calledMethod = (JBTTransactionTreeNode) treeNodes
+ .get(methodNum);
+
+ int i;
+ for (i = (methodNum - 1); i >= 0; i--) {
+
+ JBTTransactionTreeNode calleeMethod = (JBTTransactionTreeNode) treeNodes
+ .get(i);
+ if ((calledMethod.getJBTMethod().getDepth() - 1) == calleeMethod
+ .getJBTMethod().getDepth())
+ break;
+ }
+
+ for (int j = 0; j < arrayGroups.size(); j++) {
+ GroupGraphGroup existGroup = (GroupGraphGroup) arrayGroups.get(j);
+ ArrayList methodList = existGroup.getMethodList();
+ if (methodList.contains(new Integer(i))) {
+ return existGroup.getGroupID();
+ }
+ }
+ return (-1);
+ }
+
+ // Clean up resources
+ public void destroy() {
+ }
+
+ /**
+ * @param retrieves full package name from full method name,"default" will be return
+ * if the method is in default package;
+ */
+ public static String getPackageNameFromMethodName(String vstrMethodName) {
+ if (null == vstrMethodName) {
+ return null;
+ }
+
+ String strRet = null;
+ String strClassName = null;
+ int index = vstrMethodName.lastIndexOf(".");
+ if (index != -1) {
+ strClassName = vstrMethodName.substring(0, index);
+ }
+
+ index = strClassName.lastIndexOf(".");
+ if (index != -1) {
+ strRet = strClassName.substring(0, index);
+ }else {
+ strRet = "default";
+
+ }
+
+ return strRet;
+ }
+
+ /**
+ * @param retrieves full class name from full method name
+ */
+ public static String getClassNameFromMethodName(String vstrMethodName) {
+ if (null == vstrMethodName) {
+ return null;
+ }
+ String strClassName = null;
+ int index = vstrMethodName.lastIndexOf(".");
+ if (index != -1) {
+ strClassName = vstrMethodName.substring(0, index);
+ }
+ return strClassName;
+ }
+
+ /**
+ * @param vstrOrig
+ * @return converts special HTML reserved characters to HTML entities this
+ * is a simple converter can convert '<', '>', '&', '"'
+ */
+ public static String convertToHTML(String vstrOrig) {
+ if(vstrOrig == null)
+ return null;
+ String strResult = vstrOrig.replaceAll("&", "&");
+ strResult = strResult.replaceAll("<", "<");
+ strResult = strResult.replaceAll("\"", """);
+ strResult = strResult.replaceAll(">", ">");
+
+ return strResult;
+ }
+}
+
+class CompareMethods implements java.util.Comparator {
+ public int compare(Object left, Object right) {
+ int iret = ((GroupGraphGroup) left).getLevel()
+ - ((GroupGraphGroup) right).getLevel();
+ if (iret > 0)
+ return 1;
+ else
+ return -1;
+ }
+
+}
Added: trunk/java/src/engine/org/jboss/profiler/util/SPYGroupComparator.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/SPYGroupComparator.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/SPYGroupComparator.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,103 @@
+package org.jboss.profiler.util;
+
+import java.util.*;
+
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.JBTMethod;
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+
+/**
+ * @author Huijuan Shao
+ */
+public class SPYGroupComparator implements Comparator{
+ public static String sort;
+ private String order;
+
+ public SPYGroupComparator(String order){
+ this.order=order;
+ }
+
+ public int compare(Object obj1, Object obj2){
+ GroupGraphGroup group1=(GroupGraphGroup)obj1;
+ GroupGraphGroup group2=(GroupGraphGroup)obj2;
+
+ long tmp;
+ float tmp1;
+
+ int ret=0;
+ //sort according to depth
+ if(order.equals("ExecutedCount")){
+ ret= group2.getCounts()-group1.getCounts();
+ }
+ //sort acoording to start time
+ else if(order.equals("TotalCPUTime")){
+ tmp=group2.getTotalCPUTime()-group1.getTotalCPUTime();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ // sort according to end time
+ else if(order.equals("AverageCPUTime")){
+ tmp1=(float)group2.getTotalCPUTime()/group2.getCounts()-(float)group1.getTotalCPUTime()/group1.getCounts();
+ if(tmp1>=0) ret=100;
+ else ret=-100;
+ }
+ //sort according to total time
+ else if(order.equals("TotalRunningTime")){
+ long totalTime1=group1.getRunningTime();
+ long totalTime2=group2.getRunningTime();
+
+ if (totalTime1>= 0 && totalTime2 >= 0){
+ tmp=totalTime2-totalTime1;
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ else if(totalTime1<0 && totalTime2 >= 0)
+ //this means the end time of treeNode2 is UNKNOWN, suppose totalTime2 is bigger than totalTime1
+ ret=100;
+ else if(totalTime1 >= 0 && totalTime2 < 0)
+ //this means the the end of treeNode1 is UNKNOWN, suppose totalTime1 is bigger than totalTime2
+ ret=-100;
+ }
+ else if(order.equals("TotalTime")){
+ long totalTime1=group1.getTotalTime();
+ long totalTime2=group2.getTotalTime();
+
+ if (totalTime1>= 0 && totalTime2 >= 0){
+ tmp=totalTime2-totalTime1;
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ else if(totalTime1<0 && totalTime2 >= 0)
+ //this means the end time of treeNode2 is UNKNOWN, suppose totalTime2 is bigger than totalTime1
+ ret=100;
+
+ else if(totalTime1 >= 0 && totalTime2 < 0)
+ //this means the the end of treeNode1 is UNKNOWN, suppose totalTime1 is bigger than totalTime2
+ ret=-100;
+ }
+ //sort according to average total time
+ else if(order.equals("AverageRunningTime")){
+ float avgTotalTime1=(float)group1.getRunningTime() / group1.getCounts();
+ float avgTotalTime2=(float)group2.getRunningTime() / group2.getCounts();
+
+ if (avgTotalTime1>= 0.0f && avgTotalTime2 >= 0.0f){
+ tmp1=avgTotalTime2-avgTotalTime1;
+ if(tmp1>=0.0f) ret=100;
+ else ret=-100;
+ }
+ else if(avgTotalTime1<0.0f && avgTotalTime2 >= 0.0f){
+ //this means the end time of treeNode2 is UNKNOWN, suppose totalTime2 is bigger than totalTime1
+ ret=100;
+ }
+ else if(avgTotalTime1 >= 0.0f && avgTotalTime2 < 0.0f){
+ //this means the the end of treeNode1 is UNKNOWN, suppose totalTime1 is bigger than totalTime2
+ ret=-100;
+ }
+ }
+ if (sort.equals("up")) ret = -ret;
+ //this means m1 is smaller
+ //if the m1=m2, we think according to the traced methods,the first one is still smaller.
+ if(ret>=0) return -1;
+ else return 1;
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/util/SPYGroupNameConvert.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/SPYGroupNameConvert.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/SPYGroupNameConvert.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,42 @@
+package org.jboss.profiler.util;
+
+/**
+ * @author Huijuan Shao
+ */
+public class SPYGroupNameConvert {
+ /**
+ *
+ * @param group:
+ * A flag with the value of either "class" or "package"
+ * @param groupName:
+ * The original group name (for this method the group name should
+ * be the full class name)
+ * @param shownName
+ */
+ public static void convertGroupName(String group, StringBuffer groupName,
+ StringBuffer shownName) {
+ int lastPeriod = groupName.lastIndexOf(".");
+ if (lastPeriod != -1) {
+ if (group.equals("class")) {
+ shownName.delete(0, lastPeriod + 1);
+ }
+ else {// in case of "package"
+ groupName.delete(lastPeriod, groupName.length());
+ shownName.delete(lastPeriod, shownName.length());
+ lastPeriod = groupName.lastIndexOf(".");
+ if (lastPeriod != -1) {
+ shownName.delete(0, lastPeriod + 1);
+ }
+ }
+ }
+ // if there's no package name, use "default" as package name
+ else {
+ if(!group.equals("class")){
+ groupName.delete(0,groupName.length());
+ shownName.delete(0,shownName.length());
+ groupName.append("default");
+ shownName.append("default");
+ }
+ }
+ }
+}
Added: trunk/java/src/engine/org/jboss/profiler/util/SPYJBTMethodComparator.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/SPYJBTMethodComparator.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/SPYJBTMethodComparator.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,38 @@
+package org.jboss.profiler.util;
+
+import java.util.*;
+
+import org.jboss.profiler.tracerModel.JBTMethod;
+
+/**
+ * @author Huijuan Shao
+ */
+public class SPYJBTMethodComparator implements Comparator{
+ private String order;
+
+ public SPYJBTMethodComparator(String order){
+ this.order=order;
+ }
+
+ public int compare(Object obj1, Object obj2){
+ JBTMethod m1=(JBTMethod)obj1;
+ JBTMethod m2=(JBTMethod)obj2;
+
+ int ret=0;
+
+ if(order.equals("Depth")){
+ ret= m2.getDepth()-m1.getDepth();
+ }
+ else if(order.equals("Start time")){
+ long tmp;
+ tmp=m2.getElapsedClockStart()-m1.getElapsedClockStart();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+
+ //this means m1 is smaller
+ //if the m1=m2, according to the traced methods,the first one is still smaller.
+ if(ret>=0) return -1;
+ else return 1;
+ }
+}
\ No newline at end of file
Added: trunk/java/src/engine/org/jboss/profiler/util/SPYTreeNodeComparator.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/SPYTreeNodeComparator.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/SPYTreeNodeComparator.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,104 @@
+package org.jboss.profiler.util;
+
+import java.util.*;
+
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+
+/**
+ * @author Huijuan Shao
+ */
+public class SPYTreeNodeComparator implements Comparator{
+ public static String sort;
+
+ private String order;
+
+ public SPYTreeNodeComparator(String order){
+ this.order=order;
+ }
+
+ public int compare(Object obj1, Object obj2){
+ JBTTransactionTreeNode node1=(JBTTransactionTreeNode)obj1;
+ JBTTransactionTreeNode node2=(JBTTransactionTreeNode)obj2;
+
+ long tmp;
+
+ int ret=0;
+ //sort according to depth
+ if(order.equals("Depth")){
+ ret= node2.getJBTMethod().getDepth()-node1.getJBTMethod().getDepth();
+ }
+ //sort acoording to start time
+ else if(order.equals("StartTime")){
+
+ tmp=node2.getJBTMethod().getElapsedClockStart()-node1.getJBTMethod().getElapsedClockStart();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ // sort according to end timeimport org.jboss.profiler.tracerModel.JBTMethod;
+ else if(order.equals("EndTime")){
+ tmp=node2.getJBTMethod().getElapsedClockEnd()-node1.getJBTMethod().getElapsedClockEnd();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ //sort according to total time
+ else if(order.equals("TotalTime")){
+ long endTime1=node1.getJBTMethod().getElapsedClockEnd();
+ long endTime2=node2.getJBTMethod().getElapsedClockEnd();
+
+ if (endTime1!=-1 && endTime2!=-1)
+ {
+ long totalTime1= node1.getJBTMethod().getElapsedClockEnd()- node1.getJBTMethod().getElapsedClockStart();
+ long totalTime2 = node2.getJBTMethod().getElapsedClockEnd()- node2.getJBTMethod().getElapsedClockStart();
+ tmp=totalTime2-totalTime1;
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ else if(endTime1==-1 && endTime2!=-1){
+ //this means the end time of treeNode2 is UNKNOWN, suppose totalTime2 is bigger than totalTime1
+ ret=100;
+ }
+ else if(endTime1!=-1 && endTime2==-1){
+ //this means the the end of treeNode1 is UNKNOWN, suppose totalTime1 is bigger than totalTime2
+ ret=-100;
+ }
+ }else if(order.equals("MethodRunningTime")){
+ long mrt1=node1.getMethodRunningTime();
+ long mrt2=node2.getMethodRunningTime();
+ if (mrt1!=-1 && mrt2!=-1)
+ {
+ tmp=node2.getMethodRunningTime()-node1.getMethodRunningTime();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+ else if(mrt1==-1 && mrt2!=-1){
+ //this means the end time of treeNode2 is UNKNOWN, suppose totalTime2 is bigger than totalTime1
+ ret=100;
+ }
+ else if(mrt1!=-1 && mrt2==-1){
+ //this means the the end of treeNode1 is UNKNOWN, suppose totalTime1 is bigger than totalTime2
+ ret=-100;
+ }
+ }else if(order.equals("CPUTime")){
+ tmp=( node2.getJBTMethod().getClockEnd()-node2.getJBTMethod().getClockStart())
+ -(node1.getJBTMethod().getClockEnd()-node1.getJBTMethod().getClockStart());
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }else if(order.equals("#Locks")){
+ tmp= node2.getJBTMethod().getNumberOfLocks()-node1.getJBTMethod().getNumberOfLocks();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ } else if (order.equals("LockTime")){
+ tmp=node2.getJBTMethod().getLockTime()-node1.getJBTMethod().getLockTime();
+ if(tmp>=0) ret=100;
+ else ret=-100;
+ }
+
+
+ if (sort.equals("up")) ret = -ret;
+
+ if(ret>=0) return -1;
+
+ else return 1;
+}
+
+}
\ No newline at end of file
Added: trunk/java/src/engine/org/jboss/profiler/util/UserGroupUtil.java
===================================================================
--- trunk/java/src/engine/org/jboss/profiler/util/UserGroupUtil.java (rev 0)
+++ trunk/java/src/engine/org/jboss/profiler/util/UserGroupUtil.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,97 @@
+package org.jboss.profiler.util;
+
+import java.util.ArrayList;
+import java.util.Stack;
+
+import org.jboss.profiler.tracerModel.UserGroup;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGroupUtil {
+
+ public static ArrayList parse(String vstrcontent){
+
+ if(!validate(vstrcontent)){
+ return null;
+ }
+ ArrayList usrgroupList = null;
+ String[] strgroup = getStringBetween(vstrcontent, "<group>","</group>");
+ if(strgroup == null || strgroup.length == 0){
+ return null;
+ }
+ String[] strgroupinfos = getStringBetween(strgroup[0],"<groupinfo>","</groupinfo>");
+ int ilen = 0;
+ if(strgroupinfos != null){
+ ilen = strgroupinfos.length;
+ usrgroupList = new ArrayList();
+ }
+ for(int i=0; i<ilen; i++){
+ UserGroup usrgroup = new UserGroup();
+ usrgroup.setIgroupSeqNo(i);
+ usrgroup.parseString(strgroupinfos[i]);
+ usrgroupList.add(usrgroup);
+ }
+ return usrgroupList;
+ }
+
+ public static String[] getStringBetween(String vstrcontent, String vstrleft, String vstrright){
+ int ileft = 0;
+ int iright = 0;
+ String strret = null;
+ String strcontent = vstrcontent;
+ ArrayList strings = new ArrayList();
+ while(ileft >= 0 && iright >=0){
+ ileft = strcontent.indexOf(vstrleft);
+ iright = strcontent.indexOf(vstrright);
+ if(ileft < 0 || iright < 0){
+ break;
+ }
+ if(ileft>iright){
+ int tmp = ileft;
+ ileft = iright;
+ iright = tmp;
+ }
+ strret = strcontent.substring(ileft+vstrleft.length(),iright);
+ strcontent = strcontent.substring(iright+vstrright.length());
+ strings.add(strret.trim());
+ }
+ String[] stringsret = new String[strings.size()];
+ strings.toArray(stringsret);
+ return stringsret;
+ }
+
+ public static boolean validate(String vstrcontent){
+ Stack tmpStack = new Stack();
+ ArrayList array = UserGroup.getAllTags();
+ array.add("group");
+ array.add("groupinfo");
+ String[] str = getStringBetween(vstrcontent,"<",">");
+ int ilen = 0;
+ if(str != null){
+ ilen = str.length;
+ }
+ for(int i=0; i<ilen; i++){
+ String tmpstr = null;
+ if(!str[i].trim().startsWith("/")){
+ if(array.contains(str[i].trim())){
+ tmpStack.push(str[i].trim());
+ }
+ }
+ else{
+ tmpstr = str[i].trim().substring(1);
+ String strontop = (String)tmpStack.peek();
+ if(array.contains(tmpstr)){
+ if(!tmpstr.equals(strontop)){
+ return false;
+ }
+ else{
+ tmpStack.pop();
+ }
+ }
+ }
+ }
+ boolean ret = tmpStack.isEmpty();
+ return ret;
+ }
+}
Added: trunk/java/src/tests/TestDefaultPackage.java
===================================================================
--- trunk/java/src/tests/TestDefaultPackage.java (rev 0)
+++ trunk/java/src/tests/TestDefaultPackage.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,37 @@
+/**
+ * @author Huijuan Shao
+ * this class is the test case for all default package situation when using package applet
+ * please run it like:
+ * java -XrunjbossInspector:/tmp,wakeupOnStartup=true TestDefaultPackage
+ */
+
+public class TestDefaultPackage {
+
+ public int multiply(int x, int y)
+ {
+ return x*y;
+ }
+ public int doMutiply(int x, int y)
+ {
+ for(int i=0;i<10000;i++)
+ {
+ x+=i;
+ }
+ return this.multiply(x,y);
+ }
+ public void startTest(int x, int y)
+ {
+ this.doMutiply(x, y);
+ }
+ public static void main(String[] args) {
+ long i = 0;
+ TestDefaultPackage tdp = new TestDefaultPackage();
+ while(i++<10)
+ {
+
+ tdp.startTest(1,2);
+
+ }
+ }
+
+}
Added: trunk/java/src/tests/TestPackageAndDefaultPackage.java
===================================================================
--- trunk/java/src/tests/TestPackageAndDefaultPackage.java (rev 0)
+++ trunk/java/src/tests/TestPackageAndDefaultPackage.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,38 @@
+/**
+ * @author Huijuan Shao
+ *this class is for testing package applet under the situation that
+ *default package and none-default packages show in the applet
+ *simultaneously
+ *please run it like:
+ * java -XrunjbossInspector:/tmp,wakeupOnStartup=true TestPackageAndDefaultPackage
+ */
+public class TestPackageAndDefaultPackage {
+
+ public int multiply(int x, int y)
+ {
+ return x*y;
+ }
+
+ public int doMutiply(int x, int y)
+ {
+ for(int i=0;i<10000;i++)
+ {
+ x+=i;
+ }
+ return this.multiply(x,y);
+ }
+
+ public void startTest(int x, int y)
+ {
+ this.doMutiply(x, y);
+ }
+
+ public static void main(String[] args) {
+ long i = 0;
+ TestPackageAndDefaultPackage tdp = new TestPackageAndDefaultPackage();
+ while(i++<10){
+ tdp.startTest(1,2);
+ }
+ System.out.println("test finished!");
+ }
+}
\ No newline at end of file
Added: trunk/java/src/web/org/jboss/profiler/web/form/TracerFilterForm.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/form/TracerFilterForm.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/form/TracerFilterForm.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,80 @@
+package org.jboss.profiler.web.form;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import org.apache.struts.action.ActionForm;
+import org.jboss.profiler.tracerModel.JBTTransaction;
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class TracerFilterForm extends ActionForm {
+
+ private JBTTransactionTree transactionTree;
+
+ private JBTTransactionTree jbtTransactionTree;
+
+ /**
+ *
+ * @return jbtTransactionTree
+ */
+ public JBTTransactionTree getJbtTransactionTree(){
+ return this.jbtTransactionTree;
+ }
+
+ /**
+ *
+ * @param jbtTransactionTree
+ */
+ public void setJbtTransactionTree(JBTTransactionTree jbtTransactionTree){
+ this.jbtTransactionTree=jbtTransactionTree;
+ }
+
+ private Integer tracedTransactionID;
+ /**
+ * @return Returns the tracedTransactionID
+ */
+ public Integer getTracedTransactionID(){
+ return this.tracedTransactionID;
+ }
+
+ public void setTracedTransactionID(Integer transactionID){
+ this.tracedTransactionID=transactionID;}
+
+ private JBTTransactionTreeNode startMethodNode;
+ /**
+ *
+ * @return startMethodNode
+ */
+ public JBTTransactionTreeNode getStartMethodNode(){
+ return this.startMethodNode;
+ }
+
+ public void setStartMethodNode(JBTTransactionTreeNode firstNode){
+ this.startMethodNode=firstNode;
+ }
+
+ private String startMethodName;
+ public String getStartMethodName(){
+ return this.startMethodNode.getName();
+ }
+
+ private Date startMethodStartTime;
+ public Date getStartMethodStartTime(){
+ Date date1 = new Date (this.getStartMethodNode().getJBTMethod().getElapsedClockStart());
+ //DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ return date1;
+ }
+
+ private Date startMethodEndTime;
+ public Date getStartMethodEndTime(){
+ Date date1 = new Date (this.getStartMethodNode().getJBTMethod().getElapsedClockEnd());
+ //DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ return date1;
+ }
+
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServer.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServer.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServer.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,80 @@
+package org.jboss.profiler.web.servlets;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.model.JBPClass;
+import org.jboss.profiler.model.JBPProcess;
+import org.jboss.profiler.model.JBPMethod;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.GroupGraphReference;
+import org.jboss.profiler.tracerModel.JBTMethod;
+import org.jboss.profiler.tracerModel.JBTTransaction;
+
+import org.jboss.profiler.util.SPYGroupNameConvert;
+import org.jboss.profiler.util.GroupUtil;
+import org.jboss.profiler.web.form.TracerFilterForm;
+
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+public class GroupGraphServer extends HttpServlet {
+ private static final String CONTENT_TYPE = "application/javaObject";
+
+ private static final boolean printOut = true;
+
+ //Initialize global variables
+ public void init() throws ServletException {
+ }
+
+ //Process the HTTP Get request
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ try {
+ response.setContentType(CONTENT_TYPE);
+ response.setHeader("pragma", "no-cache");
+
+ org.jboss.profiler.web.form.FilterForm beanFilter
+ = (org.jboss.profiler.web.form.FilterForm) request.getSession().getAttribute("filterForm");
+
+ TracerFilterForm tracerBeanFilter= (TracerFilterForm) request.getSession().getAttribute("tracerFilterForm");
+
+ org.jboss.profiler.model.JBPProcess spyProcess = beanFilter.getJbpProcess();
+ HashMap spyMethods = spyProcess.getSpyMethods();
+ HashMap searchedTransactions = beanFilter.getSearchedTransactions();
+
+ String group = request.getParameter("group");
+ Integer transactionID = new Integer(request.getParameter("transactionID"));
+ JBTTransaction keyTransaction = new JBTTransaction();
+ Iterator iter = searchedTransactions.values().iterator();
+ while (iter.hasNext())
+ {
+ keyTransaction = (JBTTransaction) iter.next();
+ if (keyTransaction.getTransactionID()==transactionID.intValue())
+ break;
+ }
+
+ GroupUtil util=new GroupUtil();
+ GroupGraphCallings graph=util.generateCallings(spyMethods,tracerBeanFilter.getJbtTransactionTree(),group);
+
+ java.io.ObjectOutputStream outObj = new java.io.ObjectOutputStream(
+ response.getOutputStream());
+ outObj.writeObject(graph);
+ outObj.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServerTest.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServerTest.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/GroupGraphServerTest.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,250 @@
+package org.jboss.profiler.web.servlets;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.model.JBPClass;
+import org.jboss.profiler.model.JBPProcess;
+import org.jboss.profiler.model.JBPMethod;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.GroupGraphGroup;
+import org.jboss.profiler.tracerModel.GroupGraphReference;
+import org.jboss.profiler.tracerModel.JBTMethod;
+import org.jboss.profiler.tracerModel.JBTTransaction;
+
+import org.jboss.profiler.util.SPYGroupNameConvert;
+import org.jboss.profiler.util.GroupUtil;
+import org.jboss.profiler.web.form.TracerFilterForm;
+
+/**
+ * Gera grafico de pizza em funcao da arvore de chamadas no thread/processo
+ *
+ * @author Clebert Suconic/Yoko Seki/Shao Huijuan
+ */
+public class GroupGraphServerTest extends HttpServlet {
+ private static final String CONTENT_TYPE = "application/javaObject";
+
+ private static final boolean printOut = true;
+
+ //Initialize global variables
+ public void init() throws ServletException {
+ }
+
+ //Process the HTTP Get request
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ try {
+ response.setContentType(CONTENT_TYPE);
+ response.setHeader("pragma", "no-cache");
+
+ org.jboss.profiler.web.form.FilterForm beanFilter
+ = (org.jboss.profiler.web.form.FilterForm) request.getSession().getAttribute("filterForm");
+
+ TracerFilterForm tracerBeanFilter= (TracerFilterForm) request.getSession().getAttribute("tracerFilterForm");
+
+ org.jboss.profiler.model.JBPProcess spyProcess = beanFilter.getJbpProcess();
+ HashMap spyMethods = spyProcess.getSpyMethods();
+ HashMap searchedTransactions = beanFilter.getSearchedTransactions();
+
+ String group = request.getParameter("group");
+ Integer transactionID = new Integer(request.getParameter("transactionID"));
+ JBTTransaction keyTransaction = new JBTTransaction();
+ Iterator iter = searchedTransactions.values().iterator();
+ while (iter.hasNext())
+ {
+ keyTransaction = (JBTTransaction) iter.next();
+ if (keyTransaction.getTransactionID()==transactionID.intValue())
+ break;
+ }
+
+ ArrayList transactionMethods = keyTransaction.getMethods();
+
+ GroupGraphCallings graph = generateCallings(spyMethods, transactionMethods, group);
+ //GroupUtil util=new GroupUtil();
+ //GroupGraphCallings graph=util.generateCallings(spyMethods,tracerBeanFilter.getJbtTransactionTree(),group);
+
+ java.io.ObjectOutputStream outObj = new java.io.ObjectOutputStream(
+ response.getOutputStream());
+ outObj.writeObject(graph);
+ outObj.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private GroupGraphCallings generateCallings(java.util.HashMap spyMethods, ArrayList transactionMethods, String group) {
+
+ int groupID = 0;
+ ArrayList arrayGroups = new ArrayList();
+ ArrayList arrayRefs = new ArrayList();
+ GroupGraphCallings graph = new GroupGraphCallings();
+
+ for (int i=0; i<transactionMethods.size(); i++)
+ {
+ JBTMethod transactionMethod = (JBTMethod) transactionMethods.get(i);
+
+ String className = "";
+ Iterator iter = spyMethods.values().iterator();
+ while (iter.hasNext()){
+ JBPMethod spyMethod = (JBPMethod) iter.next();
+ if (spyMethod.getMethodID()==transactionMethod.getMethodID())
+ {
+ className = spyMethod.getSpyClass().getName();
+ break;
+ }
+ }
+
+ StringBuffer groupName = new StringBuffer();
+ groupName.append(className);
+ StringBuffer shownName = new StringBuffer();
+ shownName.append(className);
+
+ //for debug
+ //System.out.println("Servlet1");
+ //System.out.println("groupName: " + groupName.toString());
+ //System.out.println("shownName: " + shownName.toString());
+
+ SPYGroupNameConvert.convertGroupName(group, groupName, shownName);
+
+ //for debug
+ //System.out.println("Servlet2");
+ //System.out.println("groupName: " + groupName.toString());
+ //System.out.println("shownName: " + shownName.toString());
+
+ if (i==0) {
+ groupID = 0;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup.setName(shownName.toString()+"aaa");
+
+ newGroup.setLevel(transactionMethod.getDepth());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ }//end of if
+ else{
+ int calledID = 0;
+ int currentGroupSize = arrayGroups.size();
+ for (int j=0; j<currentGroupSize; j++){
+ GroupGraphGroup existGroup = (GroupGraphGroup) arrayGroups.get(j);
+ if ((existGroup.getGroupName()).equals(groupName.toString()))
+ {
+ calledID = existGroup.getGroupID();
+ existGroup.addMethodList(new Integer(i));
+ if (existGroup.getLevel()>transactionMethod.getDepth())
+ existGroup.setLevel(transactionMethod.getDepth());
+ arrayGroups.set(j, existGroup);
+ break;
+ }
+ if (j==(currentGroupSize-1))
+ {
+ groupID += 1;
+ calledID = groupID;
+ GroupGraphGroup newGroup = new GroupGraphGroup();
+ newGroup.setGroupID(groupID);
+ newGroup.setGroupName(groupName.toString());
+ newGroup.setName(shownName.toString()+"aaa");
+ newGroup.setLevel(transactionMethod.getDepth());
+ newGroup.addMethodList(new Integer(i));
+ arrayGroups.add(newGroup);
+ }
+ }//end of for
+
+ int calleeID = getCalleeGroupID(i, transactionMethods, arrayGroups);
+
+ if (i==1)
+ {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ }
+ else
+ {
+ int currentRefSize = arrayRefs.size();
+ for (int k=0; k<currentRefSize; k++)
+ {
+ GroupGraphReference existRef = (GroupGraphReference) arrayRefs.get(k);
+ if ((existRef.getGroupCallee()==calleeID) &&
+ (existRef.getGroupCalled()==calledID))
+ break;
+ if (k==(currentRefSize-1))
+ {
+ GroupGraphReference newRef = new GroupGraphReference();
+ newRef.setGroupCallee(calleeID);
+ newRef.setGroupCalled(calledID);
+ arrayRefs.add(newRef);
+ }
+ }//end of for
+ }//end of else
+ }//end of else
+
+ //for debug
+ // System.out.println ("\n---Processing methodID: " + i +"---");
+ graph.setGroups(arrayGroups);
+ graph.setReferences(arrayRefs);
+ // graph.printDebug();
+
+ }//end of big for
+
+ TreeSet treeSet = new TreeSet(new CompareMethods());
+ treeSet.addAll(arrayGroups);
+
+ ArrayList listGroups = new ArrayList();
+ listGroups.addAll(treeSet);
+
+ graph.setGroups(listGroups);
+ graph.setReferences(arrayRefs);
+
+ graph.printDebug();
+
+ return graph;
+ }
+
+ private int getCalleeGroupID(int methodNum, ArrayList transactionMethods, ArrayList arrayGroups)
+ {
+ JBTMethod calledMethod = (JBTMethod) transactionMethods.get(methodNum);
+ int i;
+ for (i=(methodNum-1); i>=0; i--)
+ {
+ JBTMethod calleeMethod = (JBTMethod) transactionMethods.get(i);
+ if ((calledMethod.getDepth()-1)==calleeMethod.getDepth())
+ break;
+ }
+
+ for (int j=0; j<arrayGroups.size(); j++)
+ {
+ GroupGraphGroup existGroup = (GroupGraphGroup) arrayGroups.get(j);
+ ArrayList methodList = existGroup.getMethodList();
+ if (methodList.contains(new Integer(i)))
+ {
+ return existGroup.getGroupID();
+ }
+ }
+ return (-1);
+ }
+
+ //Clean up resources
+ public void destroy() {
+ }
+
+ class CompareMethods implements java.util.Comparator
+ {
+ public int compare (Object left, Object right)
+ {
+ int iret = ((GroupGraphGroup)left).getLevel()-((GroupGraphGroup)right).getLevel();
+ if (iret>0) return 1;
+ else return -1;
+ }
+ }
+
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupAppletServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupAppletServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupAppletServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,165 @@
+package org.jboss.profiler.web.servlets;
+
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Stack;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+import org.jboss.profiler.tracerModel.UserGraphCell;
+import org.jboss.profiler.tracerModel.UserGroup;
+
+
+public class UserGroupAppletServlet extends HttpServlet {
+
+ private HashMap method2gruopMap = null;
+ public UserGroupAppletServlet() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException,IOException {
+ ArrayList usergroupList = this.processGetList(request,response);
+ response.setContentType("application/javaObject");
+ response.setHeader("pragma", "no-cache");
+ java.io.ObjectOutputStream outObj = new java.io.ObjectOutputStream(
+ response.getOutputStream());
+ outObj.writeObject(usergroupList);
+ outObj.flush();
+ outObj.close();
+ }
+
+ private ArrayList processGetList(HttpServletRequest request, HttpServletResponse response){
+ method2gruopMap = null;
+ javax.servlet.http.HttpSession session = request.getSession();
+ JBTTransactionTree jbtTransactionTree = (JBTTransactionTree)session.getAttribute("jbtTransactionTree");
+ ArrayList usergroupList = (ArrayList)session.getAttribute("usergroupinfo");
+ ArrayList resultList = new ArrayList();
+ ArrayList detailTravList = jbtTransactionTree.traverseForDetail();
+ ArrayList inputusrgrouplist = new ArrayList(usergroupList);
+ for(int i = 0; i<inputusrgrouplist.size(); i++){
+ if(((UserGroup)inputusrgrouplist.get(i)).getStrGroupName() == null){
+ inputusrgrouplist.remove(i);
+ break;
+ }
+ }
+
+ UserGraphCell previouscell = null;
+ int inodelastdepth = 0;
+ int inodedepth = 0;
+ long lstarttime = 0;
+ JBTTransactionTreeNode preNode = null;
+ for(int inindex = 0; inindex<detailTravList.size(); inindex++){
+ JBTTransactionTreeNode curNode = (JBTTransactionTreeNode)detailTravList.get(inindex);
+
+ String strnodeName = curNode.getName();
+
+ inodelastdepth = inodedepth;
+ inodedepth = curNode.getJBTMethod().getDepth();
+ if(inodelastdepth < inodedepth){
+ lstarttime = curNode.getJBTMethod().getElapsedClockStart();
+ }
+ UserGraphCell curcell = new UserGraphCell();
+ String strcellName = this.getUserGroupNameByMemberName(detailTravList,strnodeName,inputusrgrouplist);
+
+ // if the current detail traversed method is in user group
+ if(strcellName != null){
+ // if two or more consequent methods belong to "others", they are grouped in
+ // one "others" group, for instance, if f2,f3 are not in user group then f1->f2->f3->f2->f1
+ // becomes f1->others->f1
+ if(previouscell != null && previouscell.strmethodName.equals(strcellName)){
+ if(inindex == detailTravList.size()-1){
+ previouscell.iendtime = curNode.getJBTMethod().getElapsedClockEnd();
+ }
+ continue;
+ }
+ else{
+ curcell.strmethodName = strcellName;
+ if(inodelastdepth > inodedepth){
+ previouscell.iendtime = preNode.getJBTMethod().getElapsedClockEnd();
+ curcell.idepth = previouscell.idepth-1;
+ curcell.istarttime = previouscell.iendtime;
+ }
+ else{
+ curcell.istarttime = lstarttime;
+ if(previouscell!=null){
+ curcell.idepth = previouscell.idepth+1;
+ previouscell.iendtime = curcell.istarttime;
+ }
+ else {
+ curcell.idepth = inodedepth;
+ }
+ }
+ }
+ }
+ else{
+ curcell.strmethodName = strnodeName;
+ if(inodelastdepth > inodedepth){
+ previouscell.iendtime = preNode.getJBTMethod().getElapsedClockEnd();
+ curcell.idepth = previouscell.idepth-1;
+ curcell.istarttime = previouscell.iendtime;
+ }
+ else{
+ curcell.istarttime = lstarttime;
+ if(previouscell!=null){
+ curcell.idepth = previouscell.idepth+1;
+ previouscell.iendtime = curcell.istarttime;
+ }
+ else {
+ curcell.idepth = inodedepth;
+ }
+ }
+ if(inindex == detailTravList.size()-1){
+ curcell.iendtime = curNode.getJBTMethod().getElapsedClockEnd();
+ }
+ }
+ previouscell = curcell;
+ preNode = curNode;
+ resultList.add(curcell);
+ }
+ //System.out.println(resultList.size());
+ return resultList;
+ }
+
+ private String getUserGroupNameByMemberName(ArrayList detailTravList,String vmethodName, ArrayList vusergroupList){
+
+ if(method2gruopMap == null){
+ method2gruopMap = new HashMap();
+ for(int index = 0; index<detailTravList.size(); index++){
+ JBTTransactionTreeNode curNode = (JBTTransactionTreeNode)detailTravList.get(index);
+ String strnodeName = curNode.getName();
+ int i=0;
+ int ilen = 0;
+ if(null != vusergroupList){
+ ilen = vusergroupList.size();
+ }
+ for(; i < ilen; i++){
+ UserGroup curusrgroup = (UserGroup)vusergroupList.get(i);
+ if(curusrgroup.getStrGroupName() == null){
+ continue;
+ }
+ ArrayList memberList = curusrgroup.getMemberNames();
+ if(memberList.contains(strnodeName) && curusrgroup.getStrGroupName() != null){
+ method2gruopMap.put(strnodeName, curusrgroup.getStrGroupName());
+ break;
+ }
+ }
+ }
+ }
+ String usrgroupName = null;
+ usrgroupName = (String)method2gruopMap.get(vmethodName);
+ return usrgroupName;
+ }
+
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDispatchServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDispatchServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDispatchServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,98 @@
+package org.jboss.profiler.web.servlets;
+
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.profiler.tracerModel.UserGroup;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGroupDispatchServlet extends HttpServlet {
+
+ public UserGroupDispatchServlet() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+ this.process(req, resp);
+ }
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException,
+ IOException {
+ this.process(req,resp);
+ }
+
+ private void process(HttpServletRequest request, HttpServletResponse response){
+
+ HttpSession session = request.getSession();
+ String strreqTag = request.getParameter("reselect");
+ String strReqType = request.getParameter("requestType");
+ String streditTag = request.getParameter("edit");
+ String strforwardPage = "";
+ ArrayList usergroupList = (ArrayList) session.getAttribute("usergroupinfo");
+ if(null != strreqTag){
+ if(streditTag == null){
+ session.removeAttribute("usergroupinfo");
+ }
+ session.removeAttribute("groupeddetaillist");
+ strforwardPage = "/./referenceSelect.jsp";
+ }
+ else{
+ if("showgroupeddetail".equals(strReqType)){
+ if(usergroupList == null){
+ session.removeAttribute("groupeddetaillist");
+ strforwardPage = "/./referenceSelect.jsp";
+ }
+ else{
+ strforwardPage = "/usergroupinfoservlet";
+ }
+ }
+ else{
+ if(null == usergroupList){
+ strforwardPage = "/./referenceSelect.jsp";
+ }
+ else{
+ if("showinfo".equals(strReqType)){
+ UserGroup usrgroup = (UserGroup)usergroupList.get(0);
+ if(usrgroup.getMethodRefMap().keySet().isEmpty()){
+ strforwardPage = "/usergroupinfoservlet";
+ }
+ else{
+ strforwardPage = "/./referenceMethodView.jsp";
+ }
+ }
+ if("showapplet".equals(strReqType)){
+ strforwardPage = "/./referenceAppletView.jsp";
+ }
+ }
+ }
+ }
+
+ ServletContext sc = getServletContext();
+ RequestDispatcher rd = sc.getRequestDispatcher(strforwardPage);
+ try {
+ rd.forward(request,response);
+ } catch (ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDownloadServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDownloadServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupDownloadServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,54 @@
+package org.jboss.profiler.web.servlets;
+
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+import org.jboss.profiler.tracerModel.UserGroup;
+import org.jboss.profiler.util.GroupUtil;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGroupDownloadServlet extends HttpServlet {
+
+ public UserGroupDownloadServlet(){
+ super();
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ ArrayList propList = (ArrayList)request.getSession().getAttribute("usergroupinfo");
+ StringBuffer strbf = new StringBuffer("<?xml version=\"1.0\"?>\n");
+ strbf.append("<group>\n");
+ for(int i = 0; i< propList.size(); i++){
+ UserGroup curusrGroup = (UserGroup)propList.get(i);
+ if(curusrGroup.getStrGroupName()==null){
+ continue;
+ }
+ strbf.append("<groupinfo>\n");
+
+ strbf.append(curusrGroup.propertiesToXML());
+ strbf.append("</groupinfo>\n");
+ }
+ strbf.append("</group>\n");
+
+ String strgroupInfo = strbf.toString();
+ response.setContentType("unknown");
+ response.setHeader("Content-Disposition",
+ "attachment; filename=\"tracing.xml\"");
+ response.getWriter().write(strgroupInfo);
+ response.getWriter().flush();
+ }
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupInfoServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupInfoServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupInfoServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,243 @@
+package org.jboss.profiler.web.servlets;
+
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+import org.jboss.profiler.tracerModel.JBTTransactionTreeNode;
+import org.jboss.profiler.tracerModel.UserGraphCell;
+import org.jboss.profiler.tracerModel.UserGroup;
+import org.jboss.profiler.util.GroupUtil;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGroupInfoServlet extends HttpServlet {
+
+ private HashMap method2gruopMap = null;
+ public UserGroupInfoServlet() {
+ super();
+
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{
+ this.process(request,response);
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ this.process(request,response);
+ }
+
+ private void process(HttpServletRequest request, HttpServletResponse response) throws IOException{
+ javax.servlet.http.HttpSession session = request.getSession();
+ JBTTransactionTree jbtTransactionTree = (JBTTransactionTree)session.getAttribute("jbtTransactionTree");
+ GroupUtil util = new GroupUtil();
+ GroupGraphCallings groupCallings = util.generateCallings(jbtTransactionTree);
+
+ String strrequstType = request.getParameter("requestType");
+ String strappletnum = request.getParameter("appletnum");
+ ArrayList usergroupList = (ArrayList)session.getAttribute("usergroupinfo");
+
+ if("showapplet".equals(strrequstType)){
+ groupCallings.setusergroupMethods(usergroupList);
+ response.sendRedirect("./referenceAppletView.jsp?appletnum="+strappletnum);
+ return;
+ }
+ else if("showgroupeddetail".equals(strrequstType)){
+ groupCallings.setusergroupMethods(usergroupList);
+ ArrayList detailedList = (ArrayList)session.getAttribute("groupeddetaillist");
+ if(null == detailedList){
+ detailedList = this.processGetList(request,response);
+ }
+ session.setAttribute("groupeddetaillist",detailedList);
+ response.sendRedirect("./transactionMethodGroupedDetail.jsp");
+ return;
+ }
+ else if("showinfo".equals(strrequstType)){
+ //this.getServletContext().getRequestDispatcher("./referenceMethodView.jsp").forward(request,response);
+ usergroupList = groupCallings.getCallingRelations(usergroupList);
+ session.setAttribute("usergroupinfo",usergroupList);
+ response.sendRedirect("./referenceMethodView.jsp");
+ return;
+ }
+ }
+
+ private ArrayList processGetList(HttpServletRequest request, HttpServletResponse response){
+ method2gruopMap = null;
+ javax.servlet.http.HttpSession session = request.getSession();
+ JBTTransactionTree jbtTransactionTree = (JBTTransactionTree)session.getAttribute("jbtTransactionTree");
+ ArrayList usergroupList = (ArrayList)session.getAttribute("usergroupinfo");
+ for(int i=0; i<usergroupList.size(); i++){
+ ((UserGroup)usergroupList.get(i)).setGrouprunningtime(-1);
+ }
+ ArrayList resultList = new ArrayList();
+ ArrayList detailTravList = jbtTransactionTree.traverseForDetail();
+ ArrayList inputusrgrouplist = new ArrayList(usergroupList);
+ ArrayList visitedNodeList = new ArrayList();
+ for(int i = 0; i<inputusrgrouplist.size(); i++){
+ if(((UserGroup)inputusrgrouplist.get(i)).getStrGroupName() == null){
+ inputusrgrouplist.remove(i);
+ break;
+ }
+ }
+
+ UserGraphCell previouscell = null;
+ int inodelastdepth = 0;
+ int inodedepth = 0;
+ long lstarttime = 0;
+ JBTTransactionTreeNode preNode = null;
+ for(int inindex = 0; inindex<detailTravList.size(); inindex++){
+ JBTTransactionTreeNode curNode = (JBTTransactionTreeNode)detailTravList.get(inindex);
+
+ String strnodeName = curNode.getName();
+
+ inodelastdepth = inodedepth;
+ inodedepth = curNode.getJBTMethod().getDepth();
+ if(inodelastdepth < inodedepth){
+ lstarttime = curNode.getJBTMethod().getElapsedClockStart();
+ }
+ UserGraphCell curcell = new UserGraphCell();
+ UserGroup curusrgroup = this.getUserGroupByMemberName(detailTravList,strnodeName,usergroupList);
+ String strcellName = curusrgroup.getStrGroupName();
+
+ // if the current detail traversed method is in user group
+ if(strcellName != null){
+
+ long pureruntime = this.caculateNodePureRunningTime(curNode,visitedNodeList);
+ if(pureruntime >= 0){
+ if(curusrgroup.getGrouprunningtime() >= 0){
+ pureruntime += curusrgroup.getGrouprunningtime();
+ }
+ curusrgroup.setGrouprunningtime(pureruntime);
+ }
+ // if two or more consequent methods belong to "others", they are grouped in
+ // one "others" group, for instance, if f2,f3 are not in user group then f1->f2->f3->f2->f1
+ // becomes f1->others->f1
+ if(previouscell != null && previouscell.strmethodName.equals(strcellName)){
+ curcell.methodrunningtime = -1; // this means the method running time has no meaning
+ curcell.imethodorder = -1; // this means the order has no meaning
+ if(inindex == detailTravList.size()-1){
+ previouscell.iendtime = curNode.getJBTMethod().getElapsedClockEnd();
+ }
+ continue;
+ }
+ else{
+ curcell.strmethodName = strcellName;
+ curcell.methodrunningtime = -1; // this means the method running time has no meaning
+ curcell.imethodorder = -1; // this means the order has no meaning
+
+ if(inodelastdepth > inodedepth){
+ previouscell.iendtime = preNode.getJBTMethod().getElapsedClockEnd();
+ curcell.idepth = previouscell.idepth-1;
+ curcell.istarttime = previouscell.iendtime;
+ }
+ else{
+ curcell.istarttime = lstarttime;
+ if(previouscell!=null){
+ curcell.idepth = previouscell.idepth+1;
+ previouscell.iendtime = curcell.istarttime;
+ }
+ else {
+ curcell.idepth = inodedepth;
+ }
+ }
+ }
+ }
+ else{
+ curcell.strmethodName = strnodeName;
+ curcell.methodrunningtime = this.caculateNodePureRunningTime(curNode,visitedNodeList);
+ curcell.imethodorder = curNode.getSequenceNo();
+ if(inodelastdepth > inodedepth){
+ previouscell.iendtime = preNode.getJBTMethod().getElapsedClockEnd();
+ curcell.idepth = previouscell.idepth-1;
+ curcell.istarttime = previouscell.iendtime;
+ }
+ else{
+ curcell.istarttime = lstarttime;
+ if(previouscell!=null){
+ curcell.idepth = previouscell.idepth+1;
+ previouscell.iendtime = curcell.istarttime;
+ }
+ else {
+ curcell.idepth = inodedepth;
+ }
+ }
+ if(inindex == detailTravList.size()-1){
+ curcell.iendtime = curNode.getJBTMethod().getElapsedClockEnd();
+ }
+ }
+ previouscell = curcell;
+ preNode = curNode;
+ resultList.add(curcell);
+ //curusrgroup.getEntryList().add(curcell);
+ }
+ //System.out.println(resultList.size());
+ for(int i = 0; i < usergroupList.size(); i++){
+ UserGroup curusrgroup = (UserGroup)usergroupList.get(i);
+ if(curusrgroup.getStrGroupName() == null){
+ continue;
+ }
+ for(int j=0; j<resultList.size(); j++){
+ UserGraphCell cell = (UserGraphCell)resultList.get(j);
+ if(cell.strmethodName.equals(curusrgroup.getStrGroupName())){
+ cell.methodrunningtime = curusrgroup.getGrouprunningtime();
+ break;
+ }
+ }
+ }
+ return resultList;
+ }
+
+ private UserGroup getUserGroupByMemberName(ArrayList detailTravList,String vmethodName, ArrayList vusergroupList){
+
+ if(method2gruopMap == null){
+ method2gruopMap = new HashMap();
+ for(int index = 0; index<detailTravList.size(); index++){
+ JBTTransactionTreeNode curNode = (JBTTransactionTreeNode)detailTravList.get(index);
+ String strnodeName = curNode.getName();
+ int i=0;
+ int ilen = 0;
+ if(null != vusergroupList){
+ ilen = vusergroupList.size();
+ }
+ for(; i < ilen; i++){
+ UserGroup curusrgroup = (UserGroup)vusergroupList.get(i);
+ //if(curusrgroup.getStrGroupName() == null){
+ // continue;
+ //}
+ int inlen = 0;
+ ArrayList memberList = curusrgroup.getMemberNames();
+ if(memberList.contains(strnodeName)){
+ method2gruopMap.put(strnodeName, curusrgroup);
+ break;
+ }
+ }
+ }
+ }
+ UserGroup usrgroup = null;
+ usrgroup = (UserGroup)method2gruopMap.get(vmethodName);
+ return usrgroup;
+ }
+
+ private long caculateNodePureRunningTime(JBTTransactionTreeNode node, ArrayList visitedList){
+ long time = -1;
+ if(!visitedList.contains(node)){
+ //time = this.caculateNodePureRunningTime(node);
+ time = node.getMethodRunningTime();
+ visitedList.add(node);
+ }
+ return time;
+ }
+}
+
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,192 @@
+package org.jboss.profiler.web.servlets;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.*;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.profiler.model.JBPMethod;
+import org.jboss.profiler.tracerModel.GroupGraphCallings;
+import org.jboss.profiler.tracerModel.JBTTransactionTree;
+import org.jboss.profiler.tracerModel.UserGroup;
+import org.jboss.profiler.util.GroupUtil;
+
+/**
+ * @author Huijuan Shao
+ */
+public class UserGroupServlet extends HttpServlet{
+
+ public UserGroupServlet (){
+ super();
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ this.processRequest(request,response);
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ this.processRequest(request,response);
+ }
+
+ public void processRequest(HttpServletRequest request, HttpServletResponse response){
+ request.getSession().removeAttribute("strrequestpage");
+
+ String strgroupName[] = null;
+ String strpriority[] = null;
+ String strgroupSeqNum[] = null;
+ String strincludefullcondition[] = null;
+ String strincludemethodCondition[] = null;
+ String strincludeclassCondition[] = null;
+ String strincludepackageCondition[] = null;
+ String strexcludefullcondition[] = null;
+ String strexcludemethodCondition[] = null;
+ String strexcludeclassCondition[] = null;
+ String strexcludepackageCondition[] = null;
+
+ ArrayList usergroupList = new ArrayList();
+
+ String strgroupAmnt = request.getParameter("groupamount");
+ int igroupamout = 0;
+ if(strgroupAmnt != null){
+ igroupamout = Integer.parseInt(strgroupAmnt);
+ }
+ if(igroupamout == 1){
+ strgroupName = new String[1];
+ strpriority = new String[1];
+ strgroupSeqNum = new String[1];
+ strincludefullcondition = new String[1];
+ strincludemethodCondition = new String[1];
+ strincludeclassCondition = new String[1];
+ strincludepackageCondition = new String[1];
+ strexcludefullcondition = new String[1];
+ strexcludemethodCondition = new String[1];
+ strexcludeclassCondition = new String[1];
+ strexcludepackageCondition = new String[1];
+ strpriority[0] = request.getParameter("priority");
+ strgroupSeqNum[0] = request.getParameter("groupseqnum");
+ strgroupName[0] = request.getParameter("groupname");
+ strincludefullcondition[0] = request.getParameter("ifullcondition");
+ strincludemethodCondition[0] = request.getParameter("imethodcondition");
+ strincludeclassCondition[0] = request.getParameter("iclasscondition");
+ strincludepackageCondition[0] = request.getParameter("ipackagecondition");
+ strexcludefullcondition[0] = request.getParameter("efullcondition");
+ strexcludemethodCondition[0] = request.getParameter("emethodcondition");
+ strexcludeclassCondition[0] = request.getParameter("eclasscondition");
+ strexcludepackageCondition[0] = request.getParameter("epackagecondition");
+ }
+ else if(igroupamout > 1){
+ strpriority = request.getParameterValues("priority");
+ strgroupName = request.getParameterValues("groupname");
+ strgroupSeqNum = request.getParameterValues("groupseqnum");
+ strincludefullcondition = request.getParameterValues("ifullcondition");
+ strincludemethodCondition = request.getParameterValues("imethodcondition");
+ strincludeclassCondition = request.getParameterValues("iclasscondition");
+ strincludepackageCondition = request.getParameterValues("ipackagecondition");
+ strexcludefullcondition = request.getParameterValues("efullcondition");
+ strexcludemethodCondition = request.getParameterValues("emethodcondition");
+ strexcludeclassCondition = request.getParameterValues("eclasscondition");
+ strexcludepackageCondition = request.getParameterValues("epackagecondition");
+
+ if(null == strgroupName){
+ strgroupName = new String[igroupamout];
+ }
+ if(null == strpriority){
+ strpriority = new String[igroupamout];
+ }
+ if(null == strgroupSeqNum){
+ strgroupSeqNum = new String[igroupamout];
+ }
+ if(null == strincludemethodCondition){
+ strincludemethodCondition = new String[igroupamout];
+ }
+ if(null == strincludeclassCondition){
+ strincludeclassCondition = new String[igroupamout];
+ }
+ if(null == strincludepackageCondition){
+ strincludepackageCondition = new String[igroupamout];
+ }
+ if(null == strincludefullcondition){
+ strincludefullcondition = new String[igroupamout];
+ }
+
+ if(null == strexcludemethodCondition){
+ strexcludemethodCondition = new String[igroupamout];
+ }
+ if(null == strexcludeclassCondition){
+ strexcludeclassCondition = new String[igroupamout];
+ }
+ if(null == strexcludepackageCondition){
+ strexcludepackageCondition = new String[igroupamout];
+ }
+ if(null == strexcludefullcondition){
+ strexcludefullcondition = new String[igroupamout];
+ }
+ }
+
+
+ for(int i=0; i<igroupamout; i++){
+ UserGroup usrGroup = new UserGroup();
+ int iprio = 0;
+ int iseqnum = 0;
+ if(null != strpriority[i]){
+ iprio = Integer.parseInt(strpriority[i]);
+ }
+ if(null != strgroupSeqNum[i]){
+ iseqnum = Integer.parseInt(strgroupSeqNum[i]);
+ }
+ usrGroup.setIpriority(iprio);
+ usrGroup.setIgroupSeqNo(iseqnum);
+
+ usrGroup.setStrGroupName(strgroupName[i]);
+
+ usrGroup.setStrifullcond(strincludefullcondition[i]);
+ usrGroup.setStrimethodcond(strincludemethodCondition[i]);
+ usrGroup.setStriclasscond(strincludeclassCondition[i]);
+ usrGroup.setStripackagecond(strincludepackageCondition[i]);
+ usrGroup.setStrefullcond(strexcludefullcondition[i]);
+ usrGroup.setStremethodcond(strexcludemethodCondition[i]);
+ usrGroup.setStreclasscond(strexcludeclassCondition[i]);
+ usrGroup.setStrepackagecond(strexcludepackageCondition[i]);
+ usergroupList.add(usrGroup);
+ }
+
+ if(usergroupList.size() > 0){
+ request.getSession().setAttribute("usergroupinfo",usergroupList);
+ }
+
+ String strrequstType = request.getParameter("requestType");
+ if("showinfo".equals(strrequstType) || "showapplet".equals(strrequstType)||
+ "showgroupeddetail".equals(strrequstType)){
+ try {
+ this.getServletContext().getRequestDispatcher("/usergroupinfoservlet").forward(request,response);
+ } catch (ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ else if("download".equals(strrequstType)){
+ try {
+ this.getServletContext().getRequestDispatcher("/usergroupdownloadservlet").forward(request,response);
+ } catch (ServletException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+}
Added: trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupUploadServlet.java
===================================================================
--- trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupUploadServlet.java (rev 0)
+++ trunk/java/src/web/org/jboss/profiler/web/servlets/UserGroupUploadServlet.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,52 @@
+package org.jboss.profiler.web.servlets;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.profiler.tracerModel.UserGroup;
+import org.jboss.profiler.util.UserGroupUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Huijuan Shao
+ *
+ */
+public class UserGroupUploadServlet extends HttpServlet {
+
+ public UserGroupUploadServlet() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException,
+ IOException {
+ ServletInputStream is = request.getInputStream();
+ int length = request.getContentLength();
+ byte[] cntbyte = new byte[length];
+ is.read(cntbyte);
+ String strcontent = new String(cntbyte,"ISO-8859-1");
+ String strlines[] = strcontent.split("\\r\\n");
+ ArrayList usergroupList = new ArrayList();
+ usergroupList = UserGroupUtil.parse(strlines[4]);
+ if(usergroupList == null){
+ response.sendRedirect("./referenceException.jsp");
+ return;
+ }
+ request.getSession().setAttribute("parsedusergroups",usergroupList);
+ response.sendRedirect("./referenceSelect.jsp");
+ }
+}
Added: trunk/java/webRoot/JspException.jsp
===================================================================
--- trunk/java/webRoot/JspException.jsp (rev 0)
+++ trunk/java/webRoot/JspException.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,19 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+<%@ page isErrorPage="true" import="java.io.PrintWriter" %>
+<%
+ String exceptionName=exception.getClass().getName();
+ String requestURI=request.getRequestURI();
+%>
+<html>
+ <head>
+ <title> JSP Exception Handling page </title>
+ </head>
+ <body>
+ Throw the exception <%=exceptionName %>when running <%=requestURI %>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/java/webRoot/WEB-INF/web.xml
===================================================================
--- trunk/java/webRoot/WEB-INF/web.xml 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/java/webRoot/WEB-INF/web.xml 2008-02-20 01:13:38 UTC (rev 425)
@@ -43,6 +43,10 @@
<servlet-name>graphServer</servlet-name>
<servlet-class>org.jboss.profiler.web.servlets.GraphServer</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>groupGraphServer</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.GroupGraphServer</servlet-class>
+ </servlet>
<servlet>
<servlet-name>graphMemoryServer</servlet-name>
<servlet-class>org.jboss.profiler.web.servlets.GraphMemoryServer</servlet-class>
@@ -73,6 +77,32 @@
<servlet-name>memoryServlet</servlet-name>
<servlet-class>org.jboss.profiler.web.servlets.ServletMemoryProfiler</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>usergroupServlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>usergroupinfoservlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupInfoServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>usergroupdownloadservlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupDownloadServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>usergroupuploadservlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupUploadServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>usergroupappletservlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupAppletServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>usergroupdispatchservlet</servlet-name>
+ <servlet-class>org.jboss.profiler.web.servlets.UserGroupDispatchServlet</servlet-class>
+ </servlet>
+
+
<servlet-mapping>
<servlet-name>memoryServlet</servlet-name>
<url-pattern>/memory</url-pattern>
@@ -102,6 +132,10 @@
<url-pattern>/graphServer</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>groupGraphServer</servlet-name>
+ <url-pattern>/groupGraphServer</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>JBPProcess</servlet-name>
<url-pattern>/JBPProcess</url-pattern>
</servlet-mapping>
@@ -123,6 +157,32 @@
<servlet-name>xmlConsolidated</servlet-name>
<url-pattern>/xml/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupServlet</servlet-name>
+ <url-pattern>/usergroupservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupinfoservlet</servlet-name>
+ <url-pattern>/usergroupinfoservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupdownloadservlet</servlet-name>
+ <url-pattern>/usergroupdownloadservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupuploadservlet</servlet-name>
+ <url-pattern>/usergroupuploadservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupappletservlet</servlet-name>
+ <url-pattern>/usergroupappletservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>usergroupdispatchservlet</servlet-name>
+ <url-pattern>/usergroupdispatchservlet</url-pattern>
+ </servlet-mapping>
+ usergroupdispatch
+
<session-config>
<session-timeout>50000</session-timeout>
</session-config>
Modified: trunk/java/webRoot/allTransactions.jsp
===================================================================
--- trunk/java/webRoot/allTransactions.jsp 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/java/webRoot/allTransactions.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -167,7 +167,7 @@
searchOptions += "&methodElapse=" + request.getParameter("methodElapse");
}
- String sort="down";
+ String sort="up";
if (request.getParameter("sort")!=null) {
sort = request.getParameter("sort");
}
@@ -217,8 +217,9 @@
} else {
out.println("<tr bgcolor=\"#cccccc\">");
}
- out.println("<td><a title='Click here to view transaction methods' href=\"./transactionMethods.jsp?transactionID=" + transaction.getTransactionID() + searchOptions + "\" target=\"_blank\"><img src='./imgs/arrow.gif'></a></td>");
-
+ // out.println("<td><a title='Click here to view transaction methods' href=\"./transactionMethods.jsp?transactionID=" + transaction.getTransactionID() + searchOptions +"&page="+0+ "&initial=yes"+"\" target=\"_blank\"><img src='./imgs/arrow.gif'></a></td>");
+ out.println("<td><a title='Click here to view transaction methods' href=\"./methodSummary.jsp?transactionID=" + transaction.getTransactionID() + searchOptions +"&page="+0+ "&initial=yes"+"\" target=\"_blank\"><img src='./imgs/arrow.gif'></a></td>");
+
long startTime = ((JBTMethod)transaction.getMethods().get(0)).getElapsedClockStart();
long endTime = ((JBTMethod)transaction.getMethods().get(0)).getElapsedClockEnd();
Added: trunk/java/webRoot/classSummary.jsp
===================================================================
--- trunk/java/webRoot/classSummary.jsp (rev 0)
+++ trunk/java/webRoot/classSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,218 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTree_top.inc"%>
+
+<%
+ try {
+ final int QTD_REGISTRO_PAGINA=20;
+ String searchOptions = "";
+ String tmpPage = request.getParameter("page");
+ int paginaCorrente = 0;
+ if (tmpPage!=null) {
+ paginaCorrente=Integer.parseInt(tmpPage);
+ }
+
+ String filter="";
+ if (request.getParameter("filter")!=null) {
+ filter=request.getParameter("filter");
+ }
+
+ String order="";
+ if (request.getParameter("order")!=null) {
+ order = request.getParameter("order");
+ }
+
+ String sort="up";
+ if (request.getParameter("sort")!=null) {
+ sort = request.getParameter("sort");
+ }
+
+ String sortReverse="";
+ if (sort.equals("down")) {
+ sortReverse = "up";
+ }
+ else {
+ sortReverse = "down";
+ }
+%>
+
+<div align=center width="100%">
+<FORM ACTION="./classSummary.jsp" METHOD=GET>
+<table>
+ <tr>
+ <td>
+ Filter
+ </td>
+ <td>
+ <INPUT TYPE="text" name="filter" value="<%=filter%>" class="texto">
+ </td>
+ <td colspan=2><input type="submit" value="Execute" class="botaoPadrao"></td>
+ </tr>
+
+ </table>
+ </FORM>
+</div>
+
+<table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td> </td>
+ <td nowrap="nowrap"><a title='sort according package name' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=PackageName&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Class Name</a></td>
+ <td nowrap="nowrap"><a title='sort according executed count' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=ExecutedCount&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Executed Count</a></td>
+ <td nowrap="nowrap"><a title='sort according total time' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total running time' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average running time' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total CPU time' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total CPU Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average CPU time' href="./classSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg CPU Time</a></td>
+
+<%
+
+ ArrayList treeArrayList= jbtTransactionTree.traverseGetArrayList();
+
+ GroupUtil util=new GroupUtil();
+
+ org.jboss.profiler.model.JBPProcess spyProcess = beanFilter.getJbpProcess();
+ HashMap spyMethods = spyProcess.getSpyMethods();
+
+ ArrayList arrayGroups1=util.generateCallings(spyMethods,jbtTransactionTree,"class").getGroups();
+
+ if (sort.equals("up")) SPYGroupComparator.sort = "down";
+ else SPYGroupComparator.sort = "up";
+
+ Collections.sort(arrayGroups1,new SPYGroupComparator(order));
+
+ //the following is used to filter.
+ ArrayList arrayGroups=new ArrayList();
+ Iterator iter = arrayGroups1.iterator();
+ while(iter.hasNext()){
+ GroupGraphGroup group=(GroupGraphGroup)iter.next();
+ if(group.getGroupName().startsWith(filter) || filter=="")
+ arrayGroups.add(group);
+ }
+
+ //before all the methods show,we want to show them in many pages.
+ int inicio = paginaCorrente*QTD_REGISTRO_PAGINA;
+ int fim = inicio+QTD_REGISTRO_PAGINA;
+
+ if ( fim>=arrayGroups.size() ) {
+ fim=arrayGroups.size();
+ }
+
+ for(int line=inicio;line<fim;line++){
+ GroupGraphGroup tmpGroup=(GroupGraphGroup)arrayGroups.get(line);
+
+ String methodName=tmpGroup.getGroupName();
+
+ if ((line)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+
+ out.print("<td> </td>");
+
+ out.print("<td>");
+ out.print("<style type=\"text/css\">a{text-decoration:none;color:#000066} a:active{text-decoration:none;color:red} a:hover{text-decoration:underline;front-weight:bold;color:#990099}</style>");
+ out.print( methodName + "</a></td>");
+
+ out.print("<td>" + tmpGroup.getCounts() + "</td>");
+
+ if (tmpGroup.getTotalTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalTime() + "</td>");
+ }
+ else{
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getRunningTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getRunningTime() + "</td>");
+ out.print("<td>" + (float)tmpGroup.getRunningTime()/tmpGroup.getCounts() + "</td>");
+ }
+
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getTotalCPUTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalCPUTime()+ "</td>");
+ out.print("<td>" + (float)tmpGroup.getTotalCPUTime()/tmpGroup.getCounts() + "</td>");
+ }
+
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ out.println("</tr>");
+ //end: the folliwng content is the same with that in the for
+
+ }//end of showing
+
+%>
+</table>
+
+<br>
+<table align=center class="TABELA">
+<%
+ int qtdMaxPaginas=arrayGroups.size()/QTD_REGISTRO_PAGINA;
+ if (arrayGroups.size()%QTD_REGISTRO_PAGINA>0) {
+ qtdMaxPaginas++;
+ }
+%>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;"><td colspan=4 align=center>Page <%=paginaCorrente%> of <%=(qtdMaxPaginas-1)%></td></tr>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+<td><a style="COLOR:WHITE;text-decoration:underline" href="./classSummary.jsp?filter=<%=filter%>&page=0&order=<%=order%>&sort=<%=sort%>">First Page </a></td>
+
+<td>
+<%
+
+ if (paginaCorrente>0) {
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./classSummary.jsp?filter="+filter+"&page=" + (paginaCorrente-1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Previous
+<%
+ if (paginaCorrente>0) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ // out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./classSummary.jsp?filter="+filter+"&page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Next
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+//out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./classSummary.jsp?filter="+filter+"&page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort+"\">");
+%>
+Last Page
+<%
+out.println("</a>");
+%>
+
+</tr>
+</table>
+</body>
+</html>
+<%
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+%>
\ No newline at end of file
Added: trunk/java/webRoot/detailClassSummary.jsp
===================================================================
--- trunk/java/webRoot/detailClassSummary.jsp (rev 0)
+++ trunk/java/webRoot/detailClassSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,157 @@
+
+<%
+/**
+ * @author Huijuan Shao
+ when method did't exit,if some fields of the table was negative numbers,
+ it shows UNKNOWN or NOT EXIT.
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree"%>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode"%>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat"%>
+<%@ page import="org.jboss.profiler.tracerModel.GroupGraphGroup"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="java.util.Stack"%>
+<%--page errorPage="./JspException.jsp" --%>
+ <%
+
+ String strClassName = "";
+ String strSortType = "up";
+ String strSortStandard = "";
+ int line = 0;
+ int intExecCount = 0;
+ long ltotalTime = 0;
+ long ltotalRunTime = 0;
+ long lavgRunTime = 0;
+ long ltotalCPUTime = 0;
+ long lavgCPUTime = 0;
+
+ int intSumCount=0;
+ long lsumTotalTime=0;
+ long lsumTotalRunTime = 0;
+ long lsumTotalCPUTime = 0;
+
+ String strTotalTime = "";
+ String strTotalRunTime = "";
+ String strTotalCPUTime = "";
+ String strAvgRunTime = "";
+ String strAvgCPUTime = "";
+
+ GroupGraphGroup classGroup = null;
+ ArrayList detailTraversedNodesList = jbtTransactionTree.traverseForDetailInfo("class");
+
+ strSortType = request.getParameter("sort");
+ strSortStandard = request.getParameter("order");
+ if(null != strSortType){
+
+ if(strSortType.equals("up")){
+ strSortType = "down";
+ SPYGroupComparator.sort = "down";
+ } else{
+ strSortType = "up";
+ SPYGroupComparator.sort = "up";
+ }
+ }
+ %>
+ <table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">NO.</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=GroupName' title='sort according to class name'>Class Name</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=ExecutedCount' title='sort according to exec count'>Exec Count</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=TotalTime' title='sort according to total time'>Total Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=TotalRunningTime' title='sort according to total running time'>Total Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=AverageRunningTime' title='sort according to average running time'>Avg Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=TotalCPUTime' title='sort according to total CPU time'>Total CPU Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailClassSummary.jsp?sort=<%=strSortType %>&order=AverageCPUTime' title='sort according to average CPU time'>Avg CPU Time</td>
+ </tr>
+ <%
+ if(null != strSortStandard){
+ Collections.sort(detailTraversedNodesList, new SPYGroupComparator(strSortStandard));
+ }
+ int iLen = detailTraversedNodesList.size();
+ for(int index = 0; index < iLen; index++){
+ classGroup = (GroupGraphGroup)detailTraversedNodesList.get(index);
+ strClassName = classGroup.getGroupName();
+ intExecCount = classGroup.getCounts();
+ ltotalTime = classGroup.getTotalTime();
+ ltotalRunTime = classGroup.getRunningTime();
+ lavgRunTime = ltotalTime/intExecCount;
+ ltotalCPUTime = classGroup.getTotalCPUTime();
+ lavgCPUTime = ltotalCPUTime/intExecCount;
+
+
+ intSumCount += intExecCount;
+ if(ltotalTime < 0)
+ {
+ strTotalTime = "UNKNOWN";
+
+ }else{
+ lsumTotalTime += ltotalTime;
+ strTotalTime = "" + ltotalTime;
+ }
+ if(ltotalRunTime < 0)
+ {
+ strTotalRunTime = "NOT EXIT";
+ strAvgRunTime = "UNKNOWN";
+ }else{
+ lsumTotalRunTime += ltotalRunTime;
+ strTotalRunTime = "" + ltotalRunTime;
+ strAvgRunTime = "" + lavgRunTime;
+ }
+ if(ltotalCPUTime < 0)
+ {
+ strTotalCPUTime = "NOT EXIT";
+ strAvgCPUTime = "UNKNOWN";
+ }else{
+ lsumTotalCPUTime += ltotalCPUTime;
+ strTotalCPUTime = "" + ltotalCPUTime;
+ strAvgCPUTime = "" + lavgCPUTime;
+ }
+
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+
+ line++;
+ out.print("<td>"+line+"</td>");
+ out.print("<td>" + GroupUtil.convertToHTML(strClassName)+ "</td>");
+ out.print("<td>" + intExecCount+ "</td>");
+ out.print("<td>" + strTotalTime+ "</td>");
+ out.print("<td>" + strTotalRunTime+ "</td>");
+ out.print("<td>" + strAvgRunTime+ "</td>");
+ out.print("<td>" + strTotalCPUTime+ "</td>");
+ out.print("<td>" + strAvgCPUTime+ "</td></tr>");
+
+
+ }
+ /* this is for the sum
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+ out.print("<td></td>");
+ out.print("<td>Sum</td>");
+ out.print("<td>" + intSumCount+ "</td>");
+ out.print("<td>" + lsumTotalTime+ "</td>");
+ out.print("<td>" + lsumTotalRunTime+ "</td>");
+ out.print("<td>-</td>");
+ out.print("<td>" + lsumTotalCPUTime+ "</td>");
+ out.print("<td>-</td></tr>");
+ */
+%>
+</table>
Added: trunk/java/webRoot/detailMethodSummary.jsp
===================================================================
--- trunk/java/webRoot/detailMethodSummary.jsp (rev 0)
+++ trunk/java/webRoot/detailMethodSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,165 @@
+
+<%
+/**
+ * @author Huijuan Shao
+ when method did't exit,if some fields of the table was negative numbers,
+ it shows UNKNOWN or NOT EXIT.
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree"%>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode"%>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat"%>
+<%@ page import="org.jboss.profiler.tracerModel.GroupGraphGroup"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="java.util.Stack"%>
+<%--page errorPage="./JspException.jsp" --%>
+ <%
+
+
+ String strMethodName = "";
+ String strSortType = "up";
+ String strSortStandard = "";
+ int line = 0;
+ int intExecCount = 0;
+ long ltotalTime = 0;
+ long ltotalRunTime = 0;
+ long lavgRunTime = 0;
+ long ltotalCPUTime = 0;
+ long lavgCPUTime = 0;
+
+ int intSumCount=0;
+ long lsumTotalTime=0;
+ long lsumTotalRunTime = 0;
+ long lsumTotalCPUTime = 0;
+
+ String strTotalTime = "";
+ String strTotalRunTime = "";
+ String strTotalCPUTime = "";
+ String strAvgRunTime = "";
+ String strAvgCPUTime = "";
+
+
+ GroupGraphGroup methodGroup = null;
+ ArrayList detailTraversedNodesList = jbtTransactionTree.traverseForDetailInfo("method");
+
+ strSortType = request.getParameter("sort");
+ strSortStandard = request.getParameter("order");
+ if(null != strSortType){
+
+ if(strSortType.equals("up")){
+ strSortType = "down";
+ SPYGroupComparator.sort = "down";
+ } else{
+ strSortType = "up";
+ SPYGroupComparator.sort = "up";
+ }
+ }
+ %>
+ <html>
+<head>
+<link rel="stylesheet" type="text/css" href="../imgs/profilerStyles.css">
+</head>
+<body>
+ <table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">NO.</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=GroupName' tiltle='sort according to method name'>Method Name</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=ExecutedCount' title='sort according to exec count'>Exec Count</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=TotalTime' title='sort according to total time'>Total Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=TotalRunningTime' title='sort according to total running time'>Total Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=AverageRunningTime' title='sort according to average running time'>Avg Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=TotalCPUTime' title='sort according to total CPU time'>Total CPU Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailMethodSummary.jsp?sort=<%=strSortType %>&order=AverageCPUTime' title='sort according to average CPU time'>Avg CPU Time</td>
+ </tr>
+
+ <%
+ if(null != strSortStandard){
+ Collections.sort(detailTraversedNodesList, new SPYGroupComparator(strSortStandard));
+ }
+ int iLen = detailTraversedNodesList.size();
+ for(int index = 0; index < iLen; index++){
+ methodGroup = (GroupGraphGroup)detailTraversedNodesList.get(index);
+ strMethodName = methodGroup.getGroupName();
+ intExecCount = methodGroup.getCounts();
+ ltotalTime = methodGroup.getTotalTime();
+ ltotalRunTime = methodGroup.getRunningTime();
+ lavgRunTime = ltotalTime/intExecCount;
+ ltotalCPUTime = methodGroup.getTotalCPUTime();
+ lavgCPUTime = ltotalCPUTime/intExecCount;
+
+ intSumCount += intExecCount;
+
+ if(ltotalTime < 0)
+ {
+ strTotalTime = "UNKNOWN";
+
+ }else{
+ lsumTotalTime += ltotalTime;
+ strTotalTime = "" + ltotalTime;
+ }
+ if(ltotalRunTime < 0)
+ {
+ strTotalRunTime = "NOT EXIT";
+ strAvgRunTime = "UNKNOWN";
+ }else{
+ lsumTotalRunTime += ltotalRunTime;
+ strTotalRunTime = "" + ltotalRunTime;
+ strAvgRunTime = "" + lavgRunTime;
+ }
+ if(ltotalCPUTime < 0)
+ {
+ strTotalCPUTime = "NOT EXIT";
+ strAvgCPUTime = "UNKNOWN";
+ }else{
+ lsumTotalCPUTime += ltotalCPUTime;
+ strTotalCPUTime = "" + ltotalCPUTime;
+ strAvgCPUTime = "" + lavgCPUTime;
+ }
+
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+
+ line++;
+ out.print("<td>"+line+"</td>");
+ out.print("<td>" + GroupUtil.convertToHTML(strMethodName)+ "</td>");
+ out.print("<td>" + intExecCount+ "</td>");
+ out.print("<td>" + strTotalTime+ "</td>");
+ out.print("<td>" + strTotalRunTime+ "</td>");
+ out.print("<td>" + strAvgRunTime+ "</td>");
+ out.print("<td>" + strTotalCPUTime+ "</td>");
+ out.print("<td>" + strAvgCPUTime+ "</td></tr>");
+ }
+ /*
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+ out.print("<td></td>");
+ out.print("<td>Sum</td>");
+ out.print("<td>" + intSumCount+ "</td>");
+ out.print("<td>" + lsumTotalTime+ "</td>");
+ out.print("<td>" + lsumTotalRunTime+ "</td>");
+ out.print("<td>-</td>");
+ out.print("<td>" + lsumTotalCPUTime+ "</td>");
+ out.print("<td>-</td></tr>");
+ */
+%>
+</table>
+</body>
+</html>
Added: trunk/java/webRoot/detailPackageSummary.jsp
===================================================================
--- trunk/java/webRoot/detailPackageSummary.jsp (rev 0)
+++ trunk/java/webRoot/detailPackageSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,155 @@
+
+<%
+/**
+ * @author Huijuan Shao
+ when method did't exit,if some fields of the table was negative numbers,
+ it shows UNKNOWN or NOT EXIT.
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree"%>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode"%>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat"%>
+<%@ page import="org.jboss.profiler.tracerModel.GroupGraphGroup"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="java.util.Stack"%>
+<%--page errorPage="./JspException.jsp" --%>
+
+ <%
+ String strPackageName = "";
+ String strSortType = "up";
+ String strSortStandard = "";
+ int line = 0;
+ int intExecCount = 0;
+ long ltotalTime = 0;
+ long ltotalRunTime = 0;
+ long lavgRunTime = 0;
+ long ltotalCPUTime = 0;
+ long lavgCPUTime = 0;
+ int intSumCount=0;
+ long lsumTotalTime=0;
+ long lsumTotalRunTime = 0;
+ long lsumTotalCPUTime = 0;
+
+ String strTotalTime = "";
+ String strTotalRunTime = "";
+ String strTotalCPUTime = "";
+ String strAvgRunTime = "";
+ String strAvgCPUTime = "";
+
+ GroupGraphGroup packageGroup = null;
+ ArrayList detailTraversedNodesList = jbtTransactionTree.traverseForDetailInfo("package");
+
+ strSortType = request.getParameter("sort");
+ strSortStandard = request.getParameter("order");
+ if(null != strSortType){
+
+ if(strSortType.equals("up")){
+ strSortType = "down";
+ SPYGroupComparator.sort = "down";
+ } else{
+ strSortType = "up";
+ SPYGroupComparator.sort = "up";
+ }
+ }
+ %>
+ <table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">NO.</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=GroupName' title='sort according to package name'>Package Name</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=ExecutedCount' title='sort according to exec count'>Exec Count</a></td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=TotalTime' title='sort according to total time'>Total Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=TotalRunningTime' title='sort according to total running time'>Total Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=AverageRunningTime' title='sort according to average running time'>Avg Running Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=TotalCPUTime' title='sort according to total CPU time'>Total CPU Time</td>
+ <td nowrap="nowrap"><a style='COLOR:WHITE;text-decoration:underline' href='detailPackageSummary.jsp?sort=<%=strSortType %>&order=AverageCPUTime' title='sort according to average CPU time'>Avg CPU Time</td>
+ </tr>
+
+ <%
+ if(null != strSortStandard){
+ Collections.sort(detailTraversedNodesList, new SPYGroupComparator(strSortStandard));
+ }
+ int iLen = detailTraversedNodesList.size();
+ for(int index = 0; index < iLen; index++){
+ packageGroup = (GroupGraphGroup)detailTraversedNodesList.get(index);
+ strPackageName = packageGroup.getGroupName();
+ intExecCount = packageGroup.getCounts();
+ ltotalTime = packageGroup.getTotalTime();
+ ltotalRunTime = packageGroup.getRunningTime();
+ lavgRunTime = ltotalTime/intExecCount;
+ ltotalCPUTime = packageGroup.getTotalCPUTime();
+ lavgCPUTime = ltotalCPUTime/intExecCount;
+
+ intSumCount += intExecCount;
+ if(ltotalTime < 0)
+ {
+ strTotalTime = "UNKNOWN";
+
+ }else{
+ lsumTotalTime += ltotalTime;
+ strTotalTime = "" + ltotalTime;
+ }
+ if(ltotalRunTime < 0)
+ {
+ strTotalRunTime = "NOT EXIT";
+ strAvgRunTime = "UNKNOWN";
+ }else{
+ lsumTotalRunTime += ltotalRunTime;
+ strTotalRunTime = "" + ltotalRunTime;
+ strAvgRunTime = "" + lavgRunTime;
+ }
+ if(ltotalCPUTime < 0)
+ {
+ strTotalCPUTime = "NOT EXIT";
+ strAvgCPUTime = "UNKNOWN";
+ }else{
+ lsumTotalCPUTime += ltotalCPUTime;
+ strTotalCPUTime = "" + ltotalCPUTime;
+ strAvgCPUTime = "" + lavgCPUTime;
+ }
+
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+
+ line++;
+ out.print("<td>"+line+"</td>");
+ out.print("<td>" + GroupUtil.convertToHTML(strPackageName)+ "</td>");
+ out.print("<td>" + intExecCount+ "</td>");
+ out.print("<td>" + strTotalTime+ "</td>");
+ out.print("<td>" + strTotalRunTime+ "</td>");
+ out.print("<td>" + strAvgRunTime+ "</td>");
+ out.print("<td>" + strTotalCPUTime+ "</td>");
+ out.print("<td>" + strAvgCPUTime+ "</td></tr>");
+
+ }
+ /*
+ if ((line)%2==0)
+ {
+ out.println("<tr bgcolor=white>");
+ }
+ else
+ {
+ out.println("<tr bgcolor=\"#cccccc\">");
+ }
+ out.print("<td></td>");
+ out.print("<td>Sum</td>");
+ out.print("<td>" + intSumCount+ "</td>");
+ out.print("<td>" + lsumTotalTime+ "</td>");
+ out.print("<td>" + lsumTotalRunTime+ "</td>");
+ out.print("<td>-</td>");
+ out.print("<td>" + lsumTotalCPUTime+ "</td>");
+ out.print("<td>-</td></tr>");
+ */
+%>
+</table>
Added: trunk/java/webRoot/groupPath.jsp
===================================================================
--- trunk/java/webRoot/groupPath.jsp (rev 0)
+++ trunk/java/webRoot/groupPath.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,54 @@
+ <%
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+%>
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTree_top.inc"%>
+
+
+
+<%
+ try {
+ // Integer transactionID = new Integer(request.getParameter("transactionID"));
+ String group = request.getParameter("group");
+
+ //for debug
+ //out.print("transactionID: " + transactionID);
+ //out.print("group: " + group);
+
+ String urlBasesrc = "transactionID=" + transactionID ;
+ urlBasesrc+="&group=" + group;
+
+ String urlParameter = "/groupGraphServer?" + urlBasesrc;
+
+ // System.out.println(urlParameter);
+%>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ The following is the applet grouping by
+<%= group %>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+<APPLET CODE="org.jboss.profiler.graphapplet.GroupGraphApplet" WIDTH=100% HEIGHT=100% ALT="Applet"
+ ARCHIVE="graphApplet.jar" MAYSCRIPT>
+<param name = "url" value="<%=urlParameter%>">
+</APPLET>
+
+<%
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+%>
Added: trunk/java/webRoot/methodSummary.jsp
===================================================================
--- trunk/java/webRoot/methodSummary.jsp (rev 0)
+++ trunk/java/webRoot/methodSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,257 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%
+ try {
+
+ if (request.getParameter("initial")!=null){
+ Integer transactionID1 = new Integer(request.getParameter("transactionID"));
+
+ session.removeAttribute("usergroupslist");
+ ArrayList tokenizedMethod = new ArrayList();
+
+ HashMap processMethods = jbpProcess.getSpyMethods();
+
+ JBTTransaction keyTransaction = new JBTTransaction();
+ Iterator iter = searchedTransactions.values().iterator();
+
+ while ( iter.hasNext() ){
+ keyTransaction = (JBTTransaction) iter.next();
+ if ( keyTransaction.getTransactionID()==transactionID1.intValue() )
+ break;
+ }
+
+ ArrayList transactionMethods = keyTransaction.getMethods();
+
+ JBTTransactionTree jbtTransactionTree1=new JBTTransactionTree(keyTransaction);
+
+ jbtTransactionTree1.traverseSetNames(processMethods);
+
+ TracerFilterForm tracerFilterForm=(TracerFilterForm)request.getSession().getAttribute("tracerFilterForm");
+ if(tracerFilterForm==null)
+ tracerFilterForm=new TracerFilterForm();
+ tracerFilterForm.setJbtTransactionTree(jbtTransactionTree1);
+ tracerFilterForm.setTracedTransactionID(transactionID1);
+
+ ArrayList treeArrayList= jbtTransactionTree1.traverseGetArrayList();
+
+ JBTTransactionTreeNode firstMethodNode=(JBTTransactionTreeNode)treeArrayList.get(0);
+ tracerFilterForm.setStartMethodNode(firstMethodNode);
+ session.setAttribute("tracerFilterForm",tracerFilterForm);
+ }
+ %>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTree_top.inc"%>
+
+<%
+
+ final int QTD_REGISTRO_PAGINA=20;
+ String searchOptions = "";
+ String tmpPage = request.getParameter("page");
+ int paginaCorrente = 0;
+ if (tmpPage!=null) {
+ paginaCorrente=Integer.parseInt(tmpPage);
+ }
+
+ String filter="";
+ if (request.getParameter("filter")!=null) {
+ filter=request.getParameter("filter");
+ }
+
+ String order="";
+ if (request.getParameter("order")!=null) {
+ order = request.getParameter("order");
+ }
+
+ String sort="down";
+ if (request.getParameter("sort")!=null) {
+ sort = request.getParameter("sort");
+ }
+
+ String sortReverse="up";
+ if (sort.equals("up")) {
+ sortReverse = "down";
+ }
+ else {
+ sortReverse = "up";
+ }
+
+%>
+
+<div align=center width="100%">
+<FORM ACTION="./methodSummary.jsp" METHOD=GET>
+<table>
+ <tr>
+ <td>
+ Filter
+ </td>
+ <td>
+ <INPUT TYPE="text" name="filter" value="<%=filter%>" class="texto">
+ </td>
+ <td colspan=2><input type="submit" value="Execute" class="botaoPadrao"></td>
+ </tr>
+
+ </table>
+ </FORM>
+</div>
+
+<table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td> </td>
+ <td nowrap="nowrap"><a title='sort according package name' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=PackageName&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Method Name</a></td>
+ <td nowrap="nowrap"><a title='sort according executed count' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=ExecutedCount&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Executed Count</a></td>
+ <td nowrap="nowrap"><a title='sort according total time' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total running time' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average running time' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total CPU time' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total CPU Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average CPU time' href="./methodSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg CPU Time</a></td>
+
+<%
+
+ ArrayList treeArrayList= jbtTransactionTree.traverseGetArrayList();
+
+ GroupUtil util=new GroupUtil();
+
+ ArrayList arrayGroups1=util.generateCallings(jbtTransactionTree).getGroups();
+ session.setAttribute("methodGroup",arrayGroups1);
+ if (sort.equals("down")) SPYGroupComparator.sort = "up";
+ else SPYGroupComparator.sort = "down";
+
+ Collections.sort(arrayGroups1,new SPYGroupComparator(order));
+
+ //the following is used to filter.
+ ArrayList arrayGroups=new ArrayList();
+ Iterator iter = arrayGroups1.iterator();
+ while(iter.hasNext()){
+ GroupGraphGroup group=(GroupGraphGroup)iter.next();
+ if(group.getGroupName().startsWith(filter) || filter=="")
+ arrayGroups.add(group);
+ }
+
+ //before all the methods show,we want to show them in many pages.
+ int inicio = paginaCorrente*QTD_REGISTRO_PAGINA;
+ int fim = inicio+QTD_REGISTRO_PAGINA;
+
+ if ( fim>=arrayGroups.size() ) {
+ fim=arrayGroups.size();
+ }
+
+ for(int line=inicio;line<fim;line++){
+ GroupGraphGroup tmpGroup=(GroupGraphGroup)arrayGroups.get(line);
+
+ String methodName=tmpGroup.getName();
+ int groupId = tmpGroup.getGroupID();
+
+ if ((line)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+
+ out.print("<td> </td>");
+
+ out.print("<td>");
+ out.print("<style type=\"text/css\">a{text-decoration:none;color:#000066} a:active{text-decoration:none;color:red} a:hover{text-decoration:underline;front-weight:bold;color:#990099}</style>");
+
+ out.print( GroupUtil.convertToHTML(methodName) + "</a></td>");
+ out.print("<td>" + tmpGroup.getCounts() + "</td>");
+
+ if (tmpGroup.getTotalTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalTime() + "</td>");
+ }
+ else{
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getRunningTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getRunningTime() + "</td>");
+ out.print("<td>" + (float)tmpGroup.getRunningTime()/tmpGroup.getCounts() + "</td>");
+ }
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getTotalCPUTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalCPUTime()+ "</td>");
+ out.print("<td>" + (float)tmpGroup.getTotalCPUTime()/tmpGroup.getCounts() + "</td>");
+ }
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ out.println("</tr>");
+ //end: the folliwng content is the same with that in the for
+
+ }//end of showing
+
+ session.setAttribute("jbtTransactionTree",jbtTransactionTree);
+
+%>
+</table>
+
+<br>
+<table align=center class="TABELA">
+<%
+ int qtdMaxPaginas=arrayGroups.size()/QTD_REGISTRO_PAGINA;
+ if (arrayGroups.size()%QTD_REGISTRO_PAGINA>0) {
+ qtdMaxPaginas++;
+ }
+%>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;"><td colspan=4 align=center>Page <%=paginaCorrente%> of <%=(qtdMaxPaginas-1)%></td></tr>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+<td><a style="COLOR:WHITE;text-decoration:underline" href="./methodSummary.jsp?filter=<%=filter%>&page=0&order=<%=order%>&sort=<%=sort%>">First Page </a></td>
+
+<td>
+<%
+
+ if (paginaCorrente>0) {
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./methodSummary.jsp?filter="+filter+"&page=" + (paginaCorrente-1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Previous
+<%
+ if (paginaCorrente>0) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ // out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./methodSummary.jsp?filter="+filter+"&page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Next
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+//out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./methodSummary.jsp?filter="+filter+"&page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort+"\">");
+%>
+Last Page
+<%
+out.println("</a>");
+%>
+
+</tr>
+</table>
+</body>
+</html>
+<%
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+%>
\ No newline at end of file
Added: trunk/java/webRoot/packageSummary.jsp
===================================================================
--- trunk/java/webRoot/packageSummary.jsp (rev 0)
+++ trunk/java/webRoot/packageSummary.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,217 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+
+<%@ include file="traceTree.inc" %>
+<%@ include file="traceTree_top.inc"%>
+
+ <%
+ try {
+ final int QTD_REGISTRO_PAGINA=20;
+ String searchOptions = "";
+ String tmpPage = request.getParameter("page");
+ int paginaCorrente = 0;
+ if (tmpPage!=null) {
+ paginaCorrente=Integer.parseInt(tmpPage);
+ }
+
+ String filter="";
+ if (request.getParameter("filter")!=null) {
+ filter=request.getParameter("filter");
+ }
+
+ String order="";
+ if (request.getParameter("order")!=null) {
+ order = request.getParameter("order");
+ }
+
+ String sort="up";
+ if (request.getParameter("sort")!=null) {
+ sort = request.getParameter("sort");
+ }
+
+ String sortReverse="";
+ if (sort.equals("down")) {
+ sortReverse = "up";
+ }
+ else {
+ sortReverse = "down";
+ }
+
+%>
+<div align=center width="100%">
+<FORM ACTION="./packageSummary.jsp" METHOD=GET>
+<table>
+ <tr>
+ <td>
+ Filter
+ </td>
+ <td>
+ <INPUT TYPE="text" name="filter" value="<%=filter%>" class="texto">
+ </td>
+ <td colspan=2><input type="submit" value="Execute" class="botaoPadrao"></td>
+ </tr>
+
+ </table>
+ </FORM>
+</div>
+
+<table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td> </td>
+ <td nowrap="nowrap"><a title='sort according package name' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=PackageName&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Package Name</a></td>
+ <td nowrap="nowrap"><a title='sort according executed count' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=ExecutedCount&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Executed Count</a></td>
+ <td nowrap="nowrap"><a title='sort according total time' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total running time' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average running time' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageRunningTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg Running Time</a></td>
+ <td nowrap="nowrap"><a title='sort according total CPU time' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=TotalCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Total CPU Time</a></td>
+ <td nowrap="nowrap"><a title='sort according average CPU time' href="./packageSummary.jsp?filter=<%=filter%>&page=<%=paginaCorrente%>&order=AverageCPUTime&sort=<%=sortReverse %>" style="color:white;text-decoration:underline">Avg CPU Time</a></td>
+
+<%
+ GroupUtil util=new GroupUtil();
+
+ org.jboss.profiler.model.JBPProcess spyProcess = beanFilter.getJbpProcess();
+ HashMap spyMethods = spyProcess.getSpyMethods();
+
+ ArrayList arrayGroups1=util.generateCallings(spyMethods,jbtTransactionTree,"package").getGroups();
+
+ if (sort.equals("up")) SPYGroupComparator.sort = "down";
+ else SPYGroupComparator.sort = "up";
+
+ Collections.sort(arrayGroups1,new SPYGroupComparator(order));
+
+ //the following is used to filter.
+ ArrayList arrayGroups=new ArrayList();
+ Iterator iter = arrayGroups1.iterator();
+ while(iter.hasNext()){
+ GroupGraphGroup group=(GroupGraphGroup)iter.next();
+ if(group.getGroupName().startsWith(filter) || filter=="")
+ arrayGroups.add(group);
+ }
+
+ //before all the methods show,we want to show them in many pages.
+ int inicio = paginaCorrente*QTD_REGISTRO_PAGINA;
+ int fim = inicio+QTD_REGISTRO_PAGINA;
+
+ if ( fim>=arrayGroups.size() ) {
+ fim=arrayGroups.size();
+ }
+
+ for(int line=inicio;line<fim;line++){
+ GroupGraphGroup tmpGroup=(GroupGraphGroup)arrayGroups.get(line);
+
+ String methodName=tmpGroup.getGroupName();
+
+ if ((line)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+
+ out.print("<td> </td>");
+
+ out.print("<td>");
+ out.print("<style type=\"text/css\">a{text-decoration:none;color:#000066} a:active{text-decoration:none;color:red} a:hover{text-decoration:underline;front-weight:bold;color:#990099}</style>");
+ out.print( methodName + "</a></td>");
+
+ out.print("<td>" + tmpGroup.getCounts() + "</td>");
+
+ if (tmpGroup.getTotalTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalTime() + "</td>");
+ }
+ else{
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getRunningTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getRunningTime() + "</td>");
+ out.print("<td>" +(float)tmpGroup.getRunningTime()/tmpGroup.getCounts() + "</td>");
+ }
+
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ if (tmpGroup.getTotalCPUTime()>= 0.0d) {
+ out.print("<td>" + tmpGroup.getTotalCPUTime()+ "</td>");
+ out.print("<td>" + (float)tmpGroup.getTotalCPUTime()/tmpGroup.getCounts() + "</td>");
+ }
+
+ else{
+ out.print("<td>NOT EXIT</td>");
+ out.print("<td>UNKNOWN</td>");
+ }
+
+ out.println("</tr>");
+ //end: the folliwng content is the same with that in the for
+
+ }//end of showing
+
+%>
+</table>
+
+<br>
+<table align=center class="TABELA">
+<%
+ int qtdMaxPaginas=arrayGroups.size()/QTD_REGISTRO_PAGINA;
+ if (arrayGroups.size()%QTD_REGISTRO_PAGINA>0) {
+ qtdMaxPaginas++;
+ }
+%>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;"><td colspan=4 align=center>Page <%=paginaCorrente%> of <%=(qtdMaxPaginas-1)%></td></tr>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+<td><a style="COLOR:WHITE;text-decoration:underline" href="./packageSummary.jsp?filter=<%=filter%>&page=0&order=<%=order%>&sort=<%=sort%>">First Page </a></td>
+
+<td>
+<%
+
+ if (paginaCorrente>0) {
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./packageSummary.jsp?filter="+filter+"&page=" + (paginaCorrente-1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Previous
+<%
+ if (paginaCorrente>0) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ // out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./packageSummary.jsp?filter="+filter+"&page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort+"\">");
+ }
+
+%>
+Next
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+//out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./packageSummary.jsp?filter="+filter+"&page=" + (qtdMaxPaginas-1)+ "&order=" + order + "&sort=" + sort+"\">");
+%>
+Last Page
+<%
+out.println("</a>");
+%>
+
+</tr>
+</table>
+</body>
+</html>
+<%
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+%>
\ No newline at end of file
Added: trunk/java/webRoot/packageViewException.jsp
===================================================================
--- trunk/java/webRoot/packageViewException.jsp (rev 0)
+++ trunk/java/webRoot/packageViewException.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,35 @@
+
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTree_top.inc"%>
+<table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ The following is the applet grouping by package
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table width=100% align=center>
+ <tr align=center >
+ <td align=center>
+ <font size=6 color='blue'>The methods are all in default package!</font>
+ </td>
+ </tr>
+ <tr align=center >
+ <td align=center>
+ <font size=6 color='blue'>Package relationship is unnecessary.</font>
+ </td>
+ </tr>
+ </table>
\ No newline at end of file
Added: trunk/java/webRoot/referenceAddNewGroup.html
===================================================================
--- trunk/java/webRoot/referenceAddNewGroup.html (rev 0)
+++ trunk/java/webRoot/referenceAddNewGroup.html 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,159 @@
+<head>
+<title>Group Information Input</title>
+
+
+<script language="javascript">
+var giseditting = false;
+function addoptions()
+{
+ var prioselect = document.getElementById('newpriority');
+ var newoption;
+ for(var i=10; i<=100; i+=10){
+ newoption = document.createElement("option");
+ newoption.text = i;
+ newoption.value=i;
+ prioselect.options.add(newoption);
+}
+ addOptionToShArea('full','full');
+ addOptionToShArea('package','package');
+ addOptionToShArea('class','class');
+ addOptionToShArea('method','method');
+ document.getElementById('newgroupname').focus();
+ document.getElementById('newgroupname').select();
+}
+//private
+function addOptionToShArea(txt,value)
+{
+ var schareaselect = document.getElementById('newsearcharea');
+ var newoption = document.createElement("option");
+ newoption.text = txt;
+ newoption.value= value;
+ schareaselect.options.add(newoption);
+
+}
+
+
+function inputOK(){
+ var validatevalue = opener.validateinput(window);
+ if(validatevalue == opener.DUP_NAME){
+ alert('Duplicate Group Name!');
+ }
+ else if(validatevalue == opener.EMP_NAME){
+ alert('Please input group name');
+ }
+ else if(validatevalue == opener.INV_STRI){
+ alert('Goupname can contain numbers, letters, spaces only!');
+ }
+ else if(validatevalue == opener.VAL_SUCE){
+ opener.updategroupinfo(window);
+ if(giseditting){
+ inputDone();
+ }
+ }
+
+}
+
+function inputDone(){
+ window.opner = null;
+ window.close();
+}
+
+function setvalues(vvalues){
+var searcharea = document.getElementById('newsearcharea');
+var newinclude = document.getElementById('newinclude');
+var newexclude = document.getElementById('newexclude');
+
+
+document.getElementById('newgroupname').value = vvalues[0];
+document.getElementById('newpriority').value = vvalues[1];
+
+ if(vvalues[2]!='-'||vvalues[3]!='-'){
+ searcharea.value = 'full';
+ newinclude.value = vvalues[2];
+ newexclude.value = vvalues[3];
+ }
+ if(vvalues[4]!='-'||vvalues[5]!='-'){
+ searcharea.value = 'package';
+ newinclude.value = vvalues[4];
+ newexclude.value = vvalues[5];
+ }
+ if(vvalues[6]!='-'||vvalues[7]!='-'){
+ searcharea.value = 'class';
+ newinclude.value = vvalues[6];
+ newexclude.value = vvalues[7];
+ }
+ if(vvalues[8]!='-'||vvalues[9]!='-'){
+ searcharea.value = 'method';
+ newinclude.value = vvalues[8];
+ newexclude.value = vvalues[9];
+ }
+}
+function callsetvalues(){
+
+ if(opener.gcuredittingseqnum >= 0){
+ giseditting = true;
+ var valuesarray = opener.gchildvalues;
+ if(valuesarray){
+ setvalues(valuesarray);
+ opener.gchildvalues = null;
+ }
+ }
+ else{
+ giseditting = false;
+ }
+}
+var gisselected=false;
+</script>
+
+</head>
+<body onload='addoptions(),callsetvalues()'>
+<table>
+ <tr>
+ <td>Group Name</td>
+ <td><input type="text" value='GroupName' name='newgroupname' id='newgroupname' onfocus= 'gisselected=false;' onclick='if(!gisselected){this.select();gisselected=true;};'></td>
+
+ </tr>
+ <tr>
+ <td>Priority</td>
+ <td>
+ <select name='newpriority' id= 'newpriority'>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Search Area</td>
+ <td>
+ <select name='newsearcharea' id='newsearcharea'>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Rule</td><td></td>
+ </tr>
+ <tr>
+ <td>include:</td>
+ <td><input type='text' value="'*'" name='newinclude' id='newinclude' onfocus= 'gisselected=false;' onclick='if(!gisselected){this.select();gisselected=true;};'/></td>
+ </tr>
+ <tr>
+ <td>exclude:</td>
+ <td><input type='text' value='-' name='newexclude' id='newexclude' onfocus= 'gisselected=false;' onclick='if(!gisselected){this.select();gisselected=true;};'/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <table align=right>
+ <tr>
+ <td style='width:50%'><input type='button' value='OK' onclick='inputOK()' style='width:100%;cursor:pointer'/></td>
+ <td style='width:50%'><input type='button' value='Done' onclick='inputDone()' style='width:100%;cursor:pointer'/></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</body>
+
+
+
+
+
+
Added: trunk/java/webRoot/referenceAppletView.jsp
===================================================================
--- trunk/java/webRoot/referenceAppletView.jsp (rev 0)
+++ trunk/java/webRoot/referenceAppletView.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,22 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<% String strappletnum = request.getParameter("appletnum");
+ String appletcode = null;
+ if(strappletnum.equals("applet1")){
+ appletcode = "org.jboss.profiler.graphapplet.UserGroupApplet";
+ }
+ else{
+ appletcode = "org.jboss.profiler.graphapplet.UserGroupApplet2";
+ }
+ %>
+<APPLET CODE="<%=appletcode %>" WIDTH=100% HEIGHT=80% ALT="Applet"
+ ARCHIVE="graphApplet.jar" MAYSCRIPT>
+<param name = "url" value="usergroupappletservlet">
+</APPLET>
\ No newline at end of file
Added: trunk/java/webRoot/referenceException.jsp
===================================================================
--- trunk/java/webRoot/referenceException.jsp (rev 0)
+++ trunk/java/webRoot/referenceException.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,9 @@
+<%
+/*
+ * @author Huijuan Shao
+*/
+%>
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+<table align=center><tr><td><font size=18 >Invalid File Format!</font><a href='./referenceSelect.jsp'>Back</a></td></tr></table>
\ No newline at end of file
Added: trunk/java/webRoot/referenceMethodView.jsp
===================================================================
--- trunk/java/webRoot/referenceMethodView.jsp (rev 0)
+++ trunk/java/webRoot/referenceMethodView.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,95 @@
+<%
+/**
+ * @author Huijuan Shao
+*/
+%>
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree"%>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode"%>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat"%>
+<%@ page import="org.jboss.profiler.tracerModel.GroupGraphGroup"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="java.io.InputStream"%>
+<%@ page import="org.jboss.profiler.tracerModel.UserGroup"%>
+
+<script type='text/javascript'>
+function submitform(){
+document.getElementById('choiceform').submit();
+}
+</script>
+
+
+
+<table align=center><tr><td>
+ <table width=100% align=center bgcolor='#ededed' border="0">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">Sequence No.&Caller</td>
+ <td nowrap="nowrap">Callee</td>
+ </tr>
+<%
+String strShowName = "";
+ArrayList userGroupsList = (ArrayList)session.getAttribute("usergroupinfo");
+HashMap groupRefMap = null;
+int num=0;
+for(int i=0; i<userGroupsList.size(); i++){
+ UserGroup curuserGroup = (UserGroup)userGroupsList.get(i);
+
+ //String strcurgroupName = curuserGroup.getStrGroupName();
+ groupRefMap = curuserGroup.getMethodRefMap();
+ if(null !=groupRefMap){
+ Iterator itr = groupRefMap.keySet().iterator();
+
+ while(itr.hasNext()){
+ num++;
+ //if(num>1){
+ out.println("<tr bgcolor='#cccccc'>");
+ //}
+ String strcurcaller = (String)itr.next();
+ out.println("<td>"+num+":"+GroupUtil.convertToHTML(strcurcaller)+"</td>");
+
+ ArrayList curcalleeList = (ArrayList)groupRefMap.get(strcurcaller);
+ int ilen = 0 ;
+ if(null != curcalleeList){
+ ilen = curcalleeList.size();
+ }
+ if(ilen == 0){
+ out.println("<td>no callee</td></tr>");
+ }
+ for(int inindex=0; inindex<ilen; inindex++){
+ if(inindex>0){
+ out.print("<tr><td></td>");
+ }
+ String curcallee = (String)curcalleeList.get(inindex);
+ out.println("<td>"+GroupUtil.convertToHTML(curcallee)+"</td></tr>");
+ }
+ out.println("</tr>");
+ }
+ }
+ else {
+ out.println("</tr>");
+ }
+}
+%>
+
+ </table>
+ </td>
+ </tr>
+ <tr><td>
+ <form name='choiceform' id='choiceform' action='./usergroupservlet' method='POST'>
+ <table width=100% align=center cellpadding='0' cellspacing='0'>
+ <tr bgcolor="#003366" height="10"><td></td><td></td></tr>
+ <tr bgcolor="#afafaf">
+ <td align=center>You can
+ <a style='text-decoration:underline;color:blue' href='usergroupdispatchservlet?reselect=true&requestType=showinfo'>select new group</a>,
+ <a style='text-decoration:underline;color:blue' href='usergroupdispatchservlet?reselect=false&requestType=showinfo&edit=true'>edit group</a>
+ or <font style="color:blue; text-decoration: underline;cursor:pointer;" onclick='submitform()'>export</font> the group definition information to your local disk</td>
+ <td><input type='hidden' name='requestType' value='download'><td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+</table>
Added: trunk/java/webRoot/referenceSelect.jsp
===================================================================
--- trunk/java/webRoot/referenceSelect.jsp (rev 0)
+++ trunk/java/webRoot/referenceSelect.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,590 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="org.jboss.profiler.tracerModel.UserGroup"%>
+
+<script type="text/javascript">
+
+var ggroupseqnum = 1;
+var NOVALUE = '-';
+var gchildwindow;
+var gchildvalues;
+var gcuredittingseqnum = -1;
+var ggroupamnt = 0;
+var DUP_NAME = "duplicatename";
+var EMP_NAME = "emptyname";
+var VAL_SUCE = "validatesuccess";
+var INV_STRI ="invalidstring";
+
+
+function trim(vstr)
+{
+ var ret = vstr;
+ return ret;
+}
+function parsestr(vstr){
+ var ret = vstr;
+ if (ret==""){
+ ret = "-";
+ }
+ return ret;
+}
+
+function initpage(){
+<%
+
+ String strrequestType = request.getParameter("requestType");
+ String strappletnum = request.getParameter("appletnum");
+ if(null == strrequestType){
+ strrequestType = "showinfo";
+ }
+ //the "parsedusergroups" attribute is set in servlet when user uploads group definition file to server
+ ArrayList usrgroupList = (ArrayList)session.getAttribute("parsedusergroups");
+ if(null == usrgroupList){
+ usrgroupList = (ArrayList)session.getAttribute("usergroupinfo");
+ }
+ boolean isreloaded = false;
+ if(null != usrgroupList){
+ isreloaded = true;
+ for(int i=0; i<usrgroupList.size(); i++){
+ UserGroup curusrGroup = (UserGroup)usrgroupList.get(i);
+ String strcurgroupName = curusrGroup.getStrGroupName();
+ if(strcurgroupName == null){
+
+ usrgroupList.remove(i);
+ continue;
+ }
+ strcurgroupName = strcurgroupName.replace("'","\\'");
+ strcurgroupName = strcurgroupName.replace("\"","\\\"");
+ %>
+
+ addchildtostoreform('groupname', parsestr("<%=strcurgroupName%>"));
+ addchildtostoreform('groupseqnum',"<%=curusrGroup.getIgroupSeqNo() %>");
+ addchildtostoreform('priority', "<%=curusrGroup.getIpriority() %>");
+ addchildtostoreform('ifullcondition', parsestr("<%=curusrGroup.getStrifullcond() %>"));
+ addchildtostoreform('imethodcondition', parsestr("<%=curusrGroup.getStrimethodcond() %>"));
+ addchildtostoreform('iclasscondition', parsestr("<%=curusrGroup.getStriclasscond() %>"));
+ addchildtostoreform('ipackagecondition', parsestr( "<%=curusrGroup.getStripackagecond() %>"));
+ addchildtostoreform('efullcondition', parsestr("<%=curusrGroup.getStrefullcond() %>"));
+ addchildtostoreform('emethodcondition', parsestr("<%=curusrGroup.getStremethodcond() %>"));
+ addchildtostoreform('eclasscondition', parsestr("<%=curusrGroup.getStreclasscond() %>"));
+ addchildtostoreform('epackagecondition', parsestr("<%=curusrGroup.getStrepackagecond() %>"));
+
+ ggroupamnt += 1;
+ ggroupseqnum += 1;
+
+ <%
+ }
+ }
+ else{%>
+ addchildtostoreform('groupname', 'Group' );
+ addchildtostoreform('groupseqnum',1);
+ addchildtostoreform('priority', '10');
+ addchildtostoreform('ifullcondition',"'*'" );
+ addchildtostoreform('imethodcondition', '-' );
+ addchildtostoreform('iclasscondition', '-');
+ addchildtostoreform('ipackagecondition', '-');
+ addchildtostoreform('efullcondition', '-' );
+ addchildtostoreform('emethodcondition', '-' );
+ addchildtostoreform('eclasscondition', '-');
+ addchildtostoreform('epackagecondition', '-' );
+
+ ggroupamnt += 1;
+ ggroupseqnum += 1;
+<%
+ }
+ session.removeAttribute("parsedusergroups");
+
+%>
+
+
+ refreshIframe();
+}
+
+
+function refreshIframe(){
+
+ var storeform = document.getElementById('groupsstoreform');
+ storeform.groupamount.value = ggroupamnt;
+ window.frames["selectedgroup"].refresh(storeform);
+
+}
+function showaddgroupdialog(){
+ var cwidth = 360;
+ var cheight = 180;
+ var cx = window.screen.width/2-cwidth/2;
+ var cy = window.screen.height/2 - cheight/2;
+ var cattrstr = "dialog=yes,width="+cwidth+",height="+230+",resizable,modal=yes,top="+cy+",left="+cx;
+ var addgroupDialog = window.open("referenceAddNewGroup.html","no name",cattrstr);
+ gchildwindow = addgroupDialog;
+}
+function showuploaddialog(){
+ var cwidth = 360;
+ var cheight = 180;
+ var cx = window.screen.width/2-cwidth/2;
+ var cy = window.screen.height/2 - cheight/2;
+ var cattrstr = "dialog=yes,width="+cwidth+",height="+230+",resizable,modal=yes,top="+cy+",left="+cx;
+ var addgroupDialog = window.open("referenceUpload.html","no name",cattrstr);
+}
+function updategroupinfo(childwindow){
+
+ updateGroupInfotoForm(childwindow);
+ refreshIframe();
+}
+function deleteGroup(){
+ var selectedgroupseqnum = window.frames["selectedgroup"].gselectedgroupnum;
+ if(selectedgroupseqnum < 0){
+ alert("Please select a group first!");
+ return;
+ }
+ var confirmed = confirm("Are you sure to delete it?");
+ if(!confirmed){
+ return;
+ }
+ var storeform = document.getElementById('groupsstoreform');
+ var length = ggroupamnt;
+ var groupseqnum;
+ if(length == 1){
+ groupseqnum = storeform.groupseqnum.value;
+ if(selectedgroupseqnum == groupseqnum){
+
+ storeform.removeChild(storeform.groupname);
+ storeform.removeChild(storeform.groupseqnum);
+ storeform.removeChild(storeform.priority);
+ storeform.removeChild(storeform.ifullcondition);
+ storeform.removeChild(storeform.ipackagecondition);
+ storeform.removeChild(storeform.iclasscondition);
+ storeform.removeChild(storeform.imethodcondition);
+ storeform.removeChild(storeform.efullcondition);
+ storeform.removeChild(storeform.epackagecondition);
+ storeform.removeChild(storeform.eclasscondition);
+ storeform.removeChild(storeform.emethodcondition);
+ ggroupamnt -= 1;
+ window.frames["selectedgroup"].gselectedgroupnum = -1;
+
+ }
+ }
+ else if(length>1){
+ for(var i=0; i<length; i++){
+ groupseqnum = storeform.groupseqnum[i].value;
+ if(groupseqnum == selectedgroupseqnum){
+ storeform.removeChild(storeform.groupname[i]);
+ storeform.removeChild(storeform.groupseqnum[i]);
+ storeform.removeChild(storeform.priority[i]);
+ storeform.removeChild(storeform.ifullcondition[i]);
+ storeform.removeChild(storeform.ipackagecondition[i]);
+ storeform.removeChild(storeform.iclasscondition[i]);
+ storeform.removeChild(storeform.imethodcondition[i]);
+ storeform.removeChild(storeform.efullcondition[i]);
+ storeform.removeChild(storeform.epackagecondition[i]);
+ storeform.removeChild(storeform.eclasscondition[i]);
+ storeform.removeChild(storeform.emethodcondition[i]);
+ ggroupamnt -= 1;
+ window.frames["selectedgroup"].gselectedgroupnum = -1;
+ break;
+ }
+ }
+ }
+ refreshIframe();
+}
+
+function editGroup()
+{
+ var selectedgroupseqnum = window.frames["selectedgroup"].gselectedgroupnum;
+ gchildvalues = new Array(10);
+ gcuredittingseqnum = selectedgroupseqnum;
+
+ if(selectedgroupseqnum < 0 ){
+ alert("Please select a group first!");
+ return;
+ }
+
+ var storeform = document.getElementById('groupsstoreform');
+ var groupname = '';
+ var groupprio = '';
+ var ifullcondition = NOVALUE;
+ var imethodcondition = NOVALUE;
+ var iclasscondition = NOVALUE;
+ var ipackagecondition = NOVALUE;
+ var efullcondition = NOVALUE;
+ var emethodcondition = NOVALUE;
+ var eclasscondition = NOVALUE;
+ var epackagecondition = NOVALUE;
+ var length = ggroupamnt;
+
+ if(length == 1){
+
+ groupname = storeform.groupname.value;
+ groupprio = storeform.priority.value;
+ ifullcondition = storeform.ifullcondition.value;
+ imethodcondition = storeform.imethodcondition.value;
+ iclasscondition = storeform.iclasscondition.value;
+ ipackagecondition = storeform.ipackagecondition.value;
+ efullcondition = storeform.efullcondition.value;
+ emethodcondition = storeform.emethodcondition.value;
+ eclasscondition = storeform.eclasscondition.value;
+ epackagecondition = storeform.epackagecondition.value;
+ }
+
+ else if(length>1){
+ var index=-1;
+ var seqnum = -1;
+ for(var i=0;i<length;i++){
+ seqnum = storeform.groupseqnum[i].value;
+ if(seqnum ==selectedgroupseqnum){
+ index = i;
+ break;
+ }
+ }
+ groupname = storeform.groupname[index].value;
+ groupprio = storeform.priority[index].value;
+ ifullcondition = storeform.ifullcondition[index].value;
+ imethodcondition = storeform.imethodcondition[index].value;
+ iclasscondition = storeform.iclasscondition[index].value;
+ ipackagecondition = storeform.ipackagecondition[index].value;
+ efullcondition = storeform.efullcondition[index].value;
+ emethodcondition = storeform.emethodcondition[index].value;
+ eclasscondition = storeform.eclasscondition[index].value;
+ epackagecondition = storeform.epackagecondition[index].value;
+ }
+
+ gchildvalues[0] = groupname;
+ gchildvalues[1] = groupprio;
+ gchildvalues[2] = ifullcondition;
+ gchildvalues[3] = efullcondition;
+ gchildvalues[4] = ipackagecondition;
+ gchildvalues[5] = epackagecondition;
+ gchildvalues[6] = iclasscondition;
+ gchildvalues[7] = eclasscondition;
+ gchildvalues[8] = imethodcondition;
+ gchildvalues[9] = emethodcondition;
+ gchildwindow = showaddgroupdialog();
+
+}
+
+//private
+function updateGroupInfotoForm(vchildwindow)
+{
+
+ var selectedArea = vchildwindow.document.getElementById("newsearcharea").value;
+ var ifullcondition = NOVALUE;
+ var imethodcondition = NOVALUE;
+ var iclasscondition = NOVALUE;
+ var ipackagecondition = NOVALUE;
+ var efullcondition = NOVALUE;
+ var emethodcondition = NOVALUE;
+ var eclasscondition = NOVALUE;
+ var epackagecondition = NOVALUE;
+
+ var groupname = trim(vchildwindow.document.getElementById('newgroupname').value);
+ var priority = vchildwindow.document.getElementById('newpriority').value;
+ var include = trim(vchildwindow.document.getElementById('newinclude').value);
+ var exclude = trim(vchildwindow.document.getElementById('newexclude').value);
+
+ if(selectedArea == 'full'){
+ ifullcondition = include;
+ efullcondition = exclude;
+ }
+ else if(selectedArea == 'package'){
+ ipackagecondition = include;
+ epackagecondition = exclude;
+ }
+ else if(selectedArea == 'class'){
+ iclasscondition = include;
+ eclasscondition = exclude;
+ }
+ else if(selectedArea == 'method'){
+ imethodcondition = include;
+ emethodcondition = exclude;
+ }
+ if(gcuredittingseqnum < 0){
+
+ addchildtostoreform('groupname', groupname);
+ addchildtostoreform('groupseqnum', ggroupseqnum);
+ addchildtostoreform('priority', priority);
+ addchildtostoreform('ifullcondition', ifullcondition);
+ addchildtostoreform('imethodcondition', imethodcondition);
+ addchildtostoreform('iclasscondition', iclasscondition);
+ addchildtostoreform('ipackagecondition', ipackagecondition);
+ addchildtostoreform('efullcondition', efullcondition);
+ addchildtostoreform('emethodcondition', emethodcondition);
+ addchildtostoreform('eclasscondition', eclasscondition);
+ addchildtostoreform('epackagecondition', epackagecondition);
+
+
+ ggroupamnt += 1;
+ ggroupseqnum += 1;
+ }
+ else{
+
+ var childvalues = new Array(11);
+ childvalues[0] = groupname;
+ childvalues[1] = priority
+ childvalues[2] = ifullcondition;
+ childvalues[3] = ipackagecondition;
+ childvalues[4] = iclasscondition;
+ childvalues[5] = imethodcondition;
+ childvalues[6] = efullcondition;
+ childvalues[7] = epackagecondition;
+ childvalues[8] = eclasscondition;
+ childvalues[9] = emethodcondition;
+ updatestoreform(childvalues, gcuredittingseqnum);
+ gcuredittingseqnum = -1;
+ }
+
+}
+//private
+function addchildtostoreform(name, value)
+{
+//alert("addchild to store form: name="+name+", value="+value);
+ var ainput = document.createElement('input');
+ ainput.setAttribute('type', 'hidden');
+ ainput.setAttribute('name', name);
+ ainput.setAttribute('size', '10');
+ ainput.setAttribute('value', value);
+ var storeform = document.getElementById('groupsstoreform');
+ storeform.appendChild(ainput);
+}
+
+//private
+function updatestoreform(vchildvalues, vseqnum){
+
+
+ var storeform = document.getElementById('groupsstoreform');
+ var length = ggroupamnt;
+ var groupseqnum;
+ if(length == 1){
+ groupseqnum = storeform.groupseqnum;
+ if(groupseqnum.value == vseqnum){
+ storeform.groupname.value = vchildvalues[0];
+ storeform.priority.value = vchildvalues[1];
+ storeform.ifullcondition.value = vchildvalues[2];
+ storeform.ipackagecondition.value = vchildvalues[3];
+ storeform.iclasscondition.value = vchildvalues[4];
+ storeform.imethodcondition.value = vchildvalues[5];
+ storeform.efullcondition.value = vchildvalues[6];
+ storeform.epackagecondition.value = vchildvalues[7];
+ storeform.eclasscondition.value = vchildvalues[8];
+ storeform.emethodcondition.value = vchildvalues[9];
+ }
+ }
+ else if(length > 1){
+ groupseqnum = storeform.groupseqnum;
+ var index = -1;
+ for(var i = 0; i<length; i++){
+ if(groupseqnum[i].value == vseqnum){
+ index = i;
+ break;
+ }
+ }
+
+ if(index >= 0){
+ storeform.groupname[index].value = vchildvalues[0];
+ storeform.priority[index].value = vchildvalues[1];
+ storeform.ifullcondition[index].value = vchildvalues[2];
+ storeform.ipackagecondition[index].value = vchildvalues[3];
+ storeform.iclasscondition[index].value = vchildvalues[4];
+ storeform.imethodcondition[index].value = vchildvalues[5];
+ storeform.efullcondition[index].value = vchildvalues[6];
+ storeform.epackagecondition[index].value = vchildvalues[7];
+ storeform.eclasscondition[index].value = vchildvalues[8];
+ storeform.emethodcondition[index].value = vchildvalues[9];
+ }
+ }
+
+
+}
+ function submitStoreForm(requestType)
+ {
+
+ var groupamount = document.getElementById('groupamount');
+
+
+ groupamount.value = ggroupamnt;
+ document.getElementById('requestType').value = requestType;
+ document.getElementById('groupsstoreform').submit();
+
+ }
+function validateinput(vchildwindow){
+ var newgroupname = trim(vchildwindow.document.getElementById('newgroupname').value);
+ var selectedgroupnum = window.frames["selectedgroup"].gselectedgroupnum;
+ var iseditting = vchildwindow.giseditting;
+ var length = ggroupamnt;
+ var storeform = document.getElementById('groupsstoreform');
+ var groupname;
+ if(!validatestr(newgroupname)){
+ return INV_STRI;
+ }
+ if(newgroupname.length==0){
+ return EMP_NAME;
+ }
+ if(iseditting){
+ if(length == 1){ //if there is only one group, group name won't duplicate
+ return VAL_SUCE;
+ }
+ else if(length > 1){
+ groupname = storeform.groupname;
+ groupseqnum = storeform.groupseqnum;
+ var i;
+ for(i = 0; i<groupname.length; i++){
+
+ if(groupseqnum[i].value == ''+selectedgroupnum){
+ continue;
+ }
+ if(groupname[i].value == newgroupname){
+ break;
+ }
+ }
+ if(i == groupname.length){
+ return VAL_SUCE;
+ }
+ else {
+ return DUP_NAME;
+ }
+ }
+ else{
+ return VAL_SUCE;
+ }
+ }
+ else{
+ if(length == 1){
+ groupname = storeform.groupname;
+ groupseqnum = storeform.groupseqnum;
+ if(groupname.value == newgroupname){
+ return DUP_NAME;
+ }
+ else{
+ return VAL_SUCE;
+ }
+
+ }
+ else if(length > 1){
+ groupname = storeform.groupname;
+ groupseqnum = storeform.groupseqnum;
+ var i;
+ for(i = 0; i<groupname.length; i++){
+ if(groupname[i].value == newgroupname){
+ break;
+ }
+ }
+ if(i == groupname.length){
+ return VAL_SUCE;
+ }
+ else {
+ return DUP_NAME;
+ }
+ }
+ else{
+ return VAL_SUCE;
+ }
+ }
+}
+function validatestr(vstr){
+ var pattern=/^[0-9a-z\sA-Z]*$/;
+ var a = pattern.test(vstr);
+ return a;
+}
+
+</script>
+
+
+<body onload='initpage()'>
+
+<form name='importfileform' id='importfileform' enctype="multipart/form-data" action="./usergroupuploadservlet" method="post">
+
+<table align=center border="0" cellpadding="0" cellspacing="0"><!--1-->
+<tr style="height:330">
+ <td>
+ <iframe name="selectedgroup" id="selectedgroup" width=760 height=330 name='aa' scrolling=yes frameborder=1 src="./referenceSelectedgroups.html" style="overflow-x:hidden;overflow-y:yes;" frameborder="no" marginwidth="0" marginheight="0" >
+ </iframe>
+ </td>
+ <td>
+ <table style="height:100%" border="0"><!--1.1-->
+ <tr>
+ <td>You can input group information by<br>uploading group definition file here,<br>the group information will be<br>displayed in the left talbe</td>
+ </tr>
+ <tr>
+ <td><input name="importfilename" id='importfilename' type=file></td>
+ </tr>
+ <tr>
+ <td><input name="display" id="display" type="submit" value="display" style="cursor:pointer"></td>
+ </tr>
+ <tr style="height:90%">
+ <td valign=bottom>
+ <table style="height:30%" border="0"><!--1.1.2-->
+ <tr>
+ <td>
+ <input style="width:100%;cursor:pointer" type="button" value="add" onclick = "showaddgroupdialog()"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input style="width:100%;cursor:pointer" type="button" value="edit" onclick = "editGroup()"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input style="width:100%;cursor:pointer" type="button" value="delete" onclick = "deleteGroup()"/>
+ </td>
+ </tr>
+ </table><!--1.1.2-->
+ </td>
+ </tr>
+ </table><!--1.1-->
+ </td>
+</tr>
+<tr>
+ <td align=right>
+ <table width="100%" cellspacing="0" cellpadding="0" border="0">
+ <tr>
+ <td width=80%></td>
+ <td align=right width=20%>
+ <table>
+ <tr>
+ <td align=right>
+ <input style="width:100%;cursor:pointer" type="button" value="submit" onclick='submitStoreForm("<%=strrequestType %>")'/>
+ </td>
+ </tr>
+ <tr>
+ <td align=right>
+ <input style="width:100%;cursor:pointer" type="button" value="export" onclick='submitStoreForm("download")'/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ <td>
+ </td>
+
+</tr>
+
+</table><!--1-->
+</form>
+
+<form name='groupsstoreform' id='groupsstoreform' action='./usergroupservlet' method='POST'>
+<input type='hidden' name='groupamount' id='groupamount'>
+<input type='hidden' name='requestType' id='requestType'>
+<input type='hidden' name='appletnum' id='appletnum' value='<%=strappletnum%>'>
+</form>
+
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/java/webRoot/referenceSelectedgroups.html
===================================================================
--- trunk/java/webRoot/referenceSelectedgroups.html (rev 0)
+++ trunk/java/webRoot/referenceSelectedgroups.html 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,224 @@
+
+
+
+
+
+<script>
+
+var gselectedgroupnum = -1;
+var gselectedrownum = -1;
+
+
+
+
+function refresh( storeform ){
+
+ var groupname,priority,groupseqnum,ifull,imethod,iclass,ipackage,efull,emethod,eclass,epackage;
+
+ var length = storeform.groupamount.value;
+
+ if(length == 1 ){
+ removeAllRowsFromTable();
+ groupname = storeform.groupname.value;
+ priority = storeform.priority.value;
+ groupseqnum = storeform.groupseqnum.value;
+
+
+ ifull = storeform.ifullcondition.value;
+ imethod = storeform.imethodcondition.value;
+ iclass = storeform.iclasscondition.value;
+ ipackage = storeform.ipackagecondition.value;
+
+ efull = storeform.efullcondition.value;
+ emethod = storeform.emethodcondition.value;
+ eclass = storeform.eclasscondition.value;
+ epackage = storeform.epackagecondition.value;
+
+ addRowToTable(groupname ,priority,groupseqnum,ifull,imethod,iclass,ipackage
+ ,efull,emethod,eclass,epackage);
+
+ }
+ else if(length > 1){
+
+ groupname = storeform.groupname;
+ priority = storeform.priority;
+ groupseqnum = storeform.groupseqnum;
+
+ ifull = storeform.ifullcondition;
+ imethod = storeform.imethodcondition;
+ iclass = storeform.iclasscondition;
+ ipackage = storeform.ipackagecondition;
+
+ efull = storeform.efullcondition;
+ emethod = storeform.emethodcondition;
+ eclass = storeform.eclasscondition;
+ epackage = storeform.epackagecondition;
+
+ removeAllRowsFromTable();
+ for(var i=0; i<length; i++){
+ addRowToTable(groupname[i].value
+ ,priority[i].value,groupseqnum[i].value
+ ,ifull[i].value
+ ,imethod[i].value,iclass[i].value
+ ,ipackage[i].value,efull[i].value
+ ,emethod[i].value,eclass[i].value
+ ,epackage[i].value);
+ }
+ }
+
+ else if(length == 0){
+ removeAllRowsFromTable();
+ }
+
+ if(gselectedgroupnum > 0){
+ selectrow(gselectedrownum,gselectedrownum);
+ }
+
+}
+function selectrow(vrownum,vgroupseqnum){
+
+ var table = document.getElementById('groupinfotable');
+ var row = table.rows[vrownum];
+
+ var length = table.rows.length;
+
+ for(var i=1; i<length; i++){
+ table.rows[i].setAttribute("bgcolor","white");
+ }
+ row.setAttribute("bgcolor","#cfcfcf");
+ gselectedgroupnum = vgroupseqnum;
+ gselectedrownum = vrownum;
+}
+function clearrows(){
+ var table = document.getElementById('groupinfotable');
+ var length = table.rows.length;
+
+ for(var i=1; i<length; i++){
+ table.rows[i].setAttribute("bgcolor","white");
+ }
+ gselectedgroupnum = -1;
+ gselectedrownum = -1;
+
+
+}
+ function addRowToTable(groupname,priority,groupseqnum
+ ,ifull,imethod,iclass,ipackage
+ ,efull,emethod,eclass,epackage)
+ {
+
+ var tbl = document.getElementById('groupinfotable');
+ var lastRow = tbl.rows.length;
+ var row = tbl.insertRow(lastRow);
+
+ insertNewTxtCell(row,groupname,0,"150");
+ //insertNewTxtCell(row,groupseqnum,1,"20");
+ insertNewTxtCell(row,priority,1,"20");
+ var cellcondition = row.insertCell(2);
+
+ //insertNewHiddenCell(row,"groupseqnum",groupseqnum,3);
+
+
+
+ row.setAttribute("onclick","selectrow("+lastRow+","+groupseqnum+")");
+ row.setAttribute("style","cursor:pointer");
+
+
+
+ var celltable = document.createElement("table");
+ celltable.setAttribute("cellpadding","0");
+ celltable.setAttribute("align","center");
+ celltable.setAttribute("style","width:100%");
+ celltable.setAttribute("border","0");
+ var subrow = celltable.insertRow(0);
+ insertNewTxtCell(subrow,ipackage,0,"20%");
+ insertNewTxtCell(subrow,iclass,1,"20%");
+ insertNewTxtCell(subrow,imethod,2,"20%");
+ insertNewTxtCell(subrow,ifull,3,"20%");
+ insertNewTxtCell(subrow,"include",4,"20%");
+ //insertNewButtonCell(subrow,"delete",5,"parent.deleteGroup('"+groupseqnum+"')");
+ subrow = celltable.insertRow(1);
+ insertNewTxtCell(subrow,epackage,0,"20%");
+ insertNewTxtCell(subrow,eclass,1,"20%");
+ insertNewTxtCell(subrow,emethod,2,"20%");
+ insertNewTxtCell(subrow,efull,3,"20%");
+ insertNewTxtCell(subrow,"exclude",4,"20%");
+ //insertNewButtonCell(subrow,"edit",5,"parent.editGroup('"+groupseqnum+"')");
+
+
+
+ cellcondition.appendChild(celltable);
+
+ }
+
+function insertNewTxtCell(row,txt,number,width)
+{
+ var curcell = row.insertCell(number);
+ curcell.setAttribute("style","width:"+width);
+ curcell.setAttribute("align","center");
+ var curtxt = document.createTextNode(txt);
+ curcell.appendChild(curtxt);
+}
+/*
+function insertNewButtonCell(row,txt,number,functionname)
+{
+ var curcell = row.insertCell(number);
+ curcell.setAttribute("style","width:20%");
+ curcell.setAttribute("align","center");
+ var button = document.createElement("input");
+ button.setAttribute("type","button");
+ button.setAttribute("style","width:100%");
+ button.setAttribute("value",txt);
+ button.setAttribute("onclick",functionname);
+ curcell.appendChild(button);
+
+}*/
+/*
+function insertNewHiddenCell(row,name,value,number){
+ var curcell = row.insertCell(number);
+ curcell.setAttribute("name","hiddencell");
+ var hiddeninput = document.createElement("input");
+
+ hiddeninput.setAttribute("name",name);
+ hiddeninput.setAttribute("type","hidden");
+ hiddeninput.setAttribute("value",value);
+
+ curcell.appendChild(hiddeninput);
+
+
+}
+*/
+ function removeAllRowsFromTable()
+ {
+ var tbl = document.getElementById('groupinfotable');
+ var lastRow = tbl.rows.length;
+ //alert("lastRow"+lastRow);
+ for(var i=1; i<lastRow; i++){
+ tbl.deleteRow(1);
+ }
+ }
+
+</script>
+<body>
+<form>
+<table width="740" align=center border=0 name='groupinfotable' id='groupinfotable' bgcolor="#efefef">
+<tr bgcolor="#bfbfcc">
+<td align=center style="width:23%">Group Name</td>
+<!--<td align=center style="width:12%">Group NO.</td>-->
+<td align=center style="width:10%">Priority</td>
+<td align=center style="width:55%">
+ <table cellpadding="0" border=0 style="width:100%">
+ <tr>
+ <td align=center style="width:20%">Package</td>
+ <td align=center style="width:20%">Class</td>
+ <td align=center style="width:20%">Method</td>
+ <td align=center style="width:20%">Full</td>
+ <td align=center style="width:20%">Rule</td>
+ <tr>
+ </table>
+</td>
+</tr>
+<table>
+
+</form>
+<body>
+
Added: trunk/java/webRoot/referenceView.jsp
===================================================================
--- trunk/java/webRoot/referenceView.jsp (rev 0)
+++ trunk/java/webRoot/referenceView.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,33 @@
+
+<%
+/**
+ * @author Yoko Seki & Huijuan Shao
+*/
+%>
+<%@ page import='org.jboss.profiler.web.form.TracerFilterForm'%>
+<%
+String strreqTag = request.getParameter("reselect");
+String strReqType = request.getParameter("requestType");
+String strappletnum = request.getParameter("appletnum");
+String strforwardPage = "";
+ if(null != strreqTag){
+ strforwardPage = "/./referenceSelect.jsp";
+ }
+ else{
+ if(null == session.getAttribute("usergroupinfo")){
+ strforwardPage = "/./referenceSelect.jsp";
+ }
+ else{
+ if("showinfo".equals(strReqType)){
+ strforwardPage = "/./referenceMethodView.jsp";
+ }
+ if("showapplet".equals(strReqType)){
+ strforwardPage = "/./referenceAppletView.jsp";
+ }
+ }
+ }
+ServletContext sc = getServletContext();
+RequestDispatcher rd = sc.getRequestDispatcher(strforwardPage);
+rd.forward(request,response);
+%>
+
Added: trunk/java/webRoot/traceTransactionMenu.inc
===================================================================
--- trunk/java/webRoot/traceTransactionMenu.inc (rev 0)
+++ trunk/java/webRoot/traceTransactionMenu.inc 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,60 @@
+<%@ page import="java.util.*,org.jboss.profiler.model.*, org.jboss.profiler.util.*" %>
+<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
+<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
+
+<bean:define id="beanFilter" type="org.jboss.profiler.web.form.FilterForm" name="filterForm"/>
+<bean:define id="jbpProcess" type="org.jboss.profiler.model.JBPProcess" name="filterForm" property="jbpProcess"/>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<link rel="stylesheet" type="text/css" href="./imgs/profilerStyles.css">
+<html>
+<head>
+</head>
+<!-- <body bgcolor="#eeeeee" > -->
+<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#003399" vlink="#003399" alink="#003399">
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ # transaction executed from <bean:write name="beanFilter" property="jbpProcess.date"/> till <bean:write name="beanFilter" property="jbpProcess.finishDate"/>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b color=blue>jboss-profiler</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="./download/model.obj" target="_top" style="text-decoration: none;">save data</a></b></td>
+
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="./excelHelper.jsp" target="_top" style="text-decoration: none;">consolidated view</a></b></td>
+
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="./threadView.jsp" target="_top" style="text-decoration: none;">thread view</a></b></td>
+
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" width=150><b class="mdfc0b"><a href="./processView.jsp" target="_top" style="text-decoration: none;">process view</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="40%" nowrap="nowrap" align=center ><b>jboss-profiler</b></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td bgcolor="#dddddd" height="20" align=center nowrap="nowrap">
+ Process View
+ </td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="./processMethods.jsp" target="_top" style="text-decoration: none;">methods</a></b></td>
+
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="./memoryState.jsp" target="_top" style="text-decoration: none;">memory</a></b></td>
+ <td bgcolor="#dddddd" height="20" align=center nowrap="nowrap">
+ Process View
+ </td>
+
+ </tr>
+ </table>
+</body>
+</html>
\ No newline at end of file
Added: trunk/java/webRoot/traceTree.inc
===================================================================
--- trunk/java/webRoot/traceTree.inc (rev 0)
+++ trunk/java/webRoot/traceTree.inc 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,11 @@
+ <%
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+%>
+
+<%@page import="java.util.*,java.text.*,org.jboss.profiler.tracerModel.*,org.jboss.profiler.engine.TransactionSearchEngine,org.jboss.profiler.web.form.TracerFilterForm" %>
+
+<bean:define id="tracerBeanFilter" type="org.jboss.profiler.web.form.TracerFilterForm" name="tracerFilterForm"/>
+<bean:define id="jbtTransactionTree" type="org.jboss.profiler.tracerModel.JBTTransactionTree" name="tracerFilterForm" property="jbtTransactionTree"/>
+<bean:define id="transactionID" type="Integer" name="tracerFilterForm" property="tracedTransactionID"/>
\ No newline at end of file
Added: trunk/java/webRoot/traceTreeDetail_top.inc
===================================================================
--- trunk/java/webRoot/traceTreeDetail_top.inc (rev 0)
+++ trunk/java/webRoot/traceTreeDetail_top.inc 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,90 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+ <html>
+<head>
+<style type="text/css">
+a.hoverchange{text-decoration: none;}
+a.hoverchange:link{text-decoration: none;}
+a.hoverchange:visitied{text-decoration: none;}
+a.hoverchange:c { text-decoration:none; }
+a.hoverchange:hover {text-decoration: none;
+color: #66388E;
+}
+
+</style>
+
+</head>
+<!-- <body bgcolor="#eeeeee" > -->
+<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#003399" vlink="#003399" alink="#003399">
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ NO.
+<%= transactionID%>
+ transaction executed from
+<%= tracerBeanFilter.getStartMethodStartTime()%>
+ till
+<%= tracerBeanFilter.getStartMethodEndTime() %>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ with start method
+<%= tracerBeanFilter.getStartMethodName()%>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b color=blue>Summary</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./methodSummary.jsp" target="_top" title="switch to method summary page">method list</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./transactionMethodsDetail.jsp?" target="_top">detail method list</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="40%" nowrap="nowrap" align=center ><b>Summary</b></td>
+ </table></td>
+ </tr>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+
+
+
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b color=blue>Detail Summary</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./detailPackageSummary.jsp" target="_top">package detail</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./detailClassSummary.jsp" target="_top">class detail</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./detailMethodSummary.jsp" target="_top">method detail</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="40%" nowrap="nowrap" align=center ><b>Detail Summary</b></td>
+ </td>
+
+
+
+ </tbody>
+ </table>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <td bgcolor="#dddddd" height="20" width="20%" align=center nowrap="nowrap"><b color=blue>Group</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=170 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./usergroupdispatchservlet?requestType=showinfo" target="_top">group list</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=170 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./usergroupdispatchservlet?requestType=showgroupeddetail" target="_top">group detail method</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=170 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./usergroupdispatchservlet?requestType=showapplet&appletnum=applet1" target="_top" >calling tree applet</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=170 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a class="hoverchange" href="./usergroupdispatchservlet?requestType=showapplet&appletnum=applet2" target="_top" >sequence diagram applet</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="20%" nowrap="nowrap" align=center ><b>Group</b></td>
+ </table>
+
+
\ No newline at end of file
Added: trunk/java/webRoot/traceTree_top.inc
===================================================================
--- trunk/java/webRoot/traceTree_top.inc (rev 0)
+++ trunk/java/webRoot/traceTree_top.inc 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,74 @@
+ <%
+/**
+ * @author Yoko Seki & Huijuan Shao
+ */
+%>
+ <html>
+<head>
+</head>
+<!-- <body bgcolor="#eeeeee" > -->
+<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#003399" vlink="#003399" alink="#003399">
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ NO.
+<%= transactionID%>
+ transaction executed from
+<%= tracerBeanFilter.getStartMethodStartTime()%>
+ till
+<%= tracerBeanFilter.getStartMethodEndTime() %>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="100%" align=center nowrap="nowrap">
+ <b color=blue>
+ with start method
+<%= tracerBeanFilter.getStartMethodName()%>
+ </b>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tbody>
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b color=blue>Summary</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="<%=request.getContextPath()%>/packageSummary.jsp" target="_top" style="text-decoration: none;">package summary</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="<%=request.getContextPath()%>/classSummary.jsp" target="_top" style="text-decoration: none;">class summary</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" width=150 valign="middle" align="center" height="20" nowrap="nowrap"><b class="mdfc0b"><a href="<%=request.getContextPath()%>/methodSummary.jsp" target="_top" style="text-decoration: none;">method summary</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="40%" nowrap="nowrap" align=center ><b>Summary</b></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b color=blue>Applet View</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="<%=request.getContextPath()%>/groupPath.jsp?group=package" target="_top" style="text-decoration: none;">package applet</a></b></td>
+
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="<%=request.getContextPath()%>/groupPath.jsp?group=class" target="_top" style="text-decoration: none;">class applet</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="40%" align=center nowrap="nowrap"><b>Applet View</b></td>
+ </tr>
+ </table>
+
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td bgcolor="#dddddd" height="20" width="35%" align=center nowrap="nowrap"><b color=blue>Traced Methods</b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="<%=request.getContextPath()%>/transactionMethods.jsp?page=0&initial=yes" target="_top" style="text-decoration: none;">methods list</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="<%=request.getContextPath()%>/transactionMethodsTree/methodTree.jsp" target="_top" style="text-decoration: none;">methods tree</a></b></td>
+ <td bgcolor="#eeeeee" nowrap="nowrap" valign="middle" align="center" height="20" ><b class="mdfc0b"><a href="<%=request.getContextPath()%>/detailMethodSummary.jsp" target="_top" style="text-decoration: none;" title="switch to detail page">detail</a></b></td>
+ <td bgcolor="#dddddd" height="20" width="35%" align=center nowrap="nowrap"><b>Traced Methods</b></td>
+ </tr>
+ </table>
\ No newline at end of file
Added: trunk/java/webRoot/transactionMethodGroupedDetail.jsp
===================================================================
--- trunk/java/webRoot/transactionMethodGroupedDetail.jsp (rev 0)
+++ trunk/java/webRoot/transactionMethodGroupedDetail.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,83 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree" %>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode" %>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat" %>
+<%@ page import="org.jboss.profiler.tracerModel.UserGraphCell" %>
+<%@ page import="java.util.Date" %>
+
+
+
+<table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">Relative Running Time</td>
+ <td nowrap="nowrap">Depth</td>
+ <td nowrap="nowrap">Method Name</td>
+ <td nowrap="nowrap">Method Order</td>
+ <td nowrap="nowrap">Detail Start Time</td>
+ <td nowrap="nowrap">Detail End Time</td>
+ <td nowrap="nowrap">Running Time</td>
+ <td nowrap="nowrap">Method Running Time</td>
+ </tr>
+
+ <%
+
+ ArrayList detailedList = (ArrayList)session.getAttribute("groupeddetaillist");
+ SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss.SSS");
+ long lstarttime = 0;
+ int ilen=0;
+ if(null != detailedList){
+ ilen = detailedList.size();
+ }
+ if(ilen > 0){
+ lstarttime = ((UserGraphCell)detailedList.get(0)).istarttime;
+ }
+ String strcolor = "";
+ for(int i =0; i<ilen; i++){
+ UserGraphCell curCell = (UserGraphCell)detailedList.get(i);
+ if(i%2 != 0){
+ strcolor="#cccccc";
+ }
+ else{
+ strcolor = "white";
+ }
+ String strmethodOrder = "";
+ String strmethodEndtime ="";
+ String strmethodRunningtime = "";
+ String strrunningTime = "";
+ strmethodOrder = curCell.imethodorder<0?"":(curCell.imethodorder+"");
+ strmethodEndtime = curCell.iendtime<0?"NOT EXIT":(sdf.format(new Date(curCell.iendtime)));
+ strrunningTime = curCell.iendtime<0?"UNKNOWN":((curCell.iendtime - curCell.istarttime)+"");
+ strmethodRunningtime = curCell.methodrunningtime<0?"":(curCell.methodrunningtime+"");
+
+ %>
+ <tr bgcolor="<%=strcolor %>">
+ <td><%=curCell.istarttime - lstarttime %></td>
+ <td><%=curCell.idepth%></td>
+ <td><%=GroupUtil.convertToHTML(curCell.strmethodName)%></td>
+ <td><%=strmethodOrder%></td>
+ <td><%=sdf.format(new Date(curCell.istarttime))%></td>
+ <td><%=strmethodEndtime%></td>
+ <td><%=strrunningTime%></td>
+ <td><%=strmethodRunningtime%></td>
+
+ </tr>
+
+
+ <%
+ }
+ session.removeAttribute("groupeddetaillist");
+
+ %>
+
+
+</table>
Modified: trunk/java/webRoot/transactionMethods.jsp
===================================================================
--- trunk/java/webRoot/transactionMethods.jsp 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/java/webRoot/transactionMethods.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -28,21 +28,58 @@
%>
<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTree_top.inc"%>
-<table class="TABELA">
- <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
- <td nowrap="nowrap">Methods Order</td>
- <td nowrap="nowrap">Start Time</td>
- <td nowrap="nowrap">End Time</td>
- <td nowrap="nowrap">Total Time</td>
- <td nowrap="nowrap">CPU Time</td>
- <td nowrap="nowrap">#Locks</td>
- <td nowrap="nowrap">Lock Time</td>
- </tr>
+<html>
+<head>
+<style type="text/css">
+
+
+a.style1:visited {
+text-decoration: underline;
+color: #66388E;
+font-weight: normal;
+}
+a.style1:hover {
+text-decoration: none;
+color: #66388E;
+font-weight: normal;
+}
+
+</style>
+</head>
+<body>
+
+
<%
try {
- Integer transactionID = new Integer(request.getParameter("transactionID"));
+ final int QTD_REGISTRO_PAGINA=12;
+ String searchOptions = "";
+ String tmpPage = request.getParameter("page");
+ int paginaCorrente = 0;
+ if (tmpPage!=null) {
+ paginaCorrente=Integer.parseInt(tmpPage);
+ }
+
+%>
+
+
+<table class="table">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;" >
+ <td> </td>
+ <td nowrap="nowrap">Methods Order</td>
+ <td nowrap="nowrap">Depth</td>
+ <td nowrap="nowrap">Start Time</td>
+ <td nowrap="nowrap">End Time</td>
+ <td nowrap="nowrap">Total Time</td>
+ <td nowrap="nowrap">Method Running Time</td>
+ <td nowrap="nowrap">CPU Time</td>
+ <td nowrap="nowrap">#Locks</td>
+ <td nowrap="nowrap">Lock Time</td>
+
+<%
ArrayList tokenizedMethod = new ArrayList();
if (request.getParameter("methodInclude")!=null)
@@ -50,120 +87,195 @@
StringTokenizer methodToken = new StringTokenizer(request.getParameter("methodInclude"), " ");
while (methodToken.hasMoreTokens())
- {
+ {
tokenizedMethod.add(methodToken.nextToken());
}
- }
+ }
- JBTTransaction keyTransaction = new JBTTransaction();
- Iterator iter = searchedTransactions.values().iterator();
- while ( iter.hasNext() )
- {
- keyTransaction = (JBTTransaction) iter.next();
- if ( keyTransaction.getTransactionID()==transactionID.intValue() )
- break;
- }
+
+ ArrayList treeArrayList= jbtTransactionTree.traverseGetArrayList();
+
+
+ //before all the methods show,we want to show them in many pages.
+ int inicio = paginaCorrente*QTD_REGISTRO_PAGINA;
+ int fim = inicio+QTD_REGISTRO_PAGINA;
- ArrayList transactionMethods = keyTransaction.getMethods();
- HashMap processMethods = jbpProcess.getSpyMethods();
+ if ( fim>=treeArrayList.size() ) {
+ fim=treeArrayList.size();
+ }
+
+ for(int line=inicio;line<fim;line++){
+ JBTTransactionTreeNode tmpNode=(JBTTransactionTreeNode)treeArrayList.get(line);
+ JBTMethod transactionMethod=tmpNode.getJBTMethod();
+ String methodName=tmpNode.getName();
+
+ if (transactionMethod.getNumberOfLocks()!=0)
+ {
+ out.println("<tr bgcolor=red>");
+ } else
+ {
+ if ((line)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+ }
+
+ out.println("<td><a class='style1' title='Click see detailed methods Info' href=\"./transactionMethodsDetail.jsp?lineNo=" + tmpNode.getSequenceNo() + "\" target=\"_blank\"><img src='./imgs/arrow.gif'></a></td>");
+
+
+
+
+ out.print("<td>");
+
+ out.print(" ");
- int line=0;
- for ( int i=0; i<transactionMethods.size(); i++ )
- {
- JBTMethod transactionMethod = (JBTMethod) transactionMethods.get(i);
- String methodName = "";
+ boolean methodColor = false;
+ if (request.getParameter("methodInclude")!=null)
+ {
+ for (int k=0; k<tokenizedMethod.size(); k++)
+ {
+ if (methodName.indexOf((String)tokenizedMethod.get(k))>=0)
+ {
+ methodColor = true;
+ break;
+ }
+ }
+ }
+
+ //added by shao 2006-12-11
+ //out.print("<stylesheet type=\"text/css\" href=\"transactionMethodsTree/treecss.css\">");
+ out.print("<a class='style1' title='Click see detailed Info' href=\"./transactionMethodsDetail.jsp?lineNo="+tmpNode.getSequenceNo()+" \">");
+
+ //modified GroupUtil.convertToHTML, 07-05-16 add tmpNode.getSequenceNo() before methodName
+ if (methodColor)
+ out.print("<font color="#0000ff"><b>" +tmpNode.getSequenceNo()+":"+GroupUtil.convertToHTML(methodName)+ "</b></font></a></td>");
+ else{
+ out.print(tmpNode.getSequenceNo()+":"+GroupUtil.convertToHTML(methodName) + "</a></td>");
+ }
+
+ out.print("<td>" + transactionMethod.getDepth() + "</td>");
- Iterator iter2 = processMethods.values().iterator();
- while ( iter2.hasNext() )
- {
- JBPMethod processMethod = (JBPMethod) iter2.next();
- if ( processMethod.getMethodID()==transactionMethod.getMethodID() )
- {
- methodName = processMethod.getSimplifiedName();
- break;
- }
- }
+ long startTime = transactionMethod.getElapsedClockStart();
+ long endTime = transactionMethod.getElapsedClockEnd();
- if (transactionMethod.getNumberOfLocks()!=0)
- {
- out.println("<tr bgcolor=red>");
- } else
- {
- if ((line++)%2==0) out.println("<tr bgcolor=white>");
- else out.println("<tr bgcolor=\"#cccccc\">");
- }
+ Date date1 = new Date (startTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
- out.print("<td>");
- for ( int k=1; k<3*transactionMethod.getDepth(); k++)
- {
- out.print(" ");
- }
+ if (endTime!=-1)
+ {
+ Date date2 = new Date(endTime);
+ out.print("<td>" + df.format(date2) + "</td>");
- boolean methodColor = false;
- if (request.getParameter("methodInclude")!=null)
- {
- for (int k=0; k<tokenizedMethod.size(); k++)
- {
- if (methodName.indexOf((String)tokenizedMethod.get(k))>=0)
- {
- methodColor = true;
- break;
- }
- }
- }
+ if ( (request.getParameter("methodElapse")!=null) &&
+ ((long)(endTime-startTime)>Long.parseLong(request.getParameter("methodElapse"))) )
+ {out.print("<td><font color="#0000ff"><b>" +
+ (long)(endTime-startTime) + "</b></font></td>");
+ }
+ else{
+ out.print("<td>" + (long)(endTime-startTime) + "</td>");
+ }
+ }
+ else
+ {
+ if ( (request.getParameter("methodElapse")!=null) )
+ {
+ out.print("<td><font color="#0000ff"><b>NOT EXIT</b></font></td>");
+ }
+ else{
+ out.print("<td>NOT EXIT</td>");
+ }
+ out.print("<td>UNKNOWN</td>");
+ }
- if (methodColor)
- out.print("<font color="#0000ff"><b>" + methodName + "</b></font></td>");
- else out.print(methodName + "</td>");
+ if(tmpNode.getMethodRunningTime()==-1){
+ out.print("<td>UNKNOWN</td>");
+ }else
+ out.print("<td>" + tmpNode.getMethodRunningTime() + "</td>");
+
+ long startCPU = transactionMethod.getClockStart();
+ long endCPU = transactionMethod.getClockEnd();
- long startTime = transactionMethod.getElapsedClockStart();
- long endTime = transactionMethod.getElapsedClockEnd();
+ if (endCPU!=-1) out.print("<td>" + (long)(endCPU-startCPU) + "</td>");
+ else out.print("<td>UNKNOWN</td>");
- Date date1 = new Date (startTime);
- DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
- out.print("<td>" + df.format(date1) + "</td>");
+ if (transactionMethod.getNumberOfLocks()==0)
+ {
+ out.print("<td> </td><td> </td>");
+ }
+ else
+ {
+ out.print("<td>" + transactionMethod.getNumberOfLocks() + "</td>");
+ out.print("<td>" + transactionMethod.getLockTime() + "</td>");
+ }
- if (endTime!=-1)
- {
- Date date2 = new Date(endTime);
- out.print("<td>" + df.format(date2) + "</td>");
+ out.println("</tr>");
+ //end: the folliwng content is the same with that in the for
+
+ }//end of showing
+%>
+</table>
- if ( (request.getParameter("methodElapse")!=null) &&
- ((long)(endTime-startTime)>Long.parseLong(request.getParameter("methodElapse"))) )
- out.print("<td><font color="#0000ff"><b>" +
- (long)(endTime-startTime) + "</b></font></td>");
- else out.print("<td>" + (long)(endTime-startTime) + "</td>");
- }
- else
- {
- if ( (request.getParameter("methodElapse")!=null) )
- out.print("<td><font color="#0000ff"><b>NOT EXIT</b></font></td>");
- else out.print("<td>NOT EXIT</td>");
+<br>
+<table align=center class="TABELA">
+<%
+ int qtdMaxPaginas=treeArrayList.size()/QTD_REGISTRO_PAGINA;
+ if (treeArrayList.size()%QTD_REGISTRO_PAGINA>0) {
+ qtdMaxPaginas++;
+ }
+%>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;"><td colspan=4 align=center>Page <%=paginaCorrente%> of <%=(qtdMaxPaginas-1)%></td></tr>
+<tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+<td><a style="COLOR:WHITE;text-decoration:underline" href="./transactionMethods.jsp?page=0">First Page </a></td>
- out.print("<td>UNKNOWN</td>");
- }
+<td>
+<%
- long startCPU = transactionMethod.getClockStart();
- long endCPU = transactionMethod.getClockEnd();
+ if (paginaCorrente>0) {
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./transactionMethods.jsp?page=" + (paginaCorrente-1) +"\">");
+ }
- if (endCPU!=-1) out.print("<td>" + (long)(endCPU-startCPU) + "</td>");
- else out.print("<td>UNKNOWN</td>");
+%>
+Previous
+<%
+ if (paginaCorrente>0) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ // out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (paginaCorrente+1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+ out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./transactionMethods.jsp?page=" + (paginaCorrente+1) +"\">");
+ }
- if (transactionMethod.getNumberOfLocks()==0)
- {
- out.print("<td> </td><td> </td>");
- }
- else
- {
- out.print("<td>" + transactionMethod.getNumberOfLocks() + "</td>");
- out.print("<td>" + transactionMethod.getLockTime() + "</td>");
- }
+%>
+Next
+<%
+ if ((paginaCorrente+1)<qtdMaxPaginas) {
+ out.println("</a>");
+ }
+%>
+</td>
+<td>
+<%
+//out.println("<a style=\"COLOR:WHITE;\" href=\"./allTransactions.jsp?page=" + (qtdMaxPaginas-1) +"&order=" + order + "&sort=" + sort + searchOptions + "\">");
+out.println("<a style=\"COLOR:WHITE;text-decoration:underline\" href=\"./transactionMethods.jsp?page=" + (qtdMaxPaginas-1) +"\">");
+%>
+Last Page
+<%
+out.println("</a>");
+%>
- out.println("</tr>");
- }
+</tr>
+</table>
+</body>
+</html>
+<%
}
catch (Exception e) {
e.printStackTrace();
}
%>
-</table>
+
+
+
Added: trunk/java/webRoot/transactionMethodsDetail.jsp
===================================================================
--- trunk/java/webRoot/transactionMethodsDetail.jsp (rev 0)
+++ trunk/java/webRoot/transactionMethodsDetail.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,313 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+
+<%@ include file="tracerInternal.inc"%>
+<%@ include file="traceTree.inc"%>
+<%@ include file="traceTreeDetail_top.inc"%>
+
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTree" %>
+<%@ page import="org.jboss.profiler.tracerModel.JBTTransactionTreeNode" %>
+<%@ page import="java.text.SimpleDateFormat,java.text.DateFormat" %>
+<%--page errorPage="./JspException.jsp" --%>
+
+<%
+ try {
+ final int QTD_REGISTRO_PAGINA=12;
+ String searchOptions = "";
+%>
+
+<table class="TABELA">
+ <tr bgcolor="#003366" bordercolor="#666666" style="COLOR:white;">
+ <td nowrap="nowrap">Relative Running Time</td>
+ <td nowrap="nowrap">Depth</td>
+ <td nowrap="nowrap">Method Name</td>
+ <td nowrap="nowrap">Method Order</td>
+ <td nowrap="nowrap">Detail Start Time</td>
+ <td nowrap="nowrap">Detail End Time</td>
+ <td nowrap="nowrap">Running Time</td>
+ <td nowrap="nowrap">Method Running Time</td>
+
+<%
+
+ String strLineNo =request.getParameter("lineNo");
+ int lineNo = 0;
+ if(null != strLineNo){
+ lineNo= Integer.parseInt(strLineNo);
+ }
+ JBTTransactionTreeNode root=jbtTransactionTree.getRoot();
+ //transverse the root node to caculate the time
+ Stack tmpStack=new Stack();
+ JBTTransactionTreeNode currentNode=root;
+ JBTTransactionTreeNode processedNode=null;
+ long processedStartTime=0;
+ long processedEndTime=0;
+ long threadStartTime=root.getJBTMethod().getElapsedClockStart();
+ int line=0;
+
+ /*the while condition currentNode!=null is no sense.
+ * because the end condition is that: if there's no data in the stack, break;
+ */
+ while(true){
+ processedStartTime=currentNode.getJBTMethod().getElapsedClockStart();
+ processedNode=currentNode;
+
+ if(currentNode.getRight()!=null) tmpStack.push(currentNode.getRight());
+
+ if(currentNode.getLeft()!=null ) {
+ currentNode=currentNode.getLeft();
+ /*these are real nodes, all the real node's start time is the same with
+ * the start time in JBTMethod
+ */
+ //processedStartTime=processedNode.getJBTMethod().getElapsedClockStart();
+ /*next time visiting currentNode's child node, don't need to insert any node
+ * but the currentNodes endtime= nextNode's startTime
+ */
+ processedEndTime=processedNode.getLeft().getJBTMethod().getElapsedClockStart();
+
+ /* begin: to show the info of processedNode*/
+
+ if(processedNode.getSequenceNo()==lineNo)
+ out.println("<tr bgcolor=#FFC5F5>");
+ else if ((line++)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+
+ if(processedStartTime==-1) out.print("<td>" + "UNKNOWN" + "</td>");
+ else out.print("<td>" +(processedStartTime-threadStartTime) + "</td>");
+
+ out.print("<td>" + processedNode.getJBTMethod().getDepth() + "</td>");
+
+ out.print("<td>" + GroupUtil.convertToHTML(processedNode.getName()) + "</td>");
+ out.print("<td>" + processedNode.getSequenceNo() + "</td>");
+
+ if(processedStartTime==-1) out.print("<td>" + "UNKNOWN" + "</td>");
+ else {
+ Date date1 = new Date (processedStartTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedStartTime + "</td>");
+ }
+
+ if(processedEndTime==-1){
+ out.print("<td>" + "NO EXIT" + "</td>");
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ }
+ else {
+ Date date1 = new Date (processedEndTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedEndTime + "</td>");
+ out.print("<td>" + (processedEndTime-processedStartTime) + "</td>");
+ }
+ if(processedNode.getMethodRunningTime()==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else
+ out.print("<td>" + processedNode.getMethodRunningTime() + "</td>");
+
+ out.println("</tr>");
+ /*end: to show the info*/
+
+ }
+ else{
+ /*this means that the current.right==null and currentNode.left==null
+ * I have to print the processedNode's end time.Because it's the leaf node
+ * the EndTime equals its end time shown.
+ */
+ //processedStartTime=processedNode.getJBTMethod().getElapsedClockStart();
+ processedEndTime=processedNode.getJBTMethod().getElapsedClockEnd();
+ /* begin: to show the info of processedNode*/
+
+ if(processedNode.getSequenceNo()==lineNo)
+ out.println("<tr bgcolor=#FFC5F5>");
+ else if ((line++)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else out.print("<td>" +(processedStartTime-threadStartTime) + "</td>");
+ out.print("<td>" + processedNode.getJBTMethod().getDepth() + "</td>");
+
+ out.print("<td>" + GroupUtil.convertToHTML(processedNode.getName()) + "</td>");
+ out.print("<td>" + processedNode.getSequenceNo() + "</td>");
+
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else{
+ Date date1 = new Date (processedStartTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedStartTime + "</td>");
+ }
+
+ if(processedEndTime==-1){
+ out.print("<td>" + "NO EXIT" + "</td>");
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ }
+ else {
+ Date date1 = new Date (processedEndTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedEndTime + "</td>");
+ out.print("<td>" + (processedEndTime-processedStartTime) + "</td>");
+ }
+
+ if(processedNode.getMethodRunningTime()==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else
+ out.print("<td>" + processedNode.getMethodRunningTime() + "</td>");
+ out.println("</tr>");
+ /*end: to show the info*/
+
+ if(tmpStack.isEmpty()) {
+ //this is the end of visiting all the nodes
+ //after visiting all the nodes.retrieve then
+ //retrive until currentNode and processedNode has the same dparent
+ while(processedNode.getDparent()!=null){
+ processedNode=processedNode.getDparent();
+
+ processedStartTime=processedEndTime;
+ processedEndTime=processedNode.getJBTMethod().getElapsedClockEnd();
+
+ /* begin: to show the info*/
+
+ if(processedNode.getSequenceNo()==lineNo)
+ out.println("<tr bgcolor=#FFC5F5>");
+ else if ((line++)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else out.print("<td>" +(processedStartTime-threadStartTime) + "</td>");
+ out.print("<td>" + processedNode.getJBTMethod().getDepth() + "</td>");
+
+ out.print("<td>" + GroupUtil.convertToHTML(processedNode.getName()) + "</td>");
+ out.print("<td>" + processedNode.getSequenceNo() + "</td>");
+
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else {
+ Date date1 = new Date (processedStartTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedStartTime + "</td>");
+ }
+
+ if(processedEndTime==-1){
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ }
+ else {
+ Date date1 = new Date (processedEndTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedEndTime + "</td>");
+ out.print("<td>" + (processedEndTime-processedStartTime) + "</td>");
+ }
+ out.print("<td>" + " " + "</td>");
+ out.println("</tr>");
+ /*end: to show the info*/
+ }
+ break;
+ }
+ else{
+ /*next node is the right tree,retrieve
+ */
+ currentNode=(JBTTransactionTreeNode)tmpStack.pop();
+
+ //retrive until currentNode and processedNode has the same dparent
+ while(currentNode.getDparent()!=processedNode.getDparent()){
+ processedNode=processedNode.getDparent();
+ processedStartTime=processedEndTime;
+ processedEndTime=processedNode.getJBTMethod().getElapsedClockEnd();
+
+ /* begin: to show the info*/
+
+ if(processedNode.getSequenceNo()==lineNo)
+ out.println("<tr bgcolor=#FFC5F5>");
+ else if ((line++)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else out.print("<td>" +(processedStartTime-threadStartTime) + "</td>");
+ out.print("<td>" + processedNode.getJBTMethod().getDepth() + "</td>");
+
+ out.print("<td>" + GroupUtil.convertToHTML(processedNode.getName()) + "</td>");
+ out.print("<td>" + processedNode.getSequenceNo() + "</td>");
+
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else{
+ Date date1 = new Date (processedStartTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedStartTime + "</td>");
+ }
+
+ if(processedEndTime==-1){
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ }
+ else {
+ Date date1 = new Date (processedEndTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedEndTime + "</td>");
+ out.print("<td>" + (processedEndTime-processedStartTime) + "</td>");
+ }
+ out.print("<td>" + " " + "</td>");
+ out.println("</tr>");
+ /*end: to show the info*/
+ }
+
+ /*now currentNode and processedNode have the same dparent,
+ * add one more info about dparent. no need to record the start time and end time
+ */
+ processedStartTime=processedEndTime;
+ //in fact, here the processedEndTime means currentNode's startTime.
+ processedEndTime=currentNode.getJBTMethod().getElapsedClockStart();
+ /* begin: to show the info*/
+
+ if(currentNode.getDparent().getSequenceNo()==lineNo)
+ out.println("<tr bgcolor=#FFC5F5>");
+ else if ((line++)%2==0) out.println("<tr bgcolor=white>");
+ else out.println("<tr bgcolor=\"#cccccc\">");
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else out.print("<td>" +(processedStartTime-threadStartTime) + "</td>");
+ out.print("<td>" + currentNode.getDparent().getJBTMethod().getDepth() + "</td>");
+
+ out.print("<td>" + GroupUtil.convertToHTML(currentNode.getDparent().getName()) + "</td>");
+ out.print("<td>" + currentNode.getDparent().getSequenceNo() + "</td>");
+
+ if(processedStartTime==-1)
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ else{
+ Date date1 = new Date (processedStartTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedStartTime + "</td>");
+ }
+
+ if(processedEndTime==-1){
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ out.print("<td>" + "UNKNOWN" + "</td>");
+ }else {
+ Date date1 = new Date (processedEndTime);
+ DateFormat df = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss.SSS");
+ out.print("<td>" + df.format(date1) + "</td>");
+ //out.print("<td>" + processedEndTime + "</td>");
+ out.print("<td>" + (processedEndTime-processedStartTime) + "</td>");
+ }
+ out.print("<td>" + " " + "</td>");
+ out.println("</tr>");
+ /*end: to show the info*/
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+%>
+</table>
Added: trunk/java/webRoot/transactionMethodsFrame.jsp
===================================================================
--- trunk/java/webRoot/transactionMethodsFrame.jsp (rev 0)
+++ trunk/java/webRoot/transactionMethodsFrame.jsp 2008-02-20 01:13:38 UTC (rev 425)
@@ -0,0 +1,37 @@
+ <%
+/**
+ * @author Huijuan Shao
+ */
+%>
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
+<title>transactionMethodsTree</title>
+<script type="text/javascript" src="transactionMethodsTree/treeMainFresh.js"></script>
+</head>
+<script type="text/javascript">
+
+
+<%
+String strInitial = request.getParameter("initial");
+String strmainURL ="";
+if(null !=strInitial){
+ strmainURL = "transactionMethods.jsp";
+}
+else{
+ strmainURL = "transactionMethodsDetail.jsp";
+}
+%>
+
+<!--
+ var mainurl = '<%=strmainURL%>';
+ var fftop='transactionMethodsTree/treeTop.jsp';
+ document.write(''+
+ '<frameset name=mainframe0 id=mainframe0 frameborder=0 border=0 rows=126,*>'+
+ '<frame name=menu noresize="true" marginwidth=0 marginheight=0 src="'+fftop+'">'+
+ '<frame marginwidth=0 marginheight=0 name="f3" src="'+mainurl+'">'+
+'</frameset>');
+//-->
+</script>
+</html>
\ No newline at end of file
Modified: trunk/jvmti-lib/native-tests/org/jboss/profiler/jvmtitest/JVMTITest.java
===================================================================
--- trunk/jvmti-lib/native-tests/org/jboss/profiler/jvmtitest/JVMTITest.java 2008-02-19 16:06:07 UTC (rev 424)
+++ trunk/jvmti-lib/native-tests/org/jboss/profiler/jvmtitest/JVMTITest.java 2008-02-20 01:13:38 UTC (rev 425)
@@ -200,7 +200,8 @@
JVMTIInterface jvmti = new JVMTIInterface();
Map map = jvmti.createIndexMatrix();
- jvmti.exploreClassReferences(B.class.getName(),-1,true,true,true,true,false,map);
+ //jvmti.exploreClassReferences(B.class.getName(),-1,true,true,true,true,false,map);
+ jvmti.exploreClassReferences(B.class.getName(),-1,true,true,true,false,map);
System.out.println(jvmti.exploreObjectReferences(map,b,1,true));
/*map=null;
More information about the jboss-cvs-commits
mailing list