Search in sources :

Example 21 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testTraceSetNestedExperiment.

/**
 * Test the contents of a trace set with a nested experiment.
 */
@Test
public void testTraceSetNestedExperiment() {
    final ITmfTrace localTrace1 = trace1;
    final ITmfTrace localTrace2 = trace2;
    final ITmfTrace localTrace3 = trace3;
    assertNotNull(localTrace1);
    assertNotNull(localTrace2);
    assertNotNull(localTrace3);
    TmfExperiment nestedExp = createExperiment(localTrace2, localTrace3);
    TmfExperiment exp = createExperiment(localTrace1, nestedExp);
    Collection<ITmfTrace> expected = ImmutableSet.of(localTrace1, localTrace2, localTrace3);
    Collection<ITmfTrace> actual = TmfTraceManager.getTraceSet(exp);
    assertEquals(expected, actual);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) Test(org.junit.Test)

Example 22 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class CtfExperimentCheckpointIndexTest method setUpTraces.

private static void setUpTraces() {
    fTestTraces = new ITmfTrace[2];
    fTestTraces[0] = CtfTmfTestTraceUtils.getTrace(TEST_TRACE1);
    fTestTraces[1] = CtfTmfTestTraceUtils.getTrace(TEST_TRACE2);
    fExperiment = new TmfExperiment(ITmfEvent.class, EXPERIMENT, fTestTraces, BLOCK_SIZE, null) {

        @Override
        protected ITmfTraceIndexer createIndexer(int interval) {
            fIndexer = new TestIndexer(this, interval);
            return fIndexer;
        }
    };
    fExperiment.indexTrace(true);
}
Also used : ITmfTraceIndexer(org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfCheckpoint(org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint)

Example 23 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class CtfTmfExperimentTrimmingTest method setup.

/**
 * Test setup
 */
@Before
public void setup() {
    WaitUtils.waitForJobs();
    SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
    tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click();
    SWTBotUtils.activateEditor(fBot, "Experiment");
    SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME);
    SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment");
    experimentItem.select();
    TmfTraceManager traceManager = TmfTraceManager.getInstance();
    ITmfTrace trace = traceManager.getActiveTrace();
    assertTrue(String.valueOf(trace), trace instanceof TmfExperiment);
    TmfExperiment experiment = (TmfExperiment) trace;
    assertNotNull(experiment);
    ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true);
    assertTrue(elem instanceof TmfExperimentElement);
    fOriginalExperiment = experiment;
    TmfTimeRange traceCutRange = getTraceCutRange(experiment);
    assertNotNull(traceCutRange);
    fRequestedTraceCutRange = traceCutRange;
    ITmfTimestamp requestedTraceCutEnd = traceCutRange.getEndTime();
    ITmfTimestamp requestedTraceCutStart = traceCutRange.getStartTime();
    assertTrue(experiment.getTimeRange().contains(traceCutRange));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, requestedTraceCutStart, requestedTraceCutEnd, experiment));
    experimentItem.contextMenu("Export Time Selection as New Trace...").click();
    SWTBotShell shell = fBot.shell("Export trace section to...").activate();
    SWTBot dialogBot = shell.bot();
    assertEquals("Experiment", dialogBot.text().getText());
    dialogBot.text().setText("Experiment-trimmed");
    dialogBot.button("OK").click();
    SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed");
    newExperiment.setFocus();
    fNewExperiment = traceManager.getActiveTrace();
    assertNotNull("No active trace", fNewExperiment);
    assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName());
    WaitUtils.waitForJobs();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) ITmfProjectModelElement(org.eclipse.tracecompass.tmf.ui.project.model.ITmfProjectModelElement) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfExperimentElement(org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Before(org.junit.Before)

Example 24 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class AnalysisModuleHelperTest method testAppliesToExperiment.

/**
 * Test the analysis modules with a differing result for experiments
 */
@Test
public void testAppliesToExperiment() {
    ITmfTrace trace1 = TmfTestTrace.A_TEST_10K.getTrace();
    ITmfTrace trace2 = TmfTestTrace.A_TEST_10K2.getTrace();
    ITmfTrace trace3 = TmfTestTrace.A_TEST_10K2.getTraceAsStub2();
    /* Create an experiment with TmfTraceStub */
    ITmfTrace[] tracesExp1 = { trace1, trace2 };
    TmfExperiment exp1 = new TmfExperiment(tracesExp1[0].getEventType(), "Experiment 1", tracesExp1, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    /* Create an experiment containing some TmfTraceStub2 */
    ITmfTrace[] tracesExp2 = { trace1, trace3 };
    TmfExperiment exp2 = new TmfExperiment(tracesExp2[0].getEventType(), "Experiment 1", tracesExp2, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    try {
        /* fModule should return null for both experiments */
        IAnalysisModule module = null;
        try {
            module = fModule.newModule(exp1);
            assertNull(module);
        } catch (TmfAnalysisException e) {
            fail();
        } finally {
            if (module != null) {
                module.dispose();
            }
        }
        try {
            module = fModule.newModule(exp2);
            assertNull(module);
        } catch (TmfAnalysisException e) {
            fail();
        } finally {
            if (module != null) {
                module.dispose();
            }
        }
        /* fModuleOther should throw exception for exp1, but not exp2 */
        try {
            module = fModuleOther.newModule(exp1);
            assertNull(module);
        } catch (TmfAnalysisException e) {
            fail();
        } finally {
            if (module != null) {
                module.dispose();
            }
        }
        try {
            module = fModuleOther.newModule(exp2);
            assertNotNull(module);
        } catch (TmfAnalysisException e) {
            fail();
        } finally {
            if (module != null) {
                module.dispose();
            }
        }
    } finally {
        exp2.dispose();
        exp1.dispose();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) Test(org.junit.Test)

Example 25 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class Uml2SDTestFacility method disposeExperiment.

/**
 * Disposes the experiment.
 */
public void disposeExperiment() {
    TmfExperiment experiment = fExperiment;
    if (experiment == null) {
        throw new IllegalStateException();
    }
    experiment.broadcast(new TmfTraceClosedSignal(this, experiment));
    experiment.dispose();
    delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)

Aggregations

TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)55 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)33 Test (org.junit.Test)31 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)11 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)9 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)8 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)7 AnalysisManagerTest (org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest)7 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)7 Nullable (org.eclipse.jdt.annotation.Nullable)5 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)4 NonNull (org.eclipse.jdt.annotation.NonNull)3 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)3 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)3 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)3 ITmfTimestampTransform (org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform)3 SynchronizationAlgorithm (org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm)3 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)3 CtfTmfEvent (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent)3 Before (org.junit.Before)3