prof:invoke( $path as xs:string, [$vars as item()*], [$options as (element()|map:map)?] ) as item()*
Profiles and returns the result of evaluating a module at the given path.
Any result produced by the evaluation will be prepended with a
prof:report
node containing timing and count information
about the evaluation.
If profiling is not allowed 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.
For details on profiling requests and interpreting the output of a profile request, see Profiling Requests to Evaluate Performance in the Query Performance and Tuning Guide.
Either
http://marklogic.com/xdmp/privileges/profile-my-requests
or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for prof:invoke
(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:invoke("http://example.com/modules/foo.xqy") => (<prof:report>...</prof:report>,42)