org.e2etrace.trace
Interface ITraceStep

All Known Implementing Classes:
AbstractTraceStep, DefaultTraceStep, TraceSessionRootStep

public interface ITraceStep

Every monitored step in a service call is represented by a trace step.

A trace step at minimum consists of a unique id, that identifies the monitored step within the trace session and the duration (in ms) of the executed step. An example for such an id is the fully qualified class name plus the name of the executed method.

Additionally, most trace steps have a parent and one to several children.

Author:
Gunther Popp

Method Summary
 void addChild(ITraceStep child)
          Adds a new child to this trace step.
 void enter()
          Enter the trace step and start time measuring.
 ITraceStep[] getChildren()
          Returns the list of children for this trace steps.
 long getDuration()
          Returns the duration of this TraceStep and all children.
 ITraceStepId getId()
          Return the id of the trace step.
 long getIsolatedDuration()
          Returns the isolated duration of this TraceStep.
 ITraceStep getParent()
          Returns the parent of a TraceStep, if any exists.
 boolean isActive()
          Checks, if the current trace step is active.
 void leave()
          Leave the trace step and calculate the elapsed time since enter has been called.
 void setParent(ITraceStep parent)
          Set the parent of a TraceStep.
 

Method Detail

getId

ITraceStepId getId()
Return the id of the trace step.

Returns:
trace step id

enter

void enter()
Enter the trace step and start time measuring.

This method should only be called once for a trace step. All subsequent calls will be ignored.


leave

void leave()
Leave the trace step and calculate the elapsed time since enter has been called. The elapsed time is returned by getDuration().

Leaving a step implies that all children are left, too.

This method should only be called once for a trace step. All subsequent calls will be ignored.


isActive

boolean isActive()
Checks, if the current trace step is active.

A step is active between the calls to enter and leave.

Returns:
true: The trace step is active.

getIsolatedDuration

long getIsolatedDuration()
Returns the isolated duration of this TraceStep.

The duration is the time elapsed between the calls to enter and leave minus the durations of all children.

Returns:
duration of this TraceStep in ms (-1: no valid duration exists for this trace step)

getDuration

long getDuration()
Returns the duration of this TraceStep and all children.

This value reflects the overall execution time of a trace step between the calls to enter and leave inclusive the durations of all children.

Returns:
accumulated duration in ms

addChild

void addChild(ITraceStep child)
Adds a new child to this trace step.

The implementation must make sure that the child receives a references to this trace step. This reference must be returned by getParent().

Parameters:
child - trace step to add as child

getChildren

ITraceStep[] getChildren()
Returns the list of children for this trace steps.

Returns:
Array containing the children

getParent

ITraceStep getParent()
Returns the parent of a TraceStep, if any exists.

Returns:
Parent trace step

setParent

void setParent(ITraceStep parent)
Set the parent of a TraceStep.

This method is invoked when a new child is added using addChild(). It should never be called manually.

Parameters:
parent - new parent of the child.


Copyright © 2013 Gunther Popp. All Rights Reserved.