Search in sources :

Example 71 with IAnalysisModule

use of org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule in project tracecompass by tracecompass.

the class DataDrivenTimeGraphProviderFactory method create.

/**
 * Create a data provider for a trace
 *
 * @param trace
 *            The trace for which to create a provider
 * @return A time graph data provider, or <code>null</code> if the data
 *         provider cannot be built for this trace because it does not have
 *         the proper analyses.
 */
@Nullable
public ITimeGraphDataProvider<TimeGraphEntryModel> 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, fValues, null));
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) ArrayList(java.util.ArrayList) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) HashSet(java.util.HashSet) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)71 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)28 Test (org.junit.Test)18 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)17 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)15 ArrayList (java.util.ArrayList)12 ISegmentStoreProvider (org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider)11 HashSet (java.util.HashSet)10 Nullable (org.eclipse.jdt.annotation.Nullable)9 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)8 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)7 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)7 TestAnalysis (org.eclipse.tracecompass.tmf.tests.stubs.analysis.TestAnalysis)7 File (java.io.File)6 IStatus (org.eclipse.core.runtime.IStatus)6 ISegment (org.eclipse.tracecompass.segmentstore.core.ISegment)6 Before (org.junit.Before)6 IPath (org.eclipse.core.runtime.IPath)5 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)5 HashMap (java.util.HashMap)4