]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/papers/use_case/stats/groups_dependent_size.xsl
* basic infrastructure for collecting statistics
[helm.git] / helm / papers / use_case / stats / groups_dependent_size.xsl
diff --git a/helm/papers/use_case/stats/groups_dependent_size.xsl b/helm/papers/use_case/stats/groups_dependent_size.xsl
new file mode 100644 (file)
index 0000000..48ff697
--- /dev/null
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:xlink="http://www.w3.org/1999/xlink"
+                xmlns:m="http://www.w3.org/1998/Math/MathML"
+                xmlns:box="http://helm.cs.unibo.it/2003/BoxML"
+>
+
+<xsl:param name="size_min" select="1"/>
+<xsl:param name="size_max" select="200"/>
+<xsl:param name="perc" select="0.03"/>
+<xsl:param name="step" select="10"/>
+
+<xsl:template match="/">
+  <html>
+    <body>
+      <xsl:call-template name="find-dep"/>
+    </body>
+  </html>  
+</xsl:template>
+
+<xsl:template name="find-dep">
+  <xsl:param name="size" select="$size_min"/>
+  <xsl:variable name="range" select="$size * $perc"/>
+  <xsl:if test="$size &lt;= $size_max">
+    <table border="1">
+      <tr>
+        <th>N</th>
+         <th>Size (bytes)</th>
+         <th>Elements</th>
+         <th>Max depth</th>
+         <!--
+         <th>Text nodes</th>
+         <th>Total nodes</th>
+         <th>Leaf avg</th>
+         <th>Max width</th>
+         <th>Inner avg width</th>
+         <th>Max attributes</th>
+         <th>Total attributes</th>
+         -->
+         <th>Object</th>
+       </tr>
+      <xsl:apply-templates select="statistics/stats[number(depth/max) &gt;= $size - $range
+                                                    and number(depth/max) &lt;= $size + $range]">
+        <xsl:sort order="ascending" data-type="number" select="number(elements/total)"/>
+      </xsl:apply-templates>
+    </table>
+    <xsl:call-template name="find-dep">
+      <xsl:with-param name="size" select="$size + $step"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="stats">
+  <tr>
+    <td align="left">
+      <xsl:value-of select="position()"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="size"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="depth/max"/>
+    </td>
+    <!--
+    <td align="left">
+      <xsl:value-of select="number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="number(elements/total) + number(text-nodes/total)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(depth/leaf-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="width/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="round(width/inner-avg)"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/max"/>
+    </td>
+    <td align="left">
+      <xsl:value-of select="attributes/total"/>
+    </td>
+    -->
+    <th align="left">
+      <xsl:value-of select="substring(@for,21)"/>
+    </th>
+  </tr>
+</xsl:template>
+
+</xsl:stylesheet>
+