net.sf.saxon.trace

## Class TimingCodeInjector

- java.lang.Object
- - net.sf.saxon.trace.TraceCodeInjector
  - - net.sf.saxon.trace.TimingCodeInjector

- All Implemented Interfaces:
    CodeInjector

      public class TimingCodeInjector
      extends TraceCodeInjector

  A code injector that wraps the body of a template or function in a TraceExpression, which causes the TimingTraceListener to be notified at the start and end of the function/template evaluation

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimingCodeInjector()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `inject(Expression exp, StaticContext env, int construct, StructuredQName qName)` If tracing, wrap an expression in a trace instruction
    `Clause` | `injectClause(Clause target, StaticContext env, Container container)` If tracing, add a clause to a FLWOR expression that can be used to monitor requests for tuples to be processed

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimingCodeInjector

          public TimingCodeInjector()

  - ### Method Detail

    - #### inject

          public Expression inject(Expression exp,
                          StaticContext env,
                          int construct,
                          StructuredQName qName)

      If tracing, wrap an expression in a trace instruction
      Specified by:
        `inject` in interface `CodeInjector`
      Overrides:
        `inject` in class `TraceCodeInjector`
      Parameters:
        `exp` - the expression to be wrapped
        `env` - the static context
        `construct` - integer constant identifying the kind of construct
        `qName` - the name of the construct (if applicable)
      Returns:
        the expression that does the tracing

    - #### injectClause

          public Clause injectClause(Clause target,
                            StaticContext env,
                            Container container)

      Description copied from class: `TraceCodeInjector`
      If tracing, add a clause to a FLWOR expression that can be used to monitor requests for tuples to be processed
      Specified by:
        `injectClause` in interface `CodeInjector`
      Overrides:
        `injectClause` in class `TraceCodeInjector`
      Parameters:
        `target` - the clause whose evaluation is to be traced (or otherwise monitored)
        `env` - the static context of the containing FLWOR expression
        `container` - the container of the containing FLWOR Expression
      Returns:
        the new clause to do the tracing; or null if no tracing is required at this point

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.