jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Lin <wool...@gmail.com>
Subject Re: Addition to XSLT: percentiles
Date Fri, 10 Sep 2004 14:02:45 GMT
that's a good idea.

we probably should add them to the website and include it in the distribution.

peter


On Fri, 10 Sep 2004 15:56:07 +0200, Coret Bob <b.coret@pinkroccade.com> wrote:
> 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="../sampleResult[@label = 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: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message