| 1 | <?xml version='1.0' encoding='UTF-8'?> |
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 3 | xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| 4 | xmlns:f="http://saxonica.com/ns/profile-functions" |
| 5 | exclude-result-prefixes="xs" |
| 6 | expand-text="yes" |
| 7 | version="3.0"> |
| 8 | |
| 9 | <xsl:param name="lang" as="xs:string" static="yes" required="yes"/> |
| 10 | |
| 11 | <xsl:variable name="process" as="xs:string" static="yes" select="if ($lang = 'XSLT') then 'Stylesheet' else 'Query'"/> |
| 12 | <xsl:variable name="templateOr" select="if ($lang = 'XSLT') then 'template, ' else ''"/> |
| 13 | <xsl:variable name="templatesAnd" select="if ($lang = 'XSLT') then 'templates and ' else ''"/> |
| 14 | |
| 15 | <xsl:variable name="style" as="xs:string" expand-text="no"> |
| 16 | |
| 17 | |
| 18 | body { |
| 19 | background: #e4eef0; |
| 20 | } |
| 21 | |
| 22 | h1 { |
| 23 | font-family: Verdana, Arial, Helvetica, sans-serif; |
| 24 | font-size: 14pt; |
| 25 | font-style: normal; |
| 26 | color: #3D5B96; |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | h2 { |
| 31 | font-family: Verdana, Arial, Helvetica, sans-serif; |
| 32 | font-size: 12pt; |
| 33 | font-style: normal; |
| 34 | color: #96433D; |
| 35 | font-weight: bold; |
| 36 | } |
| 37 | |
| 38 | p { |
| 39 | font-family: Verdana, Arial, Helvetica, sans-serif; |
| 40 | font-size: 9pt; |
| 41 | font-style: normal; |
| 42 | color: #3D5B96; |
| 43 | font-weight: normal; |
| 44 | line-height: 1.3em; |
| 45 | padding-right:15px; |
| 46 | } |
| 47 | |
| 48 | table { |
| 49 | border-collapse: collapse; |
| 50 | border: 1px solid black; |
| 51 | } |
| 52 | |
| 53 | th, td { |
| 54 | border: 1px solid black; |
| 55 | font-family: Verdana, Arial, Helvetica, sans-serif; |
| 56 | font-size: 9pt; |
| 57 | font-style: normal; |
| 58 | color: #3D5B96; |
| 59 | text-decoration: none; |
| 60 | line-height: 1.3em; |
| 61 | padding-left: 15px; |
| 62 | text-indent: -15px; |
| 63 | padding-right: 15px; |
| 64 | padding-top: 0px; |
| 65 | padding-bottom: 0px; |
| 66 | } |
| 67 | |
| 68 | th { |
| 69 | background: #B1CCC7; |
| 70 | font-weight: bold; |
| 71 | } |
| 72 | |
| 73 | td { |
| 74 | font-weight: normal; |
| 75 | } |
| 76 | |
| 77 | </xsl:variable> |
| 78 | |
| 79 | <xsl:template match="*"> |
| 80 | <html> |
| 81 | <head> |
| 82 | <title>Analysis of {$process} + Execution Time</title> |
| 83 | <style>{$style}</style> |
| 84 | </head> |
| 85 | <body> |
| 86 | <h1>Analysis of {$process} Execution Time</h1> |
| 87 | <p>Total time: {format-number(@t-total, "#0.000")} milliseconds</p> |
| 88 | <h2>Time spent in each {$templateOr} function or global variable:</h2> |
| 89 | <p>The table below is ordered by the total net time spent in the {$templateOr} |
| 90 | function or global variable. Gross time means the time including called |
| 91 | {$templatesAnd} functions (recursive calls only count from the original entry); |
| 92 | net time means time excluding time spent in called {$templatesAnd} functions.</p> |
| 93 | <table> |
| 94 | <thead> |
| 95 | <tr> |
| 96 | <th>module</th> |
| 97 | <th>line</th> |
| 98 | <th>instruction</th> |
| 99 | <th>count</th> |
| 100 | <th>average time (gross/ms)</th> |
| 101 | <th>total time (gross/ms)</th> |
| 102 | <th>average time (net/ms)</th> |
| 103 | <th>total time (net/ms)</th> |
| 104 | </tr> |
| 105 | </thead> |
| 106 | <tbody> |
| 107 | <xsl:for-each select="fn"> |
| 108 | <xsl:sort select="number(@t-sum-net)" order="descending"/> |
| 109 | <tr> |
| 110 | <td><a href="{@file}">{tokenize(@file, '/')[last()]}</a></td> |
| 111 | <td align="right">{@line}</td> |
| 112 | <td>{@construct, @name, @match}</td> |
| 113 | <td align="right">{format-number(@count, ',##0')}</td> |
| 114 | <td align="right">{format-number(@t-avg, '#0.000')}</td> |
| 115 | <td align="right">{format-number(@t-sum, ',##0.000')}</td> |
| 116 | <td align="right">{format-number(@t-avg-net, '#0.000')}</td> |
| 117 | <td align="right">{format-number(@t-sum-net, ',##0.000')}</td> |
| 118 | </tr> |
| 119 | </xsl:for-each> |
| 120 | </tbody> |
| 121 | </table> |
| 122 | </body> |
| 123 | </html> |
| 124 | </xsl:template> |
| 125 | </xsl:stylesheet> |