Class DataProviderScriptingModule
java.lang.Object
org.eclipse.tracecompass.incubator.scripting.core.data.provider.DataProviderScriptingModule
Scripting module to create data providers from scripted analyzes. Data
providers are used to define what and how data will be exported, either as
views or other means of exportation.
Example scripts with data providers can be found here:
- A scripted time graph data provider with script-defined entries and arrows
- A basic analysis building an state system and showing its data in a time graph
- A script that uses the "Statistics" analysis module of Trace Compass to display an XY chart showing the density of certain events in the trace.
- Author:
- Geneviève Bastien
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key for whether or not to display a value as a differential with previous value or use its absolute value.static final String
Display key to create data providersstatic final String
Parent ID key to create entriesstatic final String
Quark key to create entriesstatic final String
Id key to create data providersstatic final String
Name key to create data providersstatic final String
Parent key to create data providersstatic final String
Path key to create data providers -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable ITimeGraphArrow
createArrow
(long sourceId, long destinationId, long time, long duration, int value) Create an arrow for a time graph data provider.@Nullable ITmfTreeDataModel
createEntry
(String name, Map<String, Object> data) Create a time graph entry.createScriptedTimeGraphProvider
(ScriptedAnalysis analysis, Function<Map<String, Object>, @Nullable List<ITimeGraphEntryModel>> entryMethod, @Nullable Function<Map<String, Object>, @Nullable List<ITimeGraphRowModel>> rowModelMethod, @Nullable Function<Map<String, Object>, @Nullable List<ITimeGraphArrow>> arrowMethod) Create a data provider from scripted functions.@Nullable ITimeGraphDataProvider<TimeGraphEntryModel>
createTimeGraphProvider
(ScriptedAnalysis analysis, Map<String, Object> data, String dpName) Create a data driven time graph provider from a scripted analysis's state system.@Nullable ITimeGraphDataProvider<TimeGraphEntryModel>
createTimeGraphProvider
(IAnalysisModule analysis, Map<String, Object> data, String dpName) Create a data driven time graph provider from one of the built-in analysis's state system.@Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel>
createXYProvider
(ScriptedAnalysis analysis, Map<String, Object> data, String dpName) Create a data driven xy data provider from a scripted analysis.@Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel>
createXYProvider
(IAnalysisModule analysis, Map<String, Object> data, String dpName) Create a data driven xy data provider from one of the built-in analyses.
-
Field Details
-
ENTRY_PATH
Path key to create data providers- See Also:
-
ENTRY_DISPLAY
Display key to create data providers- See Also:
-
ENTRY_NAME
Name key to create data providers- See Also:
-
ENTRY_PARENT
Parent key to create data providers- See Also:
-
ENTRY_ID
Id key to create data providers- See Also:
-
ENTRY_DELTA
Key for whether or not to display a value as a differential with previous value or use its absolute value.- See Also:
-
ENTRY_FIELD_QUARK
Quark key to create entries- See Also:
-
ENTRY_FIELD_PARENT_ID
Parent ID key to create entries- See Also:
-
-
Constructor Details
-
DataProviderScriptingModule
public DataProviderScriptingModule()
-
-
Method Details
-
createTimeGraphProvider
public @Nullable ITimeGraphDataProvider<TimeGraphEntryModel> createTimeGraphProvider(IAnalysisModule analysis, Map<String, Object> data, @ScriptParameter(defaultValue="") String dpName) Create a data driven time graph provider from one of the built-in analysis's state system. This will use the specified data to get the entries and row data from the state system. When the data cannot be obtained in a straight-forward manner from the state system, thecreateScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function)
method can be used instead.The possible keys for the data are:
ENTRY_PATH
: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'ENTRY_DISPLAY
: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be usedENTRY_NAME
: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.ENTRY_ID
: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using theENTRY_PARENT
.ENTRY_PARENT
: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with theENTRY_ID
to create a hierarchy between the entries.
- Parameters:
analysis
- The analysis for which to create a time graph providerdata
- The time graph provider datadpName
- The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title- Returns:
- The time graph data provider
-
createTimeGraphProvider
public @Nullable ITimeGraphDataProvider<TimeGraphEntryModel> createTimeGraphProvider(ScriptedAnalysis analysis, Map<String, Object> data, @ScriptParameter(defaultValue="") String dpName) Create a data driven time graph provider from a scripted analysis's state system. This will use the specified data to get the entries and row data from the state system. When the data cannot be obtained in a straight-forward manner from the state system, thecreateScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function)
method can be used instead.The possible keys for the data are:
ENTRY_PATH
: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'ENTRY_DISPLAY
: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be usedENTRY_NAME
: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.ENTRY_ID
: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using theENTRY_PARENT
.ENTRY_PARENT
: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with theENTRY_ID
to create a hierarchy between the entries.
- Parameters:
analysis
- The analysis for which to create a time graph providerdata
- The time graph provider datadpName
- The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title- Returns:
- The time graph data provider
-
createXYProvider
public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> createXYProvider(IAnalysisModule analysis, Map<String, Object> data, @ScriptParameter(defaultValue="") String dpName) Create a data driven xy data provider from one of the built-in analyses. This will use the specified data to get the entries from the state system.ENTRY_PATH
: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'ENTRY_DISPLAY
: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be usedENTRY_NAME
: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.ENTRY_ID
: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using theENTRY_PARENT
.ENTRY_PARENT
: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with theENTRY_ID
to create a hierarchy between the entries.ENTRY_DELTA
: Specify the entry type. If it’s true, it will display the delta value of the entry otherwise it will show the absolute value of the entry.- Parameters:
analysis
- The analysis for which to create a time graph providerdata
- The XY chart datadpName
- The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title- Returns:
- The XY data provider
-
createXYProvider
public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> createXYProvider(ScriptedAnalysis analysis, Map<String, Object> data, @ScriptParameter(defaultValue="") String dpName) Create a data driven xy data provider from a scripted analysis. This will use the specified data to get the entries from the state system.ENTRY_PATH
: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'ENTRY_DISPLAY
: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be usedENTRY_NAME
: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.ENTRY_ID
: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using theENTRY_PARENT
.ENTRY_PARENT
: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with theENTRY_ID
to create a hierarchy between the entries.ENTRY_DELTA
: Specify the entry type. If it’s true, it will display the delta value of the entry otherwise it will show the absolute value of the entry.- Parameters:
analysis
- The scripted analysis for which to create a time graph providerdata
- The XY chart optionsdpName
- The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title- Returns:
- The XY data provider
-
createEntry
Create a time graph entry. This method will typically be used by scripts to create entries for data provider generated by thecreateScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function)
method.- Parameters:
name
- The name (label) of the entrydata
- A map of fields to create the entry. Possible fields areENTRY_FIELD_QUARK
(quark in the state system to use for the data. If not specified, it is expected the data provider will provide a method to retrieve the data), andENTRY_FIELD_PARENT_ID
for the ID of the parent entry- Returns:
- A new entry model
-
createArrow
public @Nullable ITimeGraphArrow createArrow(long sourceId, long destinationId, long time, long duration, int value) Create an arrow for a time graph data provider. This method will typically be used by scripts to create entries for data provider generated by thecreateScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function)
method.- Parameters:
sourceId
- the ID of the source entry of the arrowdestinationId
- The ID of the destination entry of the arrowtime
- The start time of the arrowduration
- The duration of the arrowvalue
- The value to associate with this arrow- Returns:
- The new arrow
-
createScriptedTimeGraphProvider
public ITimeGraphDataProvider<ITimeGraphEntryModel> createScriptedTimeGraphProvider(ScriptedAnalysis analysis, Function<Map<String, Object>, @Nullable List<ITimeGraphEntryModel>> entryMethod, @Nullable Function<Map<String, Object>, @Nullable List<ITimeGraphRowModel>> rowModelMethod, @Nullable Function<Map<String, Object>, @Nullable List<ITimeGraphArrow>> arrowMethod) Create a data provider from scripted functions. The script itself is responsible for generating the entries, optionally row data and arrows. For a simple state system, thecreateTimeGraphProvider(ScriptedAnalysis, Map, String)
may be used instead- Parameters:
analysis
- The analysis this data provider is forentryMethod
- The function this data provider will use to get the entries. This parameter is mandatory.rowModelMethod
- The function this data provider will use to get the row data for time ranges. If none is specified, the entries are expected to have a quark indicating which row in the state system to use for the data.arrowMethod
- The function this data provider will use to get the arrow data for time ranges. If none is specified, no arrows will be drawn.- Returns:
- A time graph data provider
-