Changes

Jump to navigation Jump to search
2,563 bytes added ,  13:42, 15 June 2012
Created page with "This XQuery Module contains functions for XQuery code. =Conventions= All functions in this module are assigned to the {{Code|http://basex.org/modules/prof}} ..."
This [[Module Library|XQuery Module]] contains functions for XQuery code.

=Conventions=

All functions in this module are assigned to the {{Code|http://basex.org/modules/prof}} namespace, which is statically bound to the {{Code|prof}} prefix.<br/>
All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.

=Functions=

=Profiling=

==prof:time==

In {{Version|7.2}}, the {{Code|$label}} argument was added to the function:
{|
|-
| width='90' | '''Signatures'''
|{{Func|prof:time|$expr as item()|item()*}}<br />{{Func|prof:time|$expr as item(), $cache as xs:boolean|item()*}}<br />{{Func|prof:time|$expr as item(), $cache as xs:boolean, $label as xs:string|item()*}}
|-
| '''Summary'''
|Measures the time needed to evaluate {{Code|$expr}} and sends it to standard error or, if the GUI is used, to the Info View.<br />If {{Code|$cache}} is set to {{Code|true()}}, the result will be temporarily cached. This way, a potential iterative execution of the expression (which often yields different memory usage) is blocked.<br/>A third, optional argument {{Code|$label}} may be specified to tag the profiling result.
|-
| '''Examples'''
|
* {{Code|prof:time("1 to 100000")}} may output {{Code|25.69 ms}}.
* {{Code|prof:time("1 to 100000", true())}} may output {{Code|208.12 ms}}.
|}

==prof:mem==

In {{Version|7.2}}, the {{Code|$label}} argument was added to the function:
{|
|-
| width='90' | '''Signatures'''
|{{Func|prof:mem|$expr as item()|item()*}}<br />{{Func|prof:mem|$expr as item(), $cache as xs:boolean|item()*}}<br />{{Func|prof:mem|$expr as item(), $cache as xs:boolean, $label as xs:string|item()*}}
|-
| '''Summary'''
|Measures the memory allocated by evaluating {{Code|$expr}} and sends it to standard error or, if the GUI is used, to the Info View.<br />If {{Code|$cache}} is set to {{Code|true()}}, the result will be temporarily cached. This way, a potential iterative execution of the expression (which often yields different memory usage) is blocked.<br/>A third, optional argument {{Code|$label}} may be specified to tag the profiling result.
|-
| '''Examples'''
|
* {{Code|prof:mb("1 to 100000")}} may output {{Code|0 Bytes}}.
* {{Code|prof:mb("1 to 100000", true())}} may output {{Code|26.678 mb}}.
|}

==prof:sleep==

{|
|-
| width='90' | '''Signatures'''
|{{Func|prof:sleep|$ms as xs:integer|empty-sequence()*}}<br />
|-
| '''Summary'''
|Sleeps for the specified number of milliseconds.
|}

=Changelog=

This module was introduced with Version 7.3.

[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu