Changes

Jump to navigation Jump to search
55 bytes added ,  17:35, 23 November 2017
no edit summary
All functions and errors in this module are assigned to the <code><nowiki>http://basex.org/modules/prof</nowiki></code> namespace, which is statically bound to the {{Code|prof}} prefix.<br/>
=Performance Functions=
==prof:time==
|}
==prof:sleepcurrent-ms==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:sleepcurrent-ms||$ms as xs:integer|empty-sequence()}}<br />
|-
| '''Summary'''
|Sleeps for Returns the specified number of milliseconds passed since 1970/01/01 UTC. The granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.
|-
| '''Properties'''
|The In contrast to {{Code|fn:current-time()}}, the function is ''non-deterministic'': and returns different values every time it is called. Its evaluation order will be preserved by the compiler.|-| '''Examples'''|* {{Code|convert:integer-to-dateTime(prof:current-ms())}} returns the current miliseconds in the {{Code|xs:dateTime}} format.
|}
==prof:humancurrent-ns==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:humancurrent-ns||$number as xs:integer|xs:string}}<br />
|-
| '''Summary'''
|Returns a human-readable representation the current value of the specified most precise available system timer in nanoseconds.|-| '''Properties'''|In contrast to {{Code|$numberfn:current-time()}}, the function is ''non-deterministic'' and returns different values every time it is called. Its evaluation order will be preserved by the compiler.
|-
| '''ExampleExamples'''|Measures the time of an expression:<pre class="brush:xquery">let $ns1 := prof:current-ns()return ( (: process to measure :) (1 to 1000000)[. = 0],* {{Code| let $ns2 := prof:humancurrent-ns() let $ms := (16384(($ns2 - $ns1)}} returns {{Codeidiv 10000) div 100) return $ms |16K}}.| ' ms')</pre>
|}
 
=Debugging Functions=
==prof:dump==
|}
==prof:current-mstype==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:current-mstype|$expr as item()*|xs:integeritem()*}}<br />
|-
| '''Summary'''
|Returns the number of milliseconds passed since 1970/01/01 UTC. The granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.|-| '''Properties'''|In contrast Similar to {{Code|fn:current-timetrace($expr, $msg)}}, the function is ''nonbut instead of a user-deterministic'' and returns different values every time defined message, it is called. Its evaluation order will be preserved by emits the compiler.|compile-| '''Examples'''|* {{Code|convert:integer-to-dateTime(prof:current-ms())}} returns the current miliseconds in the {{Code|xs:dateTime}} formattime type and estimated result size of its argument.
|}
=Helper Functions= ==prof:current-nsvoid==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:current-nsvoid|$value as item()*|xs:integerempty-sequence()}}<br />
|-
| '''Summary'''
|Returns Swallows all items of the current specified {{Code|$value of }} and returns an empty sequence. This function is helpful if some code needs to be evaluated and if the most precise available system timer in nanosecondsactual result is irrelevant.
|-
| '''Properties'''
|In contrast to {{Code|fn:current-time()}}, the The function is ''non-deterministic'' and returns different values every time it is called. Its : evaluation order will be preserved by the compiler.
|-
| '''Examples'''
| Measures the time of an expression:<pre class="brush:xquery">let $ns1 := * {{Code|prof:current-nsvoid()return ( fetch:binary('http: process to measure ://my.rest.service') (1 to 1000000)[}} performs an HTTP request and ignores the result. = 0], let $ns2 := prof:current-ns() let $ms := ((($ns2 - $ns1) idiv 10000) div 100) return $ms || ' ms')</pre>
|}
==prof:voidsleep==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:voidsleep|$value ms as item()*xs:integer|empty-sequence()}}<br />
|-
| '''Summary'''
|Swallows all items of Sleeps for the specified {{Code|$value}} and returns an empty sequence. This function is helpful if some code needs to be evaluated and if the actual result is irrelevantnumber of milliseconds.
|-
| '''Properties'''
|The function is ''non-deterministic'': evaluation order will be preserved by the compiler.
|-
| '''Examples'''
|
* {{Code|prof:void(fetch:binary('http://my.rest.service'))}} performs an HTTP request and ignores the result.
|}
==prof:typehuman==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|prof:typehuman|$expr number as item()*xs:integer|item()*xs:string}}
|-
| '''Summary'''
|Similar to Returns a human-readable representation of the specified {{Code|fn$number}}.|-| '''Example'''|* {{Code|prof:tracehuman($expr, $msg16384)}}, but instead of a user-defined message, it emits the compile-time type and estimated result size of its argumentreturns {{Code|16K}}.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu