I'd like to share a piece of XSLT with you all. In the distributed report XSLT you
have the minimum, maximum and average response times. I always like percentiles in my
reports, mainly because performance requirements usually state something like "90% of
the pages have to be loaded with 3 seconds". The 90th percentile is the smallest
number that is greater than 90% of the numbers in a given set.
So just as you have the minTime and maxTime variables in the pagelist template you can
add the followng variable for the 90th percentile:
<xsl:variable name="thisPercentile">
<xsl:call-template name="percentiles">
<xsl:with-param name="responsetimes" select="../[EMAIL PROTECTED] =
current()/@label]/@time" />
<xsl:with-param name="percentile" select="0.9" />
</xsl:call-template>
</xsl:variable>
This is the percentiles "function" which does the math:
<xsl:template name="percentiles">
<xsl:param name="responsetimes" select="/.." />
<xsl:param name="percentile" select="." />
<xsl:variable name="sortedresponsetimes">
<xsl:for-each select="$responsetimes">
<xsl:sort data-type="number"/>
<xsl:element name="time">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="n" select="count($responsetimes)-1" />
<xsl:variable name="k" select="floor($percentile*$n)+1" />
<xsl:variable name="f" select="($percentile*$n+1)-$k" />
<xsl:variable name="a0" select="$sortedresponsetimes[1]/time[$k]" />
<xsl:variable name="a1" select="$sortedresponsetimes[1]/time[$k+1]" />
<xsl:value-of select="$a0+ ( $f *( $a1 - $a0))" />
</xsl:template>
The method of sorting the responsetimes can use some improvements: it works, but is
looks like a hack...
To get this to work with Saxon you have to specificy version 1.1:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
BTW, is there a place where we can share JMeter XSLT's ? I have made a "results to
CSV"-XSL as well, for those interested.
With regards,
Bob Coret
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]