|
|
prof:allowed(
|
|
$request-id as xs:unsignedLong
|
| ) as xs:boolean |
|
 |
Summary:
Returns the value of the Profile Allow setting for the
App Server or Task Server upon which the target request
is running. This function is useful to determine if subsequent
calls to profiling functions will be effective.
|
Parameters:
$request-id
:
A request ID.
|
|
Required Privilege:
Either
http://marklogic.com/xdmp/privileges/profile-my-requests or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for profiling requests other than the current request, with
the profile-my-requests privilege allowing profiling of
requests issued by the same user ID, and the
profile-any-requests privilege allowing profiling of requests
issued by any user ID. No privilege is required to profile the currently
running request (that is, self-profiling is always allowed).
|
Usage Notes:
Use this function to determine if profiling is allowed on the
App Server that owns the target request. This will indicate
whether the other profiling functions will be effective.
If the Profile Allow setting is off on the App Server, then calls to
profiling functions do nothing and return the empty sequence. You can use
prof:allow to test if profiling is allowed on the App Server,
and if it is then use the other profiling APIs to profile other requests
or to call prof:eval or prof:invoke;
if it is not allowed,
then your code does not call them. This type of logic allows you to
keep profiling code in your XQuery code and it will only be executed if
profiling is allowed in the context in which the code is run, thus
allowing you to globally (at the App Server level) switch off
profiling without breaking any code.
Appropriate privileges are required to call this function,
as with the other profiling functions. The return value is
the state of the App Server Profile Allow setting. This
function does not verify that the target request is stopped
for debugging, which is required for one request to profile another.
|
Example:
prof:allowed(xdmp:request())
=> true
|
Example:
let $profallowed := prof:allowed(xdmp:request())
return
(
if ( $profallowed )
then ( prof:eval('fn:current-dateTime()') )
else ( ),
"your code here"
)
=> The profile report (only if profiling is enabled
on the App Server) followed by the output of your code.
|
|
|
|
prof:disable(
|
|
$request-id as xs:unsignedLong
|
| ) as empty-sequence() |
|
 |
Summary:
Disable profiling for this request. Profiling may be
enabled or disabled as often as you like. Disabling does
not clear accumulated profiling statistics. Disabling while
disabled has no effect.
If profiling is not allowed for the App Server, this function does nothing.
|
Parameters:
$request-id
:
A request ID. Use the xdmp:request() function, which
returns the request ID for the currently running request, to specify
the current request.
|
|
Required Privilege:
Either
http://marklogic.com/xdmp/privileges/profile-my-requests or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for profiling requests other than the current request, with
the profile-my-requests privilege allowing profiling of
requests issued by the same user ID, and the
profile-any-requests privilege allowing profiling of requests
issued by any user ID. No privilege is required to profile the currently
running request (that is, self-profiling is always allowed).
|
Usage Notes:
Any expressions evaluated after prof:disable is called
(but before prof:enable is called again) will
not be profiled and will not appear in the profile report.
|
Example:
prof:disable(xdmp:request())
=> ()
|
Example:
prof:enable(xdmp:request()),
fn:concat("hello", " world"),
prof:disable(xdmp:request()),
fn:current-dateTime(),
prof:report(xdmp:request())
=> A profile report that does not include
the call to fn:current-dateTime().
|
|
|
|
prof:enable(
|
|
$request-id as xs:unsignedLong
|
| ) as empty-sequence() |
|
 |
Summary:
Enable profiling for this request. Profiling may be
enabled or disabled as often as you like. Enabling while
a request is enabled has no effect.
If profiling is not allowed for the App Server, this function
does nothing.
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:
$request-id
:
A request ID. Use the xdmp:request() function, which
returns the request ID for the currently running request, to specify
the current request.
|
|
Required Privilege:
Either
http://marklogic.com/xdmp/privileges/profile-my-requests or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for profiling requests other than the current request, with
the profile-my-requests privilege allowing profiling of
requests issued by the same user ID, and the
profile-any-requests privilege allowing profiling of requests
issued by any user ID. No privilege is required to profile the currently
running request (that is, self-profiling is always allowed).
|
Example:
prof:enable(xdmp:request())
=> ()
|
|
|
|
prof:report(
|
|
$request-id as xs:unsignedLong
|
| ) as element(prof:report)? |
|
 |
Summary:
Return a prof:report node containing the current state of
profiling statistics for the given request. If profiling
has never been enabled for the request, the empty sequence
is returned.
If profiling is not allowed for the App Server, this function
returns an empty sequence.
|
Parameters:
$request-id
:
A request ID. Use the xdmp:request() function, which
returns the request ID for the currently running request, to specify
the current request.
|
|
Required Privilege:
Either
http://marklogic.com/xdmp/privileges/profile-my-requests or
http://marklogic.com/xdmp/privileges/profile-any-requests
is required for profiling requests other than the current request, with
the profile-my-requests privilege allowing profiling of
requests issued by the same user ID, and the
profile-any-requests privilege allowing profiling of requests
issued by any user ID. No privilege is required to profile the currently
running request (that is, self-profiling is always allowed).
|
Example:
(: Before running this, make sure profiling is enabled
on the App Server :)
prof:enable(xdmp:request()),
fn:current-dateTime(),
prof:report(xdmp:request())
=>
2007-02-16T19:24:30.093-08:00
<prof:report xsi:schemaLocation="http://marklogic.com/xdmp/profile
profile.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:prof="http://marklogic.com/xdmp/profile">
<prof:metadata>
<prof:overall-elapsed>PT0S</prof:overall-elapsed>
<prof:created>2007-02-16T19:24:30.093-08:00</prof:created>
<prof:server-version>3.2-20070214</prof:server-version>
</prof:metadata>
<prof:histogram>
<prof:expression>
<prof:expr-id>11698068205613195480</prof:expr-id>
<prof:expr-source>prof:report(xdmp:request())</prof:expr-source>
<prof:uri/>
<prof:line>3</prof:line>
<prof:count>0</prof:count>
<prof:shallow-time>PT0S</prof:shallow-time>
<prof:deep-time>PT0S</prof:deep-time>
</prof:expression>
<prof:expression>
<prof:expr-id>6277409173981051716</prof:expr-id>
<prof:expr-source>xdmp:request()</prof:expr-source>
<prof:uri/>
<prof:line>3</prof:line>
<prof:count>1</prof:count>
<prof:shallow-time>PT0S</prof:shallow-time>
<prof:deep-time>PT0S</prof:deep-time>
</prof:expression>
<prof:expression>
<prof:expr-id>13716364291188563274</prof:expr-id>
<prof:expr-source>current-dateTime()</prof:expr-source>
<prof:uri/>
<prof:line>2</prof:line>
<prof:count>1</prof:count>
<prof:shallow-time>PT0S</prof:shallow-time>
<prof:deep-time>PT0S</prof:deep-time>
</prof:expression>
<prof:expression>
<prof:expr-id>6174150852679522465</prof:expr-id>
<prof:expr-source>prof:enable(xdmp:request())</prof:expr-source>
<prof:uri/>
<prof:line>1</prof:line>
<prof:count>1</prof:count>
<prof:shallow-time>PT0S</prof:shallow-time>
<prof:deep-time>PT0S</prof:deep-time>
</prof:expression>
</prof:histogram>
</prof:report>
|
|
|
|
prof:xslt-eval(
|
|
$stylesheet as element(),
|
|
$input as node()?,
|
|
[$params as map:map?],
|
|
[$options as node()?]
|
| ) as item()* |
|
 |
Summary:
Evaluate a string as an XSLT stylesheet 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:
$stylesheet
:
The stylesheet to be executed.
|
$input
:
The context node to which the stylesheet is applied.
|
$params
(optional):
The stylesheet parameter values for this evaluation.
Each key in the map is a string representing the name of the parameter
in Clark notation: "{namespaceURI}localname". Each entry in the map is
the value of the corresponding parameter.
|
$options
(optional):
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.
Additional options include:
<mode> - The initial stylesheet mode to use.
<template> - The name of the initial template
to apply.
|
|
Required Privilege:
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:xslt-invoke(
|
|
$path as xs:string,
|
|
$input as node()?,
|
|
[$params as map:map?],
|
|
[$options as node()?]
|
| ) as item()* |
|
 |
Summary:
Profiles and returns the result of evaluating an XSLT stylesheet 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.
|
Parameters:
$path
:
The path of the stylesheet to be executed. The path is resolved against
the root of the App Server evaluating the query, the Modules directory,
or relative to the calling module. For details on resolving paths,
see "Importing XQuery Modules and Resolving Paths" in the
Developer's Guide.
|
$input
:
The context node to which the stylesheet is applied.
|
$params
(optional):
The stylesheet parameter values for this evaluation.
Each key in the map is a string representing the name of the parameter
in Clark notation: "{namespaceURI}localname". Each entry in the map is
the value of the corresponding parameter.
|
$options
(optional):
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.
Additional options include:
<mode> - The initial stylesheet mode to use.
<template> - The name of the initial template
to apply.
|
|
Required Privilege:
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:
|
|
|