[jboss-svn-commits] JBL Code SVN: r31711 - labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 17 10:08:37 EST 2010


Author: whitingjr
Date: 2010-02-17 10:08:37 -0500 (Wed, 17 Feb 2010)
New Revision: 31711

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/analyseresults.xsl
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/average-results.xsl
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/csv-parser.xsl
Log:
Updated stylesheets to improve performance.

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/analyseresults.xsl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/analyseresults.xsl	2010-02-17 15:07:54 UTC (rev 31710)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/analyseresults.xsl	2010-02-17 15:08:37 UTC (rev 31711)
@@ -10,121 +10,89 @@
 	<xsl:param name="jboss">org.jboss</xsl:param>
 	<xsl:param name="log4j">org.apache.log4j</xsl:param>
    <xsl:param name="category0-method" />
-	<!--
-		this is the whole test method
-	-->
 	<xsl:param name="categoryB-method" />
-	<!--
-		Resource A Read [Write]
-	-->
 	<xsl:param name="categoryC-method" />
-	<!--
-		Resource B Read Write
-	-->
 	<xsl:param name="categoryD-method" /><!-- Commit -->
+   <xsl:key name="method-frame-name" match="//frame" use="@mn" />
 
 	<xsl:param name="xpaths" />
 
 	<xsl:template match="/">
 		<xsl:element name="analysis">
-			<xsl:comment>
-				Time in nanoseconds
-			</xsl:comment>
-			<xsl:comment>
-				xpaths[
-				<xsl:value-of select="$xpaths" />
-				]
-			</xsl:comment>
-			<xsl:comment>
-				db vendor packages[
-				<xsl:value-of select="$db-vendor-package.A" />
-				],
-				<xsl:value-of select="$db-vendor-package.B" />
-				]
-			</xsl:comment>
 			<xsl:element name="summary-analysis">
 				<!--
 					Create variables based on nodes that are relevant per category.
 					These will be used to generate totals for the category and reused
 					to calculate category A total.
 				-->
-				<xsl:variable name="category0-nodes"
-					select="//frame[contains($category0-method, @mn)]" />
-				<xsl:variable name="categoryB-nodes"
-					select="//frame[contains($categoryB-method, @mn)]" />
-				<xsl:variable name="categoryC-nodes"
-					select="//frame[contains($categoryC-method, @mn)]" />
-				<xsl:variable name="categoryD-nodes"
-					select="//frame[contains($categoryD-method, @mn)]" />
+				
 				<xsl:element name="category-0">
-					<xsl:comment>
-						This is the whole test.
-					</xsl:comment>
-					<xsl:apply-templates select="$category0-nodes"
-						mode="interesting" />
+				   <xsl:call-template name="parse-csv">
+                  <xsl:with-param name="csv" select="$category0-method"/>
+                  <xsl:with-param name="key-name">method-frame-name</xsl:with-param>
+               </xsl:call-template>
 				</xsl:element>
-
 				<xsl:element name="category-A">
-					<xsl:comment>
-						This is the whole test method less categories B, C and D.
-					</xsl:comment>
 					<xsl:element name="frame">
 						<xsl:attribute name="everything">else</xsl:attribute>
-						<xsl:element name="methodDuration">
-
-							<xsl:variable name="categoryA-gross"
-								select="sum($category0-nodes/@t) - ( sum($categoryB-nodes/@t) + sum($categoryC-nodes/@t) + sum($categoryD-nodes/@t) )" />
-							<xsl:variable name="categoryA-net">
-								<xsl:value-of
-									select="(sum($category0-nodes/@t) - sum($category0-nodes/child::*/@t)) - ( ( sum($categoryB-nodes/@t) - sum($categoryB-nodes/child::*/@t)) + (sum($categoryC-nodes/@t)- sum($categoryC-nodes/child::*/@t)) + (sum($categoryD-nodes/@t) - sum($categoryD-nodes/child::*/@t) ) )"></xsl:value-of>
-							</xsl:variable>
-							<xsl:element name="gross">
-								<xsl:value-of select="$categoryA-gross" />
-							</xsl:element>
-							<xsl:element name="net">
-								<xsl:value-of select="$categoryA-net" />
-							</xsl:element>
-						</xsl:element>
 					</xsl:element>
 				</xsl:element>
 				<xsl:element name="category-B">
-					<xsl:comment>
-						First resource.
-					</xsl:comment>
-					<xsl:apply-templates select="$categoryB-nodes"
-						mode="interesting" />
+					<xsl:call-template name="parse-csv">
+                  <xsl:with-param name="csv" select="$categoryB-method"/>
+                  <xsl:with-param name="key-name">method-frame-name</xsl:with-param>
+               </xsl:call-template>
 				</xsl:element>
 				<xsl:element name="category-C">
-					<xsl:comment>
-						Second resource.
-					</xsl:comment>
-					<xsl:apply-templates select="$categoryC-nodes"
-						mode="interesting" />
+					<xsl:call-template name="parse-csv">
+                  <xsl:with-param name="csv" select="$categoryC-method"/>
+                  <xsl:with-param name="key-name">method-frame-name</xsl:with-param>
+               </xsl:call-template>
 				</xsl:element>
 				<xsl:element name="category-D">
-					<xsl:comment>
-						Commit.
-					</xsl:comment>
-					<xsl:apply-templates select="$categoryD-nodes"
-						mode="interesting" />
+					<xsl:call-template name="parse-csv">
+                  <xsl:with-param name="csv" select="$categoryD-method"/>
+                  <xsl:with-param name="key-name">method-frame-name</xsl:with-param>
+               </xsl:call-template>
 				</xsl:element>
 			</xsl:element>
 		</xsl:element>
 	</xsl:template>
-
+<!-- 
 	<xsl:template match="frame" mode="interesting">
 		<xsl:call-template name="generate-interesting-method-xml" />
 	</xsl:template>
+    -->
+   <xsl:template name="callback">
+      <xsl:param name="variable"/>
+      <xsl:param name="key-name"/>
+      <xsl:call-template name="generate-interesting-method-xml">
+         <xsl:with-param name="variable" select="$variable"/>
+         <xsl:with-param name="key-name" select="$key-name"/>
+      </xsl:call-template>
+      
+   </xsl:template>
 
 	<xsl:template name="generate-interesting-method-xml">
-	   <!-- Context node //frame -->
-		<xsl:element name="{name()}">
-			<xsl:copy-of select="@mn" />
-			<xsl:copy-of select="@c" />
-			<xsl:copy-of select="@t" />
-
-			<xsl:call-template name="package-totals" />
-
+      <xsl:param name="variable"/>
+      <xsl:param name="key-name"/>
+      
+		<xsl:element name="frame">
+         
+         <xsl:attribute name="mn">
+            <xsl:value-of select="$variable"/>
+         </xsl:attribute>
+         <xsl:attribute name="c">
+            <xsl:value-of select="count(key($key-name, $variable))"/>
+         </xsl:attribute>
+         <xsl:attribute name="t">
+            <xsl:value-of select="sum(key($key-name, $variable)/@t)"/>
+         </xsl:attribute>
+          
+			<xsl:call-template name="package-totals" >
+            <xsl:with-param name="mn" select="$variable" />
+         </xsl:call-template>
+         
 		</xsl:element>
 
 	</xsl:template>
@@ -137,13 +105,13 @@
 					<xsl:copy-of select="@mn" />
 					<xsl:copy-of select="@c" />
 					<xsl:copy-of select="@t" />
-					<xsl:apply-templates select="child::frame">
+					<xsl:apply-templates select="./frame">
 						<xsl:with-param name="package-name" select="$package-name" />
 					</xsl:apply-templates>
 				</xsl:copy>
 			</xsl:when>
 			<xsl:otherwise>
-				<xsl:apply-templates select="child::frame">
+				<xsl:apply-templates select="./frame">
 					<xsl:with-param name="package-name" select="$package-name" />
 				</xsl:apply-templates>
 			</xsl:otherwise>
@@ -151,11 +119,10 @@
 	</xsl:template>
 
 	<xsl:template name="package-totals">
+      <xsl:param name="mn"/>
 	   <!-- Context node //frame -->
-		<xsl:comment>
-			Package totals.
-		</xsl:comment>
-		<xsl:element name="{translate(@mn, ':', '.')}">
+      
+		<xsl:element name="{translate($mn, ':', '.')}">
 
          <xsl:call-template name="package-total"><xsl:with-param name="package-name" select="$hibernate"/></xsl:call-template>
          <xsl:call-template name="package-total"><xsl:with-param name="package-name" select="$arjuna"/></xsl:call-template>
@@ -179,12 +146,14 @@
 	<xsl:template name="package-total">
 	  <xsl:param name="package-name"/>
 	  <xsl:element name="{string($package-name)}">
+      <!-- 
 	     <xsl:value-of
            select="sum( descendant::frame[starts-with(@mn, $package-name)]/@t) - sum( descendant::frame[starts-with(@mn, $package-name)]/frame/@t )" />
+           -->
      </xsl:element>
+      
 	</xsl:template>
-
-
+   
 </xsl:stylesheet>
 
 

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/average-results.xsl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/average-results.xsl	2010-02-17 15:07:54 UTC (rev 31710)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/average-results.xsl	2010-02-17 15:08:37 UTC (rev 31711)
@@ -33,44 +33,44 @@
          <xsl:element name="frame">
             <xsl:copy-of select="@mn"/>
             <xsl:attribute name="t">
-               <xsl:value-of select="round(@t div @count)"/>
+               <xsl:value-of select="round(@t div @c)"/>
             </xsl:attribute>
             <!-- xsl:element name="methodDuration">
                <xsl:element name="average-gross">
-                  <xsl:value-of select="round(./methodDuration/gross div @count)"/>
+                  <xsl:value-of select="round(./methodDuration/gross div @c)"/>
                </xsl:element>
                < xsl:element name="average-net">
-                  <xsl:value-of select="round(./methodDuration/net div @count)"/>
+                  <xsl:value-of select="round(./methodDuration/net div @c)"/>
                </xsl:element>
             </xsl:element-->
             <xsl:element name="{name(./*)}">
                <xsl:element name="{$hibernate}">
-                  <xsl:value-of select="round(./*/org.hibernate div @count)"></xsl:value-of>
+                  <xsl:value-of select="round(./*/org.hibernate div @c)"></xsl:value-of>
                </xsl:element>
                <xsl:element name="{$arjuna}">
-                  <xsl:value-of select="round(./*/com.arjuna div @count)"></xsl:value-of>
+                  <xsl:value-of select="round(./*/com.arjuna div @c)"></xsl:value-of>
                </xsl:element>
                <xsl:element name="{$caveat-emptor}">
-                  <xsl:value-of select="round(./*/auction div @count)"></xsl:value-of>
+                  <xsl:value-of select="round(./*/auction div @c)"></xsl:value-of>
                </xsl:element>
                <xsl:element name="{$jboss}">
-                  <xsl:value-of select="round(./*/org.jboss div @count)"></xsl:value-of>
+                  <xsl:value-of select="round(./*/org.jboss div @c)"></xsl:value-of>
                </xsl:element>
                <xsl:element name="{$log4j}">
-                  <xsl:value-of select="round(./*/org.apache.log4j div @count)"></xsl:value-of>
+                  <xsl:value-of select="round(./*/org.apache.log4j div @c)"></xsl:value-of>
                </xsl:element>
                <xsl:choose>
                   <xsl:when test="'${db-vendor-package.xpath.A}' = '${db-vendor-package.xpath.B}'">
                      <xsl:element name="${db-vendor-package.xpath.A}">
-                        <xsl:value-of select="round(./*/*[position()=last()] div @count)"/>
+                        <xsl:value-of select="round(./*/*[position()=last()] div @c)"/>
                      </xsl:element>
                   </xsl:when>
                   <xsl:otherwise>
                      <xsl:element name="${db-vendor-package.xpath.A}">
-                        <xsl:value-of select="round(./*/${db-vendor-package.xpath.A} div @count)"/>
+                        <xsl:value-of select="round(./*/${db-vendor-package.xpath.A} div @c)"/>
                      </xsl:element>
                      <xsl:element name="${db-vendor-package.xpath.B}">
-                        <xsl:value-of select="round(./*/${db-vendor-package.xpath.B} div @count)"/>
+                        <xsl:value-of select="round(./*/${db-vendor-package.xpath.B} div @c)"/>
                      </xsl:element>
                   </xsl:otherwise>
                </xsl:choose>

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/csv-parser.xsl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/csv-parser.xsl	2010-02-17 15:07:54 UTC (rev 31710)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/xsl/csv-parser.xsl	2010-02-17 15:08:37 UTC (rev 31711)
@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
+   
+   <!-- Use this stylesheet to call a template called callback. Passed to the template
+   is a variable.
+   It supports the providing of a key-name if a particular one should be used.
+    -->
    <xsl:template name="parse-csv">
       <xsl:param name="csv"/>
       <xsl:param name="key-name"/>



More information about the jboss-svn-commits mailing list