Search in sources :

Example 21 with IAnalysisModule

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

the class TmfStateSystemExplorer method handleAnalysisStarted.

/**
 * Rebuild the view's entry tree to ensure that entries from a newly started
 * trace are added.
 *
 * @param signal
 *            analysis started signal.
 * @since 3.3
 */
@TmfSignalHandler
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) {
    IAnalysisModule module = signal.getAnalysisModule();
    if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) {
        /*
             * use set to wait for initialization in build entry list to avoid
             * deadlocks.
             */
        final ITmfTrace viewTrace = getTrace();
        if (Iterables.contains(allModules(viewTrace), module)) {
            /*
                 * Rebuild only if the started analysis module is from the
                 * active trace/experiment.
                 */
            new Thread(() -> {
                /*
                     *  DataProviderManager#getDataProvider() (see getDataProvider() below) should never be called in a signal handler.
                     */
                synchronized (fStartedAnalysis) {
                    fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
                    // Every children of ITmfAnalysisModuleWithStateSystems extends TmfAbstractAnalysisModule
                    ITmfTrace moduleTrace = module instanceof TmfAbstractAnalysisModule ? ((TmfAbstractAnalysisModule) module).getTrace() : viewTrace;
                    if (moduleTrace != null) {
                        getDataProvider(moduleTrace).startedAnalysisSignalHandler((ITmfAnalysisModuleWithStateSystems) module);
                        rebuild();
                    }
                }
            }).start();
        } else {
            /*
                 * Reset the View for the relevant trace, ensuring that the
                 * entry list will be rebuilt when the view switches back.
                 */
            for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) {
                if (Iterables.contains(allModules(trace), module)) {
                    synchronized (fStartedAnalysis) {
                        fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
                        resetView(trace);
                    }
                    break;
                }
            }
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfAbstractAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 22 with IAnalysisModule

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

the class KernelPidAspectTest method setUp.

/**
 * Test setup
 */
@Before
public void setUp() {
    ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
    deleteSuppFiles(trace);
    /* Make sure the Kernel analysis has run */
    ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    IAnalysisModule module = null;
    for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
        module = mod;
    }
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, TidAnalysisModule.class)) {
        module = mod;
    }
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    fTrace = trace;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) Before(org.junit.Before)

Example 23 with IAnalysisModule

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

the class KernelThreadInformationProviderTest method setUp.

/**
 * Setup the trace for the tests
 */
@Before
public void setUp() {
    ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
    deleteSuppFiles(trace);
    ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    IAnalysisModule module = null;
    for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
        module = mod;
    }
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
    fTrace = trace;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) Before(org.junit.Before)

Example 24 with IAnalysisModule

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

the class KernelTidAspectTest method setUp.

/**
 * Test setup
 */
@Before
public void setUp() {
    ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
    deleteSuppFiles(trace);
    /* Make sure the Kernel analysis has run */
    ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
    IAnalysisModule module = null;
    for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, TidAnalysisModule.class)) {
        module = mod;
    }
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    fTrace = trace;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) Before(org.junit.Before)

Example 25 with IAnalysisModule

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

the class KernelMemoryStateProviderTest method testAnalysisExecution.

/**
 * Test that the analysis executes without problems
 */
@Test
public void testAnalysisExecution() {
    /* Make sure the analysis hasn't run yet */
    assertNull(fModule.getStateSystem());
    /* Make sure dependent analysis is executed for so that it ready for KernelMemoryAnalysisModule */
    ITmfTrace trace = fTrace;
    assertNotNull(trace);
    IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TidAnalysisModule.class, TidAnalysisModule.ID);
    assertNotNull(module);
    module.schedule();
    module.waitForCompletion();
    /* Execute the analysis */
    assertTrue(TmfTestHelper.executeAnalysis(fModule));
    assertNotNull(fModule.getStateSystem());
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) Test(org.junit.Test)

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