use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.
the class PatternProvidersTest method testSegmentStore.
/**
* Test the generated segment store
*/
@Test
public void testSegmentStore() {
TmfAbstractAnalysisModule module = getModule();
if (module instanceof ITmfAnalysisModuleWithStateSystems) {
// In this test, the module will be XmlPatternAnalysis which is an instance of ITmfAnalysisModuleWithStateSystems
assertTrue(((ITmfAnalysisModuleWithStateSystems) module).waitForInitialization());
}
assertTrue(module.waitForCompletion());
ISegmentStore<@NonNull ISegment> ss = ((ISegmentStoreProvider) module).getSegmentStore();
assertNotNull(ss);
assertFalse(ss.isEmpty());
}
use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.
the class XmlProviderTestBase method testStateSystem.
/**
* Test the building of the state system
*/
@Test
public void testStateSystem() {
assertTrue(fModule instanceof ITmfAnalysisModuleWithStateSystems);
assertTrue(((ITmfAnalysisModuleWithStateSystems) fModule).waitForInitialization());
assertTrue(fModule.waitForCompletion(new NullProgressMonitor()));
ITmfStateSystem ss = ((ITmfAnalysisModuleWithStateSystems) fModule).getStateSystem(fModule.getId());
assertNotNull(ss);
List<Integer> quarks = ss.getQuarks("*");
assertFalse(quarks.isEmpty());
}
use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.
the class XmlTimeGraphDataProvider method create.
/**
* {@link XmlTimeGraphDataProvider} create method
*
* @param trace
* the trace for which the provider will return data
* @param viewElement
* the XML view {@link Element}.
* @return the relevant {@link XmlTimeGraphDataProvider}
*/
public static XmlTimeGraphDataProvider create(@NonNull ITmfTrace trace, Element viewElement) {
Set<@NonNull String> analysisIds = TmfXmlUtils.getViewAnalysisIds(viewElement);
List<Element> entries = TmfXmlUtils.getChildElements(viewElement, TmfXmlStrings.ENTRY_ELEMENT);
Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>();
if (analysisIds.isEmpty()) {
/*
* No analysis specified, take all state system analysis modules
*/
Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class));
} else {
for (String moduleId : analysisIds) {
// Get the module for the current trace only. The caller will take care of
// generating composite providers with experiments
IAnalysisModule module = trace.getAnalysisModule(moduleId);
if (module instanceof ITmfAnalysisModuleWithStateSystems) {
stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module);
}
}
}
List<ITmfStateSystem> sss = new ArrayList<>();
for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) {
if (module.schedule().isOK() && module.waitForInitialization()) {
module.getStateSystems().forEach(sss::add);
}
}
return (sss.isEmpty() ? null : new XmlTimeGraphDataProvider(trace, sss, entries));
}
use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.
the class XmlXYDataProvider method create.
/**
* Create an instance of {@link XmlXYDataProvider}. Returns null if statesystem
* is null.
*
* @param trace
* A trace on which we are interested to fetch a model
* @param analysisIds
* A list of analysis ids used for retrieving Analysis objects
* @param entryElement
* An XML entry element
* @return A XmlDataProvider
*/
@Nullable
public static XmlXYDataProvider create(ITmfTrace trace, Set<String> analysisIds, Element entryElement) {
ITmfAnalysisModuleWithStateSystems ss = getStateSystemFromAnalyses(analysisIds, trace);
if (ss == null) {
return null;
}
AnalysisCompilationData compilationData = new AnalysisCompilationData();
/*
* Initialize state attributes. There should be only one entry element for XY
* charts.
*/
String path = entryElement.hasAttribute(TmfXmlStrings.PATH) ? entryElement.getAttribute(TmfXmlStrings.PATH) : TmfXmlStrings.WILDCARD;
XmlXYEntry entry = new XmlXYEntry(ss, path, entryElement, compilationData);
/* Get the display element to use */
List<@NonNull Element> displayElements = TmfXmlUtils.getChildElements(entryElement, TmfXmlStrings.DISPLAY_ELEMENT);
if (displayElements.isEmpty()) {
return null;
}
Element displayElement = displayElements.get(0);
TmfXmlStateSystemPathCu display = TmfXmlStateSystemPathCu.compile(entry.getAnalysisCompilationData(), Collections.singletonList(displayElement));
if (display == null) {
return null;
}
/* Get the series name element to use */
List<Element> seriesNameElements = TmfXmlUtils.getChildElements(entryElement, TmfXmlStrings.NAME_ELEMENT);
DataDrivenStateSystemPath seriesName = null;
if (!seriesNameElements.isEmpty()) {
Element seriesNameElement = seriesNameElements.get(0);
TmfXmlStateSystemPathCu seriesNameCu = TmfXmlStateSystemPathCu.compile(entry.getAnalysisCompilationData(), Collections.singletonList(seriesNameElement));
if (seriesNameCu != null) {
seriesName = seriesNameCu.generate();
}
}
return new XmlXYDataProvider(trace, entry, display.generate(), seriesName);
}
use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems in project tracecompass by tracecompass.
the class DataDrivenXYProviderFactory method create.
/**
* Create an XY data provider for a trace
*
* @param trace
* The trace for which to create the data provider
* @return The XY data provider or <code>null</code> if no such provider is
* available for that trace
*/
@Nullable
public ITmfTreeXYDataProvider<ITmfTreeDataModel> create(ITmfTrace trace) {
Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>();
List<ITmfStateSystem> sss = new ArrayList<>();
if (fAnalysisIds.isEmpty()) {
/*
* No analysis specified, take all state system analysis modules
*/
Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class));
} else {
for (String moduleId : fAnalysisIds) {
// Get the module for the current trace only. The caller will
// take care of
// generating composite providers with experiments
IAnalysisModule module = trace.getAnalysisModule(moduleId);
if (module instanceof ITmfAnalysisModuleWithStateSystems) {
stateSystemModules.add((ITmfAnalysisModuleWithStateSystems) module);
}
}
}
for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) {
if (module.schedule().isOK() && module.waitForInitialization()) {
module.getStateSystems().forEach(sss::add);
}
}
return (sss.isEmpty() ? null : create(trace, sss, fEntries, null));
}
Aggregations