Jmeter与ant整合生成美观的测试报告

        一直觉得Jmeter生成的测试报告很难看,偶尔发现网上用jmeter-results-detail-report_30.xsl整全ant生成了美观的测试报告,参考https://blog.csdn.net/zouxiongqqq/article/details/71094245

        鉴于对美丽的追求,我决定去尝试一下。但一入坑,发现问题很多。经过不懈的努力,终于把坑都一一填平了,这里分享一下经验。

  整个测试报告的基本逻辑是;:

       录好或者自己编写jmeter脚本,添加聚合报告、服务器监控、及一些性能监控参数,生成相应的文件放在某个目录,用ant启动测试,jmeter数据生成完后,用bat文件将生成的jtl数据生成相应的图表,然后html把相应的图表渲染出来。当然可以考虑将生成图表的操作也写入ant中,同时将这些数据移到一定指 定的文件夹中,所有这些都可以交给ant来执行。

        先上几张最后的效果图:

 

坑一:

build.xml里面相应的参数应该修改,这里面需要相应的ant的相关知道,我这里附上我使用的脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?xml version="1.0" encoding="UTF-8"?>
 <project name="ant-jmeter-testing" default="run" basedir="."> 
     <property name="jmeter.home" value="F:\dev\apache-jmeter-5.0" />
     <property name="report.title" value="Performance and interface testing" />
     <property name="jmeter.result.jtl.dir" value="${jmeter.home}\result" />
     <property name="jmeter.result.html.dir" value="${jmeter.home}\result" />
     <property name="ReportName" value="TestReport" />
     <property name="jmeter.result.jtlName" value="${jmeter.result.jtl.dir}\${ReportName}.jtl" />
     <property name="jmeter.result.htmlName" value="${jmeter.result.html.dir}\${ReportName}.html" />
     <!--设置jmeter生成结果服务器上ip地址 -->
     <property name="jmeter.request.url" value="http://192.168.8.34" />
     <!--设置失败率为xx时,html是否标颜色 -->
     <property name="failure.rate" value="0.6" />
     <!--设置服务器日志地址 -->
     <property name="Result.log" value="http://www.w3school.com.cn" />
     <!--是否显示服务器日志地址,0代表显示,1代表不显示 -->
     <property name="Is.show.Result.log" value="0" />
     <!--是否显示关键指标(APT、TPS、Throughput、Hit等)图片,0代表显示,1代表不显示 -->
     <property name="Is.Show.Key.index" value="0" />
     <!--是否显示资源(CPU、Memory、io、Network等)图片,0代表显示,1代表不显示 -->
     <property name="Is.Show.Resource" value="0" />
 
      
     <target name="run">
         <tstamp> <format property="start.report.datestamp" pattern="yyyyMMddHHmmSS" /></tstamp>
         <antcall target="run_TestCase" />
         <antcall target="build_report" />
     </target>
     <target name="run_TestCase"> 
         <taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
         <jmeter jmeterhome="${jmeter.home}" runremote="false" resultlog="${jmeter.result.jtlName}">
             <testplans dir="${jmeter.home}\TestCase" includes="login.jmx" />           
             <property name="jmeter.save.saveservice.output_format" value="xml"/>
         <property name="jmeter.save.saveservice.response_message" value="false" />
         <jvmarg value="-Xincgc"/> 
             <jvmarg value="-Xms1024m"/>
             <jvmarg value="-Xmx1024m"/> 
         </jmeter>
     </target>
      
     <path id="xslt.classpath">
         <fileset dir="${jmeter.home}\lib" includes="xalan*.jar"/>
         <fileset dir="${jmeter.home}\lib" includes="serializer*.jar"/>
     </path>
 
     <target name="build_report">
         <tstamp> <format property="end.report.datestamp" pattern="yyyyMMddHHmmSS" /></tstamp>
         <xslt
             classpathref="xslt.classpath"
             force="true"
             in="${jmeter.result.jtlName}"
             out="${jmeter.result.htmlName}"
             style="${jmeter.home}\extras\jmeter-results-detail-report_30.xsl">
             <param name="start_datetime" expression="${start.report.datestamp}"/>
             <param name="end_datetime" expression="${end.report.datestamp}"/>
             <param name="request_url" expression="${jmeter.request.url}"/>
             <param name="failure_rate" expression="${failure.rate}"/>
             <param name="Result_log" expression="${Result.log}"/>
             <param name="Is_show_Result_log" expression="${Is.show.Result.log}"/>
             <param name="Is_Show_Key_index" expression="${Is.Show.Key.index}"/>
             <param name="Is_Show_Resource" expression="${Is.Show.Resource}"/>
         </xslt>
  
         <copy todir="${jmeter.result.html.dir}">
             <fileset dir="${jmeter.home}\extras">
                 <include name="collapse.png" />
                 <include name="expand.png" />
             </fileset>
         </copy>
     </target>
     
        
 </project>

必须看懂相应的属性和任务,创建相应的文件夹

 

坑二:

原帖作者linux上用的是linux系统,我用的是windows系统,里面的shell脚本需要转化为bat脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
echo jmeter_home is %JMETER_HOME%
cd %JMETER_HOME%\result
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl CPU.jtl --plugin-type PerfMon --generate-png CPU.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl Memory.jtl --plugin-type PerfMon --generate-png Memory.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl IO.jtl --plugin-type PerfMon --generate-png IO.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl Network.jtl --plugin-type PerfMon --generate-png Network.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl Trans.jtl --plugin-type TransactionsPerSecond  --generate-png Trans.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl TimesVsThreads.jtl --plugin-type TimesVsThreads   --generate-png TimesVsThreads.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl ResponseTimesOverTime.jtl --plugin-type ResponseTimesOverTime  --generate-png ResponseTimesOverTime.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl ThroughputVsThreads.jtl --plugin-type ThroughputVsThreads  --generate-png ThroughputVsThreads.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl HitsPerSecond.jtl --plugin-type HitsPerSecond  --generate-png HitsPerSecond.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl BytesThroughputOverTime.jtl --plugin-type BytesThroughputOverTime  --generate-png BytesThroughputOverTime.png
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl HitsPerSecond.jtl --plugin-type HitsPerSecond  --generate-csv HitsPerSecond.csv
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl CPU.jtl --plugin-type PerfMon --generate-csv CPU.csv
java -jar %JMETER_HOME%\lib\cmdrunner-2.2.jar --tool Reporter --input-jtl Memory.jtl --plugin-type PerfMon --generate-csv Memory.csv

 坑三:

我生成的测试报告在浏览器中打开js报错,我将jmeter-results-detail-report_30.xsl的js里面注掉一些后成功,在些附上该内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
 
<!--
    Stylesheet for processing 2.1 output format test result files
    To uses this directly in a browser, add the following to the JTL file as line 2:
    <?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report_21.xsl"?>
    and you can then view the JTL in a browser
-->
 
<!--
    Stylesheet for processing 3.0 output format test result files
    To uses this directly in a browser, add the following to the JTL file as line 2:
    <?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report_30.xsl"?>
    and you can then view the JTL in a browser.Edit by ZHC
-->
 
<xsl:output method="html" indent="yes" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
 
<!-- Defined parameters (overrideable) -->
<xsl:param    name="showData" select="'y'"/>
<xsl:param    name="titleReport" select="'Performance_or_Interface Test Results'"/>
<xsl:param    name="start_datetime" select="'date not defined'"/>
<xsl:param    name="end_datetime" select="'date not defined'"/>
<xsl:param    name="request_url" select="'date not defined'"/>
<xsl:param    name="failure_rate" select="$failure_rate"/>
<xsl:param    name="Result_log" select="'date not defined'"/>
<xsl:param    name="Is_show_Result_log" select="'date not defined'"/>
<xsl:param    name="Is_Show_Key_index" select="'date not defined'"/>
<xsl:param    name="Is_Show_Resource" select="'date not defined'"/>
 
<xsl:template match="testResults">
    <html>
    <link type='text/css' rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.css" />
        <head>
            <title><xsl:value-of select="$titleReport" /></title>
            <style type="text/css">
                body {
                    font:normal 68% verdana,arial,helvetica;
                    color:#000000;
                }
                table tr td, table tr th {
                    font-size: 68%;
                    padding:10px 0;
                }
                table.details tr th{
                    color: #ffffff;
                    font-weight: bold;
                    text-align:center;
                    background:#2674a6;
                    white-space: nowrap;
                    padding:10px 0;
                }
                table.details tr td{
                    background:#eeeee0;
                    white-space: nowrap;
                    padding:10px 0;
                }
                 
                h1 {
                    margin: 0px 0px 5px;
                    font-size: 40px;
                    text-align:center;
                    text-decoration:underline;
                }
                h2 {
                    margin-top: 1em;
                    margin-bottom: 0.5em;
                    font: bold 125% verdana,arial,helvetica;
                }
                h3 {
                    margin-bottom: 0.5em;
                    font: bold 115% verdana,arial,helvetica;
                    align:center;
                     
                }
                ul{
                    margin:0px;
                    padding:0px;
                }
                li{
                    margin-bottom:20px;
                }
                hr{
                    border:1px dashed red;
                    height:1px;
                }
                .top .Failure {
                    font-weight:bold;
                    background:red;
                }
                .top .Time3s {
                    font-weight:bold;
                    background:yellow;
                }
                .top .Time5s{
                    font-weight:bold;
                    background:orange;
                }
                .top .Time8s{
                    font-weight:bold;
                    background:red;
                }              
                .top .NintyTime3s {
                    font-weight:bold;
                    background:yellow;
                }
                .top .NintyTime5s {
                    font-weight:bold;
                    background:orange;
                }
                .top .NintyTime8s {
                    font-weight:bold;
                    background:red;
                }
                                             
                img
                {
                  border-width: 0px;
                }
                 
                .expand_link
                {
                   position=absolute;
                   right: 0px;
                   width: 27px;
                   top: 1px;
                   height: 27px;
                }
                 
                .page_details
                {
                   display: none;
                }
                                 
                .page_details_expanded
                {
                    display: block;
                    display/* hide this definition from  IE5/6 */: table-row;
                }
 
                table.Failure_Detail_expanded th{
                    color: #ffffff;
                    font-weight: bold;
                    background:#2674a6;
                    white-space: nowrap;
                    padding:10px;
                    width: 5%;
                }
                table.Failure_Detail_expanded td{
                    background:#eeeee0;
                    white-space: nowrap;
                    padding:10px;
                }
                 
                .Failure_Detail_collapse
                {
                   display: none;
                }
                                 
                .Failure_Detail_expanded
                {
                    display: block;
                    display/* hide this definition from  IE5/6 */: table-row;
                }
                 
                 
                #RPSTime3s {
                    font-weight:bold;
                    background:yellow;
                }
                #RPSTime5s{
                    font-weight:bold;
                    background:orange;
                }
                #RPSTime8s{
                    font-weight:bold;
                    background:red;
                }
                #failures{
                    font-weight:bold;
                    background:red;
                }
                #show{ display:inline-block; width:60px; height:22px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;}
                #show1{ display:inline-block; width:60px; height:22px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;}
                #yellow_1{ display:inline-block; width:10px; height:10px; line-height:22px; background:yellow; text-align: center; border-radius: 3px; color:#FFF;}
                #red_1{ display:inline-block; width:10px; height:10px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;}
                #orange_1{ display:inline-block; width:10px; height:10px; line-height:22px; background:orange; text-align: center; border-radius: 3px; color:#FFF;}
                #failed{ display:inline-block; width:10px; height:10px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;}
                ul,ol{list-style: none;}
            </style>
            <script language="JavaScript">
                <![CDATA[
                    function expand(details_id)
                    {
                       
                        document.getElementById(details_id).className = "page_details_expanded";
                    }
                    
                    function collapse(details_id)
                    {
                       
                        document.getElementById(details_id).className = "page_details";
                    }
                    
                    function change(details_id)
                    {
                        if($(("#"+details_id+"_image")).text() == "show"){
                            $(("#"+details_id+"_image")).text("hidden");                           
                            expand(details_id);
                        }else{
                            $(("#"+details_id+"_image")).text("show");
                            collapse(details_id);
                        }
                     
                    }
                ]]>
            </script>
             
            <script language="JavaScript">
                <![CDATA[
                    function expand1(details_id)
                    {
                        document.getElementById(details_id).className = "Failure_Detail_expanded";
                        document.getElementById(details_id).style.display="block";
                    }
                    
                    function collapse1(details_id)
                    {
                        document.getElementById(details_id).className = "Failure_Detail_collapse";
                        document.getElementById(details_id).style.display ="none";
                    }
                    
                    function change1(details_id)
                    {
                        if($(("#"+details_id+"_image")).text() == "show"){
                            $(("#"+details_id+"_image")).text("hidden");                           
                            expand1(details_id);
                        }else{
                            $(("#"+details_id+"_image")).text("show");
                            collapse1(details_id);
                        }
                     
                    }
                ]]>
            </script>
 
             
        </head>
        <body>
            <xsl:call-template name="pageHeader" />          
            <xsl:call-template name="summary" />
            <hr width="100%" />
            <xsl:call-template name="pagelist"/>
            <xsl:call-template name="detail" />  
            <hr width="100%" />
            <xsl:call-template name="Resource" />
 
        </body>
    </html>
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    <script>
         
                var IP=$(Request_url).text();
                $("#show").on("click", function(){
                if($(this).text() == "show"){
                    $(this).text("hidden")
                }else{
                    $(this).text("show")
                    }
                $("#img-box").toggle();
                });
                 
                $("#show1").on("click", function(){
                if($(this).text() == "show"){
                    $(this).text("hidden")
                }else{
                    $(this).text("show")
                    }                  
                $("#img-box1").toggle();
                });
             
         
                //<![CDATA[
                function Clockon()
                {
                    var now=new Date();
                    var year=now.getFullYear(); //getFullYear getYear
                    var month=now.getMonth();
                    var date=now.getDate();
                    var day=now.getDay();
                    var hour=now.getHours();
                    var minu=now.getMinutes();
                    var sec=now.getSeconds();
                    var week;
                    month=month+1;
                    if(month<10){month="0"+month;}
                    if(date<10){date="0"+date;}
                    if(hour<10){hour="0"+hour;}
                    if(minu<10){minu="0"+minu;}
                    if(sec<10){sec="0"+sec;}
                    var arr_week=new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
                    week = arr_week[day];
                    //check_time=year+"/"+month+"/"+date+" "+hour+":"+minu;
                    check_time=year+""+month+""+date+""+hour+""+minu;
                    return {Check_times:check_time};
                    //var timer=setTimeout("clockon()", 200);
                }
                //]]>
 
                //回调jsonp结果,注jsonpCallback的命名要与txt和ajax请求中jsonp参数名称一致
                //function jsonpCallback(data) {
                    //var oDiv = document.getElementById("date_check1");
                    //oDiv.innerHTML = data;
                    //var setTime=new Clockon();
                    //if($(date_check1).text()==setTime.Check_times){  
                    //      alert("我的小主,耐心点,数据分析需1~2分钟,请稍后查看!");
                    //      console.log("------------");
                    //      console.log(setTime.Check_times);
                             
                    //}else{   
 
                            //var change_time=$(date_check).text().replace('/','').replace('/','').replace(' ','').replace(':','');
                            //var change_time=change_times.substring(0,10);
                            var change_time=$(date_check1).text();
                            document.getElementById('results_path').innerText="/result/html/Report"+change_time+"/TestReport.html";
                            var cpu="CPU.png";
                            var Mem="Memory.png";
                            var io="IO.png";
                            var network="Network.png";
                            var RTO="ResponseTimesOverTime.png";
                            var TVT="TimesVsThreads.png";
                            var ThroughputVT="ThroughputVsThreads.png";
                            var tps="Trans.png";
                            var hps="HitsPerSecond.png";
                            var BTOT="BytesThroughputOverTime.png";                
                            $("#CPU").attr("src", cpu);
                            $("#Memory").attr("src", Mem);
                            $("#IO").attr("src", io);
                            $("#Network").attr("src", network);
                            $("#ResponseTimesOverTime").attr("src", RTO);
                            $("#TimesVsThreads").attr("src", TVT);
                            $("#ThroughputVsThreads").attr("src", ThroughputVT);
                            $("#TPS").attr("src", tps);
                            $("#HitsPerSecond").attr("src", hps);
                            $("#BytesThroughputOverTime").attr("src", BTOT);
                            console.log("+++++++++++");
                            console.log(change_time);
                        //}
                    //}
                     
                //ajax跨域获取txt数据
                //function Get_date() {
                //      var url = '../../build_conf.txt';
                //      $.ajax({
                //          url: url,
                //          async: false,
                //          data: '',
                //          dataType: 'jsonp',
                //          jsonp: 'jsonpCallback',
                //          success: function(data) {
                //              console.log(data);
                //          },
                //          error: function(msg) {
                //              console.log(msg);
                //          }
                //      });
                //  };
                // 
                //var txt=new Get_date();  
 
            //setTime();
 
    </script>
    <script language="JavaScript">
        document.querySelector('#isshow_Key_index').style.display = document.querySelector('#isshow_Keyindex').innerText === '1' ? 'none' : 'block';
        document.querySelector('#isshow_Key_index1').style.display = document.querySelector('#isshow_Keyindex').innerText === '1' ? 'none' : 'block';
        document.querySelector('#isshow_Resource_usage').style.display = document.querySelector('#isshow_Resource').innerText === '1' ? 'none' : 'block';
        document.querySelector('#isshow_Result_log').style.display = document.querySelector('#isshow_Resultlog').innerText === '1' ? 'none' : 'block';
    </script>
     
</xsl:template>
 
<xsl:template name="pageHeader">
    <h1><xsl:value-of select="$titleReport" /></h1>
    <table width="100%">
        <tr>
            <!-- 获取requestHeader数据 -->
            <!-- xsl:variable name="URL" select="/testResults/httpSample/requestHeader" / -->
            <!-- 从获取的URL中截取数据,第二代表起始位置,第三位代表长度 -->
            <!-- xsl:variable name="newURL" select="substring($URL, 94, 30)" / -->
            <!-- 已换行符来截取,before代表换行符之前的数据 -->
            <!-- xsl:variable name="remaining" select="substring-before($newURL, '
')" / -->
            <ul>
                <li><b>Period:</b> <xsl:value-of select="$start_datetime" /> - <xsl:value-of select="$end_datetime" /></li>
                <li><b>Results in Session:</b><span id="results_path" align="left"></span></li>
                <li id="isshow_Result_log"><b>Server Result log:</b><a><xsl:attribute name="href"><xsl:value-of select="$Result_log" /></xsl:attribute><xsl:value-of select="$Result_log" /></a></li>
            </ul>
            <td id="date_check" align="left" style="display:none" ><xsl:value-of select="$end_datetime" /></td>
            <td id="date_check1" align="left" style="display:none" ></td>
            <!-- request_url表示build.xml中jmeter收集结果服务器请求地址 -->
            <td id="Request_url" align="left" style="display:none" ><xsl:value-of select="$request_url" /></td>
            <td style="display:none" align="left" id="isshow_Keyindex" ><xsl:value-of select="$Is_Show_Key_index" /></td>
            <td style="display:none" align="left" id="isshow_Resource" ><xsl:value-of select="$Is_Show_Resource" /></td>
            <td style="display:none" align="left" id="isshow_Resultlog" ><xsl:value-of select="$Is_show_Result_log" /></td>
            <!--td align="center">Host: <xsl:value-of select="$remaining" /></td>
            <td align="right"><a href="./TestLog.html">测试日志</a></td -->
        </tr>
    </table>
    <hr width="100%" />
</xsl:template>
 
<xsl:template name="Resource">
    <h2 id="isshow_Resource_usage">Resource usage:<a href="javascript:void(0);" id="show1">show</a></h2>
    <div>
        <div style="display:none" id="img-box1" class="container-fluid">
            <div class="row">
                <div class="col-md-6">
                    <ul>
                        <li><h2>CPU</h2></li>
                        <li><img id="CPU"/></li>
                        <li><h2>Memory</h2></li>
                        <li><img id="Memory"/></li>
                    </ul>
                </div>
                <div class="col-md-6">
                    <ul>
                        <li><h2>IO</h2></li>
                        <li><img id="IO" /></li>
                        <li><h2>Network</h2></li>
                        <li><img id="Network" /></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</xsl:template>
 
 
<xsl:template name="summary">
    <h2> Transaction Summary【Fail:<span id="failed"></span>】</h2>
    <table align="center" class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
        <tr valign="top">
            <th>Total Transacthion</th>
            <th>Total Pass</th>
            <th>Total Fail</th>
            <th>Passing rate</th>
            <th>Failure rate</th>
            <th id="isshow_Key_index">Dedail</th>
        </tr>
        <tr valign="top" class="top">
            <xsl:variable name="allCount" select="count(/testResults/*)" />
            <xsl:variable name="allFailureCount" select="count(/testResults/*[attribute::s='false'])" />
            <xsl:variable name="allSuccessCount" select="count(/testResults/*[attribute::s='true'])" />
            <xsl:variable name="allSuccessPercent" select="$allSuccessCount div $allCount" />
            <xsl:variable name="allFailurePercent" select="$allFailureCount div $allCount" />
            <!--            
            <xsl:attribute name="class">
                <xsl:choose>
                    <xsl:when test="$allFailureCount > 0">Failure</xsl:when>
                </xsl:choose>
            </xsl:attribute>
            -->
            <td align="center">
                <xsl:value-of select="$allCount" />
            </td>
            <td align="center">
                <xsl:value-of select="$allSuccessCount" />
            </td>
            <xsl:choose>
                <xsl:when test="$allFailureCount > 0">
                    <td align="center" style="font-weight:bold;background:red;">
                        <xsl:value-of select="$allFailureCount" />
                    </td>
                </xsl:when>
                <xsl:otherwise>
                    <td align="center">
                        <xsl:value-of select="$allFailureCount" />
                    </td>
                </xsl:otherwise>
            </xsl:choose>
             
            <td align="center">
                <xsl:call-template name="display-percent">
                    <xsl:with-param name="value" select="$allSuccessPercent" />
                </xsl:call-template>
            </td>
 
            <td align="center">
                <xsl:choose>
                    <xsl:when test="$allFailurePercent >= $failure_rate ">
                        <xsl:attribute name="class">
                            <xsl:choose>
                                <xsl:when test="$allFailurePercent >= $failure_rate">Failure</xsl:when>
                            </xsl:choose>
                        </xsl:attribute>
                    </xsl:when>                  
                </xsl:choose>
                <xsl:call-template name="display-percent">
                    <xsl:with-param name="value" select="$allFailurePercent" />
                </xsl:call-template>         
            </td>
             
            <td align="center" id="isshow_Key_index1">
                <a href="javascript:void(0);" id="show">show</a>
            </td>
        </tr>
    </table>
     
    <div>
        <div style="display:none" id="img-box" class="container-fluid">
                <div class="row">
                        <div class="col-md-6">
                          <ul>
                                <li><h2>ResponseTimesOverTime</h2></li>
                                <li><img id="ResponseTimesOverTime" /></li>
                                <li><h2>TimesVsThreads</h2></li>
                                <li><img id="TimesVsThreads" /></li>
                          </ul>
                        </div>
 
                    <div class="col-md-6">
                        <ul>
                            <li><h2>ThroughputVsThreads</h2></li>
                            <li><img id="ThroughputVsThreads" /></li>
                            <li><h2>BytesThroughputOverTime</h2></li>
                            <li><img id="BytesThroughputOverTime" /></li>
                        </ul>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <ul>
                            <li><h2>HitsPerSecond</h2></li>
                            <li><img id="HitsPerSecond" /></li>
                        </ul>
                    </div>
                    <div class="col-md-6">
                        <ul>
                            <li><h2>TPS</h2></li>
                            <li><img id="TPS" /></li>
                        </ul>
                    </div>
                </div>
        </div>
    </div>
</xsl:template>
 
<xsl:template name="pagelist">
    <h2> Transaction【Fail:<span id="failed"></span>,Avg:大于3s <span id="yellow_1"></span> 大于5s <span id="orange_1"></span>  大于8s <span id="red_1"></span>,90% line:大于3s <span id="yellow_1"></span>  大于5s <span id="orange_1"></span>  大于8s <span id="red_1"></span>】</h2>
    <table align="center" class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
        <tr valign="top">
            <th>Transacthion Name</th>
            <th>Transacthion</th>
            <th>Pass</th>
            <th>Fail</th>
            <th>Passing Rate</th>
            <th>Failure Rate</th>
            <th>Average Time</th>
            <th>Min Time</th>
            <th>Max Time</th>
            <th>90% Line</th>
            <th>QPS</th>
            <th>Dedail</th>
        </tr>
        <xsl:for-each select="/testResults/*[not(@lb = preceding::*/@lb)]"   >
            <!-- 按平均时间排序 -->
            <xsl:sort select="sum(../*[@lb = current()/@lb]/@t) div count(../*[@lb = current()/@lb])" data-type="number" order="descending"/>
             
            <xsl:variable name="label" select="@lb" />
                     
            <!-- 统计所有事务总数 -->        
            <xsl:variable name="count" select="count(../*[@lb = current()/@lb])" />
            <!-- 统计执行失败的事务总数 -->
            <xsl:variable name="ffailureCount" select="../*[@lb = current()/@lb][attribute::s='false']"/>
            <xsl:variable name="failureCount">   
                <!--xsl:if test="sting-length(normalize-space($sChorus))=0"-->
                <xsl:if test="not($ffailureCount)">
                    <xsl:value-of select="0" />
                </xsl:if>
                <!--xsl:if test="sting-length(normalize-space($sChorus))>0"-->
                <xsl:if test="$ffailureCount">
                    <xsl:value-of select="count(../*[@lb = current()/@lb][attribute::s='false'])" />
                </xsl:if>
            </xsl:variable>
            <!-- 统计执行成功的事务总数 -->
            <xsl:variable name="ssuccessCount" select="../*[@lb = current()/@lb][attribute::s='true']"/>
            <xsl:variable name="successCount">   
                <!--xsl:if test="sting-length(normalize-space($sChorus))=0"-->
                <xsl:if test="not($ssuccessCount)">
                    <xsl:value-of select="0" />
                </xsl:if>
                <!--xsl:if test="sting-length(normalize-space($sChorus))>0"-->
                <xsl:if test="$ssuccessCount">
                    <xsl:value-of select="count(../*[@lb = current()/@lb][attribute::s='true'])" />
                </xsl:if>
            </xsl:variable>
             
            <!--xsl:variable name="successPercent" select="$successCount div $count" / -->
            <xsl:variable name="successPercent">         
                <xsl:if test="$count = 0">
                    <xsl:value-of select="0" />
                </xsl:if>
                <xsl:if test="$count > 0">
                    <xsl:value-of select="$successCount div $count" />
                </xsl:if>
            </xsl:variable>
                         
            <xsl:variable name="failurePercent">         
                <xsl:if test="$count = 0">
                    <xsl:value-of select="0" />
                </xsl:if>
                <xsl:if test="$count > 0">
                    <xsl:value-of select="$failureCount div $count" />
                </xsl:if>
            </xsl:variable>
             
            <xsl:variable name="totalTime" select="sum(../*[@lb = current()/@lb][attribute::s='true']/@t)"/>
             
            <xsl:variable name="averageTime">        
                <xsl:if test="$successCount = 0">
                    <xsl:value-of select="0" />
                </xsl:if>
                <xsl:if test="$successCount > 0">
                    <xsl:value-of select="$totalTime div $successCount" />
                </xsl:if>
            </xsl:variable>
                     
            <xsl:variable name="minTime">
                <xsl:call-template name="min">
                    <xsl:with-param name="nodes" select="../*[@lb = current()/@lb][attribute::s='true']/@t" />
                </xsl:call-template>
            </xsl:variable>
             
            <xsl:variable name="maxTime">
                <xsl:call-template name="max">
                    <xsl:with-param name="nodes" select="../*[@lb = current()/@lb][attribute::s='true']/@t" />
                </xsl:call-template>
            </xsl:variable>
             
            <!-- new add 90% line time -->
            <xsl:variable name="nintyTime">
                <xsl:call-template name="lineTime">
                    <xsl:with-param name="nodes" select="../*[@lb = current()/@lb][attribute::s='true']/@t" />
                </xsl:call-template>
            </xsl:variable>
             
            <xsl:variable name="qpsTime">        
                <xsl:if test="$totalTime = 0">
                    <xsl:value-of select="0" />
                </xsl:if>
                <xsl:if test="$totalTime > 0">
                    <xsl:value-of select="$successCount * 1000 div $totalTime" />
                </xsl:if>
            </xsl:variable>
             
            <tr valign="top" class="top">
                <td align="center">
                    <xsl:if test="$failureCount > 0">
                        <a><xsl:attribute name="href">#<xsl:value-of select="$label" /></xsl:attribute>
                            <xsl:value-of select="$label" />
                        </a>
                    </xsl:if>
                    <xsl:if test="0 >= $failureCount">
                        <xsl:value-of select="$label" />
                    </xsl:if>
                </td>
                 
                <td align="center">
                    <xsl:value-of select="$count" />
                </td>
                 
                <td align="center">
                    <xsl:value-of select="$successCount" />
                </td>
                 
                <td align="center">
                    <xsl:choose>
                        <!-- 失败用例标红显示 -->
                        <xsl:when test="$failureCount > 0">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$failureCount > 0">Failure</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                    </xsl:choose>
                    <xsl:value-of select="$failureCount" />
                </td>
                 
                <td align="center">
                    <xsl:call-template name="display-percent">
                        <xsl:with-param name="value" select="$successPercent" />
                    </xsl:call-template>
                </td>
                 
                <td align="center">
                    <xsl:choose>
                        <xsl:when test="$failurePercent >= $failure_rate ">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$failurePercent >= $failure_rate">Failure</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>                  
                    </xsl:choose>
                    <xsl:call-template name="display-percent">
                        <xsl:with-param name="value" select="$failurePercent" />
                    </xsl:call-template>
                </td>
                                 
                <td align="center">
                    <xsl:choose>
                        <!-- 平均时间超过8s,显示红色 -->
                        <xsl:when test="$averageTime > 8000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$averageTime > 8000">Time8s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
 
                        <!-- 平均时间超过5s,显示橙色 -->
                        <xsl:when test="$averageTime > 5000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$averageTime > 5000">Time5s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                         
                        <!-- 平均时间超过3s,显示黄色 -->
                        <xsl:when test="$averageTime > 3000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$averageTime > 3000">Time3s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                    </xsl:choose>
                    <xsl:call-template name="display-time">
                        <xsl:with-param name="value" select="$averageTime" />
                    </xsl:call-template>
                     
                </td>
                <td align="center">
                    <xsl:call-template name="display-time">
                        <xsl:with-param name="value" select="$minTime" />
                    </xsl:call-template>
                </td>
                <td align="center" >
                    <xsl:call-template name="display-time">
                        <xsl:with-param name="value" select="$maxTime" />
                    </xsl:call-template>
                </td>
                <!-- Page页面添加90% LineTime -->
                <td align="center">
                    <xsl:choose>
                        <!-- 90%时间超过8s,显示红色 -->
                        <xsl:when test="$nintyTime > 8000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$nintyTime > 8000">NintyTime8s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                         
                        <!-- 90%时间超过5s,显示橙色 -->
                        <xsl:when test="$nintyTime > 5000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$nintyTime > 5000">NintyTime5s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                         
                        <!-- 90%时间超过3s,显示黄色 -->
                        <xsl:when test="$nintyTime > 3000">
                            <xsl:attribute name="class">
                                <xsl:choose>
                                    <xsl:when test="$nintyTime > 3000">NintyTime3s</xsl:when>
                                </xsl:choose>
                            </xsl:attribute>
                        </xsl:when>
                    </xsl:choose>
                     
                    <xsl:call-template name="display-time">
                        <xsl:with-param name="value" select="$nintyTime" />
                    </xsl:call-template>
                </td>
                <td align="center">
                    <xsl:call-template name="display-qps">
                        <xsl:with-param name="value" select="$qpsTime" />
                    </xsl:call-template>
                </td>
                <td align="center">
                   <a href="" id="" style="display:inline-block; width:60px; height:22px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;" ><xsl:attribute name="href"><xsl:text/>javascript:change('page_details_<xsl:value-of select="position()" />')</xsl:attribute>
                   <xsl:attribute name="id"><xsl:text/>page_details_<xsl:value-of select="position()" />_image</xsl:attribute>show</a>
                </td>
            </tr>
 
             
            <tr class="page_details">
                <xsl:attribute name="id"><xsl:text/>page_details_<xsl:value-of select="position()" /></xsl:attribute>
                <td colspan="8" bgcolor="#FF0000">
                    <div align="center">
                        <b>Details for Transaction "<xsl:value-of select="$label" />"</b>
                        <table bordercolor="#000000" bgcolor="#2674A6" border="0"  cellpadding="1" cellspacing="1" width="95%">
                            <tr>
                                <th>Thread</th>
                                <th>Iteration</th>
                                <th>Time (milliseconds)</th>
                                <th>Bytes</th>
                                <th>Pass(true/false)</th>
                            </tr>                                         
                            <xsl:for-each select="../*[@lb = $label and @tn != $label]">
                            <xsl:variable name="responsetime" select="@t" />
                            <xsl:variable name="failuress" select="@s" />
                                <tr>
                                   <td align="center"><xsl:value-of select="@tn" /></td>
                                   <td align="center"><xsl:value-of select="position()" /></td>
                                   <td align="center">
                                        <xsl:choose>
                                        <!-- 时间超过8s,显示红色 -->
                                        <xsl:when test="$responsetime > 8000">
                                            <xsl:attribute name="id">
                                                <xsl:choose>
                                                    <xsl:when test="$responsetime > 8000">RPSTime8s</xsl:when>
                                                </xsl:choose>
                                            </xsl:attribute>
                                        </xsl:when>
                                             
                                        <!-- 时间超过5s,显示橙色 -->
                                        <xsl:when test="$responsetime > 5000">
                                            <xsl:attribute name="id">
                                                <xsl:choose>
                                                    <xsl:when test="$responsetime > 5000">RPSTime5s</xsl:when>
                                                </xsl:choose>
                                            </xsl:attribute>
                                        </xsl:when>
                                             
                                        <!-- 时间超过3s,显示黄色 -->
                                        <xsl:when test="$responsetime > 3000">
                                            <xsl:attribute name="id">
                                                <xsl:choose>
                                                    <xsl:when test="$responsetime > 3000">RPSTime</xsl:when>
                                                </xsl:choose>
                                            </xsl:attribute>
                                        </xsl:when>
                                             
                                    </xsl:choose>
                                        <xsl:value-of select="@t" />
                                   </td>
                                   <!--  TODO allow for missing bytes field -->
                                   <td align="center"><xsl:value-of select="@by" /></td>
                                   <td align="center">
                                        <xsl:choose>
                                            <!-- 失败用例标红显示 -->
                                            <xsl:when test="$failuress='false'">
                                                <xsl:attribute name="id">
                                                    <xsl:choose>
                                                        <xsl:when test="$failuress='false'">failures</xsl:when>
                                                    </xsl:choose>
                                                </xsl:attribute>
                                            </xsl:when>
                                        </xsl:choose>
                                        <xsl:value-of select="@s" />
                                   </td>
                                </tr>
                            </xsl:for-each>
                        </table>
                    </div>
                </td>
            </tr>
        </xsl:for-each>
    </table>
</xsl:template>
 
<xsl:template name="detail">
    <xsl:variable name="allFailureCount" select="count(/testResults/*[attribute::s='false'])" />
 
    <xsl:if test="$allFailureCount > 0">
        <h2>Transaction Failure Detail:</h2>
 
            <xsl:for-each select="/testResults/*[not(@lb = preceding::*/@lb)]">
            <xsl:variable name="failureCount" select="count(../*[@lb = current()/@lb][attribute::s='false'])" />
            <xsl:if test="$failureCount > 0">
             
                <h3><xsl:value-of select="@lb" /><a><xsl:attribute name="name"><xsl:value-of select="@lb" /></xsl:attribute></a> :
                   <a href="" id="" style="display:inline-block; width:60px; height:22px; line-height:22px; background:red; text-align: center; border-radius: 3px; color:#FFF;" ><xsl:attribute name="href"><xsl:text/>javascript:change1('Failure_Detail_<xsl:value-of select="position()" />')</xsl:attribute>
                   <xsl:attribute name="id"><xsl:text/>Failure_Detail_<xsl:value-of select="position()" />_image</xsl:attribute>show</a> </h3>
                    
                    <table class="details" bordercolor="#000000" bgcolor="#2674A6" style="display:none;" border="0" cellpadding="1" cellspacing="1" width="95%" align="center" >
                        <xsl:attribute name="id"><xsl:text/>Failure_Detail_<xsl:value-of select="position()" /></xsl:attribute>
 
                        <tr valign="top">
                            <th align="center">Response</th>
                            <th align="center">Failure Message</th>
                            <xsl:if test="$showData = 'y'">
                                <th align="left">Response Data</th>
                            </xsl:if>
                        </tr>
                     
                        <xsl:for-each select="/testResults/*[@lb = current()/@lb][attribute::s='false']">
                            <tr>
                                <td align="center"><xsl:value-of select="@rc | @rs" /> - <xsl:value-of select="@rm" /></td>
                                <td><xsl:value-of select="assertionResult/failureMessage" /></td>
                                <xsl:if test="$showData = 'y'">
                                    <td><xsl:value-of select="responseData" /></td>
                                </xsl:if>
                            </tr>
                        </xsl:for-each>  
                    </table>
 
            </xsl:if>
 
        </xsl:for-each>
    </xsl:if>
</xsl:template>
 
 
 
<xsl:template name="min">
    <xsl:param name="nodes" select="/.." />
    <xsl:choose>
        <xsl:when test="not($nodes)">0.00</xsl:when>
        <xsl:otherwise>
            <xsl:for-each select="$nodes">
                <xsl:sort data-type="number" />
                <xsl:if test="position() = 1">
                    <xsl:value-of select="number(.)" />
                </xsl:if>
            </xsl:for-each>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
 
<xsl:template name="max">
    <xsl:param name="nodes" select="/.." />
    <xsl:choose>
        <xsl:when test="not($nodes)">0.00</xsl:when>
        <xsl:otherwise>
            <xsl:for-each select="$nodes">
                <xsl:sort data-type="number" order="descending" />
                <xsl:if test="position() = 1">
                    <xsl:value-of select="number(.)" />
                </xsl:if>
            </xsl:for-each>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
 
<!-- 90% line time -->
<xsl:template name="lineTime">
    <xsl:param name="nodes" select="/.." />
    <xsl:choose>
        <xsl:when test="not($nodes)">0.00</xsl:when>
        <xsl:otherwise>
            <xsl:for-each select="$nodes">
                <xsl:sort data-type="number" />
                <!-- last() 返回当前上下文中的最后一个节点位置数 -->
                <!-- ceiling(number) 返回大于number的最小整数 -->
                <!-- floor(number) 返回不大于number的最大整数 -->
                <!-- position() 返回当前节点位置的数字 -->
                <!-- number(object) 使对象转换成数字 -->
                <xsl:choose>
                    <!-- 当只有一个节点时,向上取整 -->
                    <xsl:when test="last() = 1">
                        <xsl:if test="position() = ceiling(last()*0.9)">
                            <xsl:value-of select="number(.)" />
                        </xsl:if>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:if test="position() = floor(last()*0.9)">
                            <xsl:value-of select="number(.)" />
                        </xsl:if>
                      </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
 
<xsl:template name="display-percent">
    <xsl:param name="value" />
    <xsl:value-of select="format-number($value,'0.00%')" />
</xsl:template>
 
<xsl:template name="display-time">
    <xsl:param name="value" />
    <xsl:value-of select="format-number($value,'0.00 ms')" />
</xsl:template>
 
<xsl:template name="display-qps">
    <xsl:param name="value" />
    <xsl:value-of select="format-number($value,'0.000 /s')" />
</xsl:template>
 
</xsl:stylesheet>

 

posted @   志不坚者智不达  阅读(2839)  评论(2编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示