Saxon comes with a simple tool allowing profiling of the execution time in a stylesheet.
To run this tool, first execute the transformation with the -TP
option, which
sends timed tracing information to the standard error output file:
java -jar dir/saxon9he.jar -TP source stylesheet 2>profile.xml
Then run another transformation to create a profile report from the output of this tracing tool
(the stylesheet can be found in the directory samples/analysis
):
java -jar dir/saxon9he.jar profile.xml timing-profile.xsl >profile.html
The stylesheet timing-profile.xsl
can be found in the samples/analysis
directory, installed from the saxon-resources
download collection.
Finally, view the resulting profile.html
file in your browser.
The output identifies instructions in the original stylesheet by their name, line number, and the last few characters of the URI of their module. For each instruction it gives the number of times the instruction was executed, the average time in milliseconds of each execution, and the total time. The table is sorted according to a weighting function that attempts to put the dominant instructions at the top. These will not necessarily be those with the greatest time, which tend to be instructions that were only executed once but remained active for the duration of the transformation.