如何使用XSL打印百分位数 [英] How to print percentile using xsl

查看:140
本文介绍了如何使用XSL打印百分位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jmeter-results-detail-report_21.xsl文件在HTML报告中生成99%.我可以使用以下代码打印90%的位置:

I am trying to generate 99 percentile in the HTML report using jmeter-results-detail-report_21.xsl file. I am able to print the 90 percentile using the below code:

</xsl:template>
<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>

如何修改上述代码以打印 99% 90%

How to modify the above code to print the 99 percentile along with the 90 percentile

推荐答案

问题的哪一部分引起您麻烦?您这里的代码将所需的百分位数作为参数,只需提供值99而不是90作为参数值即可.如果您希望在同一运行中有几个百分位数,则将进行排序的代码分解到调用例程中,这样排序就只能完成一次.

What part of the problem is causing you trouble? You have code here that takes the required percentile as a parameter, just supply the value 99 instead of 90 as the parameter value. If you want several percentiles in the same run, then factor out the code that does the sorting into a calling routine so the sort only gets done once.

这篇关于如何使用XSL打印百分位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆