xsl-list
[Top] [All Lists]

Re: [xsl] How to output the start execution time and the end execution time?

2014-09-06 10:56:52
At 2014-09-06 09:46 +0000, Costello, Roger L. costello(_at_)mitre(_dot_)org 
wrote:
Hi Folks,

I would like to:

1. Output the time that my XSLT program starts processing
2. Do the processing
3. Output the time that my XSLT program finishes processing

This doesn't work:

    <xsl:template match="/">
        <xsl:value-of select="current-time()" />
        ... do the processing ...
        <xsl:value-of select="current-time()" />
    </xsl:template>

The current time is a static value for the duration of execution of the stylesheet.

What is the correct way to accomplish this?

Outside of XSLT. Record the time, invoke and execute the stylesheet, record the time.

I suggestion you also take the time (so to speak) to run your input data through the following stylesheet:

===8<---
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="2.0">

<xsl:template match="/">
  <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>
===8<---

... and take that duration away from your execution duration so that you have accommodated the time to build the input tree and serialize an output tree (even if the output tree won't be identical at least you'll get some time accommodated). That time is separate from your logic processing time.

If you have the chance to run your "... do the processing ..." multiple times, say 100 times, and then divide the execution time by 100 that might give you some accuracy (then, again, perhaps not if the optimization precludes some execution for 99 times).

I hope this helps.

. . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/ |
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com 
|
Google+ profile:      http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>