Package org.apache.uima.util
Interface ProcessTrace
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ProcessTrace_impl
A
ProcessTrace
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
Modifier and TypeMethodDescriptionvoid
addAll
(List<ProcessTraceEvent> aEventList) Adds a list of completed event objects to thisProcessTrace
.void
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
Records the end of an event.Get a specified event.Gets a list ofProcessTraceEvent
s, in the order in which they were created.getEventsByComponentName
(String aComponentName, boolean aRecurseWithinMatch) Gets all events that have the given Component name.getEventsByType
(String aType, boolean aRecurseWithinMatch) Gets all events that have the given typevoid
startEvent
(String aComponentName, String aEventType, String aDescription) Records the start of an event.toString()
Generates a user-readable representation of all events in thisProcessTrace
.
-
Method Details
-
startEvent
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
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(String aResourceName, String aType, String aDescription, int aDuration, 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
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
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
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
List<ProcessTraceEvent> getEventsByComponentName(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
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
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
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
String toString()Generates a user-readable representation of all events in thisProcessTrace
.
-