prof:invoke

prof:invoke(
   $path as xs:string,
   [$vars as item()*],
   [$options as (element()|map:map)?]
) as item()*

Summary

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.

Parameters
path The path of the module to be executed. The path is resolved against the root of the App Server evaluating the query. The path must resolve to a main module (not a library module).
vars The external variable values for this evaluation. This must be a sequence of even length, alternating QNames and items. Each QName and item pair specify a variable name and value.
options The options node. The default value is (). The node must be in the xdmp:eval namespace. See the xdmp:eval section for a list of options.

Required Privileges

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).

Example

  prof:invoke("http://example.com/modules/foo.xqy")
  => (<prof:report>...</prof:report>,42)
Powered by MarkLogic Server | Terms of Use | Privacy Policy