From: Dannes W. <da...@ex...> - 2014-09-08 18:55:55
|
Hi, On 8 Sep 2014, at 20:47 , Chris Tomlinson <chr...@gm...> wrote: > Is there a way to time a query or function execution to milliseconds (or finer)? > > I try something like: > >> let $start := current-time() >> let $hits := run-query >> let $stop := current-time() > > but returning $stop - $start returns PT0S > > eXide flashes up the execution time of a "Run" in milliseconds courtesy of jquery I think. The xpath function has to return the same value for the whole duration of the xquery ; see the spec http://www.w3.org/TR/xpath-functions/#func-current-time ; instead use the functions from util: util:system-date util:system-date() as xs:date Returns the current xs:date (with timezone) as reported by the Java method System.currentTimeMillis(). Contrary to fn:current-date, this function is not stable, i.e. the returned xs:date will change during the evaluation time of a query and can be used to measure time differences. Returns: xs:date : the current xs:date (with timezone) util:system-dateTime util:system-dateTime() as xs:dateTime Returns the current xs:dateTime (with timezone) as reported by the Java method System.currentTimeMillis(). Contrary to fn:current-dateTime, this function is not stable, i.e. the returned xs:dateTime will change during the evaluation time of a query and can be used to measure time differences. Returns: xs:dateTime : the current xs:dateTime (with timezone) regards Dannes |