prof:eval( $xquery as xs:string, [$vars as item()*], [$options as (element()|map:map)?] ) as item()*
Evaluate a string as XQuery code for profiling. A prof:report
node
will be prepended to any output produced by evaluating the string.
If profiling is not enabled for the App Server, this function will
throw a PROF-PROFILEALLOW
exception.
Note that profiling does not cross eval/invoke boundaries. If the request being profiled calls xdmp:eval or xdmp:invoke, the individual expressions in that code will not be profiled. The overall time taken by the called code will appear as a single call in the caller's profiling report.
Either
http://marklogic.com/xdmp/privileges/profile-my-requests
or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for prof:eval
(the profile-my-requests
privilege is suffient because the resulting request is always run by
the same user who initiated the call, but the
profile-any-requests
privilege will also work).
prof:eval("xdmp:random()") => (<prof:report>...</prof:report>,9478952250821284456)