jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Getting 90%line data in the reports generated from ant
Date Mon, 12 Apr 2010 17:52:33 GMT
Hi
I removed exslt and switched to XSLT 2.0 . I also had to use saxon (my tool
of choice for any XSLT related stuff - http://saxon.sourceforge.net/#F9.2HE)


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">

then
Under template pagelist I added a column
<th>Percentile</th> (after maxtime)

Then added the variable (with changes)

            <xsl:variable name="thisPercentile">
                <xsl:call-template name="percentiles">
                    <xsl:with-param name="responsetimes"
select="/testResults/*[@lb = current()/@lb]/@t"/>
                    <xsl:with-param name="percentile" select="0.9" />
                </xsl:call-template>
            </xsl:variable>


Then actually display the variable (after maxtime)
                <td>
                  <xsl:value-of select="$thisPercentile" />
                </td>


And finally the template itself (Note i havent checked the logic , seems to
have a bug for when there is only one element of that label -in which case
percentile is useless but you might add a check to print out some value)

<xsl:template name="percentiles">
        <xsl:param name="responsetimes" />
        <xsl:param name="percentile" />
        <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>

Run from command line as  (or use java task in ant)
java -jar saxon9he.jar -o out.html report.jtl report.xsl

regards
deepak

On Sun, Apr 11, 2010 at 11:14 PM, prasanna bhat <prasannabhat38@gmail.com>wrote:

> Hi Deepak,
>
> I have shared the files using google docs.
>
> Thanks for your time.
>
> Regards,
> Prasanna
>
>
> On Mon, Apr 12, 2010 at 12:12 AM, Deepak Shetty <shettyd@gmail.com> wrote:
>
> > Hi
> > post your XSLT somewhere and provide a link to it,
> >
> > I dont think the sample would work with 1.0 , I usually use Saxon instead
> > of
> > xalan.
> >
> > regards
> > deepak
> >
> > On Sun, Apr 11, 2010 at 6:27 AM, prasanna bhat <prasannabhat38@gmail.com
> > >wrote:
> >
> > > Thank you Deepak for your response.
> > >
> > > I went through the link pointed by you.
> > > (
> > >
> > >
> >
> http://mail-archives.apache.org/mod_mbox/jakarta-jmeter-user/200409.mbox/%3CE4ABAE8C87AB9A4CA944A946E42DBF3DB935F6@ASP1EC2VS1.ASP1.LAN%3E
> > > )
> > > and added the following code fragments into *
> > > jmeter-results-detail-report_21.xsl*
> > >
> > > <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>
> > >
> > > <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]"
> > > />                                      (Line No: 478:71 as displayed
> in
> > > the
> > > error matches to $k)
> > >  <xsl:variable name="a1" select="$sortedresponsetimes[1]/time[$k+1]" />
> > >  <xsl:value-of select="$a0+ ( $f *( $a1 - $a0))" />
> > > </xsl:template>
> > >
> > > With this in place, i got an error generating the reports.
> > >
> > >    [xslt]
> > >
> >
> C:\jakarta-jmeter-2.3.4\extras\jmeter-results-detail-report_21.xsl:428:71:
> > > Fatal Error! org.apache.xpath.objects.XRTreeFrag cannot be cast
> > >  to org.apache.xpath.objects.XNodeSet Cause:
> > java.lang.ClassCastException:
> > > org.apache.xpath.objects.XRTreeFrag cannot be cast to
> > org.apache.xpath.obje
> > > cts.XNodeSet
> > >
> > > I'm not a pro in XSLT. I tried my level best to debug this issue going
> > > through various links listed from google search. I added the following
> > > fragment to the XSL file.
> > >
> > >
> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > >                xmlns:exsl="http://exslt.org/common"
> > >                extension-element-prefixes="exsl"
> > >                version="1.0">
> > >
> > > <xsl:variable name="a0" select="
> > > exsl:node-set($sortedresponsetimes[1])/time[$k]" />
> > >
> > > and from the build.xml i got to know that i'm using xalan_2_7_1.jar.
> > >
> > > the issue is still not fixed.
> > >
> > > Can you please provide me some inputs on this?
> > >
> > > Your time is very much appreciated.
> > >
> > > Thanks,
> > > Prasanna
> > >
> > > On Fri, Apr 9, 2010 at 10:07 PM, Deepak Shetty <shettyd@gmail.com>
> > wrote:
> > >
> > > > You'll have to modify the XSLT. I believe this has been discussed
> > before
> > > on
> > > > the archives. A search reveals
> > > >
> > > >
> > http://www.mail-archive.com/jmeter-user@jakarta.apache.org/msg05400.html
> > > >
> > > > regards
> > > > deepak
> > > >
> > > > On Fri, Apr 9, 2010 at 8:55 AM, prasanna bhat <
> > prasannabhat38@gmail.com
> > > > >wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm using ant to run Jmeter scripts using the build script as
> > suggested
> > > > in
> > > > > http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
> .
> > > I'm
> > > > > using Aggregate report listener to log the results in a file. In
> the
> > > > > generated reports the following columns are present.
> > > > >
> > > > > URL
> > > > >
> > > > > TestsFailuresSuccess RateAverage TimeMin TimeMax TimeI want to add
> > 90%
> > > > line
> > > > > column also in the report. Can some one please provide some inputs
> or
> > > > > pointers as to how i can accomplish this.
> > > > >
> > > > > Thanks,
> > > > > Prasanna
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message