Loading TOC...

prof:eval

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

Summary

Evaluate a string as an XQuery for profiling. A prof:report node will be prepended to any output produced by evaluating the string. 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.

Parameters
xquery The XQuery string to be evaluated. If the XQuery string contains double quotes ("), surround the string with single quotes (').
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.

Required Privileges

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

Example

  prof:eval("xdmp:random()")
  => (<prof:report>...</prof:report>,9478952250821284456)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.