## org.exist.xquery
Class Profiler

    java.lang.Object
      org.exist.xquery.Profiler

public class Profiler
extends java.lang.Object

XQuery profiling output. Profiling information is written to a logger. The profiler can be enabled/disabled and configured via an XQuery pragma or "declare option" expression. Example:

    declare option exist:profiling "enabled=yes verbosity=10 logger=profiler";

Author:
  wolf

Field Summary
`static int` `DEPENDENCIES` Indicates the dependencies of the expression
`static int` `ITEM_COUNT` Just returns the number of items in the sequence
`static int` `OPTIMIZATION_FLAGS` For computations that will trigger further optimizations
`static int` `OPTIMIZATIONS` value for Verbosity property: For optimizations
`static int` `SEQUENCE_DUMP` For a full representation of the context sequence (TODO)
`static int` `SEQUENCE_PREVIEW` For a truncated string representation of the context sequence (TODO)
`static int` `START_SEQUENCES` An abstract level for viewing the expression's context sequence/item
`static int` `TIME` value for Verbosity property: basic profiling : just elapsed time

Constructor Summary
`Profiler()`

Method Summary
`void` `configure(Option pragma)` Configure the profiler from an XQuery pragma.
`void` `end(Expression expr, java.lang.String message, Sequence result)` Called by an expression to indicate the end of an operation.
`boolean` `isEnabled()` Is profiling enabled?
`void` `message(Expression expr, int level, java.lang.String title, Sequence sequence)` Print out a single profiling message for the given expression object.
`void` `message(Expression expr, int level, java.lang.String title, java.lang.String message)`
`void` `reset()`
`void` `setEnabled(boolean enabled)`
`void` `setVerbosity(int verbosity)`
`void` `start(Expression expr)` Called by an expression to indicate the start of an operation.
`void` `start(Expression expr, java.lang.String message)` Called by an expression to indicate the start of an operation.
`int` `verbosity()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TIME

    public static int TIME

  value for Verbosity property: basic profiling : just elapsed time

### OPTIMIZATIONS

    public static int OPTIMIZATIONS

  value for Verbosity property: For optimizations

### OPTIMIZATION_FLAGS

    public static int OPTIMIZATION_FLAGS

  For computations that will trigger further optimizations

### DEPENDENCIES

    public static int DEPENDENCIES

  Indicates the dependencies of the expression

### START_SEQUENCES

    public static int START_SEQUENCES

  An abstract level for viewing the expression's context sequence/item

### ITEM_COUNT

    public static int ITEM_COUNT

  Just returns the number of items in the sequence

### SEQUENCE_PREVIEW

    public static int SEQUENCE_PREVIEW

  For a truncated string representation of the context sequence (TODO)

### SEQUENCE_DUMP

    public static int SEQUENCE_DUMP

  For a full representation of the context sequence (TODO)

Constructor Detail

### Profiler

    public Profiler()

Method Detail

### configure

    public final void configure(Option pragma)

  Configure the profiler from an XQuery pragma. Parameters are:
  - enabled: yes|no.
  - logger: name of the logger to use.
  - verbosity: integer value > 0. 1 does only output function calls.

  Parameters:
    `pragma` -

### isEnabled

    public final boolean isEnabled()

  Is profiling enabled?

  Returns:
    True if profiling is enabled

### verbosity

    public final int verbosity()

  Returns:
    the verbosity of the profiler.

### start

    public final void start(Expression expr)

  Called by an expression to indicate the start of an operation. The profiler registers the start time.

  Parameters:
    `expr` - the expression.

### start

    public final void start(Expression expr,
                            java.lang.String message)

  Called by an expression to indicate the start of an operation. The profiler registers the start time.

  Parameters:
    `expr` - the expression.
    `message` - if not null, contains an optional message to print in the log.

### end

    public final void end(Expression expr,
                          java.lang.String message,
                          Sequence result)

  Called by an expression to indicate the end of an operation. The profiler computes the elapsed time.

  Parameters:
    `expr` - the expression.
    `message` - required: a message to be printed to the log.

### message

    public final void message(Expression expr,
                              int level,
                              java.lang.String title,
                              Sequence sequence)

  Print out a single profiling message for the given expression object.

  Parameters:
    `level` -
    `title` -
    `sequence` -
    `expr` -

### message

    public final void message(Expression expr,
                              int level,
                              java.lang.String title,
                              java.lang.String message)

### reset

    public void reset()

### setEnabled

    public void setEnabled(boolean enabled)

### setVerbosity

    public void setVerbosity(int verbosity)

Copyright (C) Wolfgang Meier. All rights reserved.