Package org.apache.uima.util
Interface ProcessTrace
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
ProcessTrace_impl
public interface ProcessTrace extends java.io.Serializable
AProcessTrace
object keeps a record of events that have occurred and information, such as timing, about those events.Each event is represented by a
ProcessTraceEvent
object. Events may have sub-events, so a ProcessTrace is really a forest of events, which provides a useful description of where time is spent during a process involving several components.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAll(java.util.List<ProcessTraceEvent> aEventList)
Adds a list of completed event objects to thisProcessTrace
.void
addEvent(java.lang.String aResourceName, java.lang.String aType, java.lang.String aDescription, int aDuration, java.lang.String aResultMsg)
Adds an event with the specified parameters to thisProcessTrace
.void
addEvent(ProcessTraceEvent aEvent)
Adds a completed event object to thisProcessTrace
.void
aggregate(ProcessTrace aProcessTrace)
Aggregates the information in anotherProcessTrace
with this one.void
clear()
Resets thisProcessTrace
by removing all events.void
endEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aResultMessage)
Records the end of an event.ProcessTraceEvent
getEvent(java.lang.String aComponentName, java.lang.String aType)
Get a specified event.java.util.List<ProcessTraceEvent>
getEvents()
Gets a list ofProcessTraceEvent
s, in the order in which they were created.java.util.List<ProcessTraceEvent>
getEventsByComponentName(java.lang.String aComponentName, boolean aRecurseWithinMatch)
Gets all events that have the given Component name.java.util.List<ProcessTraceEvent>
getEventsByType(java.lang.String aType, boolean aRecurseWithinMatch)
Gets all events that have the given typevoid
startEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aDescription)
Records the start of an event.java.lang.String
toString()
Generates a user-readable representation of all events in thisProcessTrace
.
-
-
-
Method Detail
-
startEvent
void startEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aDescription)
Records the start of an event. The event will be ended when there is a corresponding call toendEvent(String,String,String)
with the same component name and event type. The duration of the event will be automatically computed from the difference in time between the start and end.- Parameters:
aComponentName
- name of the component generating the eventaEventType
- type of the event. Standard types are defined as constants on theProcessTraceEvent
interface, but any string may be used.aDescription
- description of the event
-
endEvent
void endEvent(java.lang.String aComponentName, java.lang.String aEventType, java.lang.String aResultMessage)
Records the end of an event. The event is identified by the component name and type. If there is no open event that matches those values, aUIMA_IllegalStateException
will be thrown.- Parameters:
aComponentName
- name of the component generating the eventaEventType
- type of the event. Standard types are defined as constants on theProcessTraceEvent
interface, but any string may be used.aResultMessage
- describes the result of the event- Throws:
UIMA_IllegalStateException
- if there is no open event matching theaComponentName
andaEventType
arguments.
-
addEvent
void addEvent(java.lang.String aResourceName, java.lang.String aType, java.lang.String aDescription, int aDuration, java.lang.String aResultMsg)
Adds an event with the specified parameters to thisProcessTrace
.- Parameters:
aResourceName
- name of the component generating the eventaType
- type of the event. Standard types are defined as constants on theProcessTraceEvent
interface, but any string may be used.aDescription
- description of the eventaDuration
- duration of the event in millisecondsaResultMsg
- result message of event
-
addEvent
void addEvent(ProcessTraceEvent aEvent)
Adds a completed event object to thisProcessTrace
. This method is useful for copying events from one ProcessTrace into another.- Parameters:
aEvent
- the event object to be added to thisProcessTrace
-
addAll
void addAll(java.util.List<ProcessTraceEvent> aEventList)
Adds a list of completed event objects to thisProcessTrace
. This method is useful for copying events from one ProcessTrace into another.- Parameters:
aEventList
- a List of event object to be added to thisProcessTrace
-
getEvents
java.util.List<ProcessTraceEvent> getEvents()
Gets a list ofProcessTraceEvent
s, in the order in which they were created. This is generally chronological order.- Returns:
- an unmodifiable List of
ProcessTraceEvent
s
-
getEventsByComponentName
java.util.List<ProcessTraceEvent> getEventsByComponentName(java.lang.String aComponentName, boolean aRecurseWithinMatch)
Gets all events that have the given Component name.- Parameters:
aComponentName
- the component name to look foraRecurseWithinMatch
- if true, all events with the given component name will be returned. If false, this method will not recurse into the sub-events of a matching event.- Returns:
- a List of ProcessTraceEvents having the given component name
-
getEventsByType
java.util.List<ProcessTraceEvent> getEventsByType(java.lang.String aType, boolean aRecurseWithinMatch)
Gets all events that have the given type- Parameters:
aType
- the type of event to look foraRecurseWithinMatch
- if true, all events with the given component name will be returned. If false, this method will not recurse into the sub-events of a matching event.- Returns:
- a List of ProcessTraceEvents having the given type
-
getEvent
ProcessTraceEvent getEvent(java.lang.String aComponentName, java.lang.String aType)
Get a specified event.- Parameters:
aComponentName
- name of component producing desired eventaType
- type of desired event- Returns:
- the first ProcessTraceEvent matching the parameters,
null
if there is no such event.
-
clear
void clear()
Resets thisProcessTrace
by removing all events.
-
aggregate
void aggregate(ProcessTrace aProcessTrace)
Aggregates the information in anotherProcessTrace
with this one. Events that exist in both ProcessTraces will have their durations added together. This method is useful for collecting aggregate performance statistics for collection processing.- Parameters:
aProcessTrace
- the Process Trace object whose information will be combined with the information in this object
-
toString
java.lang.String toString()
Generates a user-readable representation of all events in thisProcessTrace
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the String representation of all events in this
ProcessTrace
.
-
-