Class ScriptedAnalysis
java.lang.Object
org.eclipse.tracecompass.incubator.scripting.core.analysis.ScriptedAnalysis
Analysis class that can be used with the scripts. It provides an event
iterator, as well as backends to store data. Scripts can thus parse events
and fill the backend appropriately.
- Author:
- Geneviève Bastien
-
Method Summary
Modifier and TypeMethodDescriptionvoid
complete()
Make sure the analysis is complete and the state system, if any, is closed.Get an iterator to iterate chronologically through the events of the trace.getName()
Get the name of this analysis, not to be used by scripts@Nullable ITmfStateSystemBuilder
getStateSystem
(boolean useExisting) Get a state system to go with this analysis.getTrace()
Get the trace, not to be used by scripts.boolean
Get whether this analysis is complete, ie, if a state systemw as requested by thegetStateSystem(boolean)
method, then the state system has been closed.
-
Method Details
-
getStateSystem
public @Nullable ITmfStateSystemBuilder getStateSystem(@ScriptParameter(defaultValue="false") boolean useExisting) Get a state system to go with this analysis. If an analysis of the same name already exists, it can be re-used instead of re-created.- Parameters:
useExisting
- iftrue
, any state system with the same name for the trace will be reused, otherwise, a new state system will be created- Returns:
- A state system builder
-
getEventIterator
Get an iterator to iterate chronologically through the events of the trace. To reduce overhead of passing all events to/from the script when only a subset of events is requested, theScriptEventsIterator.addEvent(String)
method can be used to set the events to filter. Thus, to iterate through a trace in a scripted analysis, one can just do the following snippet (javascript)var iter = analysis.getEventIterator(); var event = null; while (iter.hasNext()) { event = iter.next(); // Do something with the event }
- Returns:
- The event iterator, starting from the first event
-
getTrace
Get the trace, not to be used by scripts.- Returns:
- The trace
-
getName
Get the name of this analysis, not to be used by scripts- Returns:
- The name of the analysis
-
complete
public void complete()Make sure the analysis is complete and the state system, if any, is closed. It will close the state system at the end time of the trace if is has not been closed previously. If no state system was requested through thegetStateSystem(boolean)
before hand, nothing will happen. -
isComplete
public boolean isComplete()Get whether this analysis is complete, ie, if a state systemw as requested by thegetStateSystem(boolean)
method, then the state system has been closed.- Returns:
- Whether the analysis is complete and the state system was closed
-