Search in sources :

Example 11 with ITmfTrace

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

the class DistributedCriticalPathTest method testNetworkExchangeWithWifi.

/**
 * Test the graph building of a network exchange where one machine receives
 * in a softirq and the other receives in a threaded IRQ, with new network
 * reception events. The 2 traces include events to wrap IRQ and packet
 * reception contexts
 *
 * @throws TmfTraceException
 *             Exception thrown by opening experiment
 * @throws TmfAnalysisException
 *             Exception thrown by analyses
 */
@Test
public void testNetworkExchangeWithWifi() throws TmfTraceException, TmfAnalysisException {
    ITmfTrace experiment = setUpExperiment("testfiles/graph/network_exchange_eth.xml", "testfiles/graph/network_exchange_wifi.xml");
    assertNotNull(experiment);
    try {
        internalTestNetworkExchangeWithWifi(experiment);
    } finally {
        experiment.dispose();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) Test(org.junit.Test)

Example 12 with ITmfTrace

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

the class LttngExecutionGraphTest method testSchedEvents.

/**
 * Test the graph building with sched events only
 *
 * TODO: Add wakeup events to this test case
 */
@Test
public void testSchedEvents() {
    ITmfTrace trace = setUpTrace("testfiles/graph/sched_only.xml");
    assertNotNull(trace);
    TmfGraphBuilderModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfGraphBuilderModule.class, TEST_ANALYSIS_ID);
    assertNotNull(module);
    module.schedule();
    assertTrue(module.waitForCompletion());
    TmfGraph graph = module.getGraph();
    assertNotNull(graph);
    Set<IGraphWorker> workers = graph.getWorkers();
    assertEquals(2, workers.size());
    for (IGraphWorker worker : workers) {
        assertTrue(worker instanceof OsWorker);
        OsWorker lttngWorker = (OsWorker) worker;
        switch(lttngWorker.getHostThread().getTid()) {
            case 1:
                {
                    List<TmfVertex> nodesOf = graph.getNodesOf(lttngWorker);
                    assertEquals(4, nodesOf.size());
                    /* Check first vertice has outgoing edge preempted */
                    TmfVertex v = nodesOf.get(0);
                    assertEquals(10, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    TmfEdge edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.PREEMPTED, edge.getType());
                    v = nodesOf.get(1);
                    assertEquals(v, edge.getVertexTo());
                    /* Check second vertice has outgoing edge running */
                    assertEquals(20, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.RUNNING, edge.getType());
                    v = nodesOf.get(2);
                    assertEquals(v, edge.getVertexTo());
                    /* Check third vertice has outgoing edge preempted */
                    assertEquals(30, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.PREEMPTED, edge.getType());
                    v = nodesOf.get(3);
                    assertEquals(v, edge.getVertexTo());
                    /* Check 4th vertice */
                    assertEquals(40, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE));
                }
                break;
            case 2:
                {
                    List<TmfVertex> nodesOf = graph.getNodesOf(lttngWorker);
                    assertEquals(4, nodesOf.size());
                    /* Check first vertice has outgoing edge preempted */
                    TmfVertex v = nodesOf.get(0);
                    assertEquals(10, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    TmfEdge edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.RUNNING, edge.getType());
                    v = nodesOf.get(1);
                    assertEquals(v, edge.getVertexTo());
                    /* Check second vertice has outgoing edge running */
                    assertEquals(20, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.BLOCKED, edge.getType());
                    v = nodesOf.get(2);
                    assertEquals(v, edge.getVertexTo());
                    /* Check third vertice has outgoing edge preempted */
                    assertEquals(30, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
                    assertNotNull(edge);
                    assertEquals(EdgeType.RUNNING, edge.getType());
                    v = nodesOf.get(3);
                    assertEquals(v, edge.getVertexTo());
                    /* Check 4th vertice */
                    assertEquals(40, v.getTs());
                    assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
                    assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
                    assertNull(v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE));
                }
                break;
            default:
                fail("Unknown worker");
                break;
        }
    }
    trace.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) TmfEdge(org.eclipse.tracecompass.analysis.graph.core.base.TmfEdge) TmfVertex(org.eclipse.tracecompass.analysis.graph.core.base.TmfVertex) TmfGraph(org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph) TmfGraphBuilderModule(org.eclipse.tracecompass.analysis.graph.core.building.TmfGraphBuilderModule) IGraphWorker(org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker) List(java.util.List) Test(org.junit.Test)

Example 13 with ITmfTrace

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

the class ExperimentSyncTest method testDjangoExperimentSync.

/**
 * Testing synchronization with 3 traces, one of which synchronizes with
 * both other
 */
@Test
public void testDjangoExperimentSync() {
    CtfTmfTrace trace1 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_CLIENT);
    CtfTmfTrace trace2 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_DB);
    CtfTmfTrace trace3 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_HTTPD);
    ITmfTrace[] traces = { trace1, trace2, trace3 };
    TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
    SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
    ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
    ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
    ITmfTimestampTransform tt3 = syncAlgo.getTimestampTransform(trace3);
    trace1.setTimestampTransform(tt1);
    trace2.setTimestampTransform(tt2);
    trace3.setTimestampTransform(tt3);
    assertEquals(TimestampTransformFactory.getDefaultTransform(), tt1);
    assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999996313017589597204633828681240, offset = 498490309972.0038068817738527724192 ]", tt2.toString());
    assertEquals("TmfTimestampTransformLinearFast [ slope = 1.000000119014882262265342419815932, offset = -166652893534.6189900382736187431134 ]", tt3.toString());
    experiment.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfTimestampTransform(org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace) SynchronizationAlgorithm(org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm) Test(org.junit.Test)

Example 14 with ITmfTrace

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

the class UstKernelSyncTest method setup.

/**
 * Test setup
 */
@Before
public void setup() {
    ITmfTrace ustTrace = CtfTmfTestTraceUtils.getTrace(UST_TRACE);
    ITmfTrace kernelTrace = LttngKernelTestTraceUtils.getTrace(KERNEL_TRACE);
    TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "test-exp", new ITmfTrace[] { ustTrace, kernelTrace }, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    /* Simulate experiment being opened */
    TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, experiment, null));
    TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, experiment));
    KernelAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(experiment, KernelAnalysisModule.class, KernelAnalysisModule.ID);
    assertNotNull(module);
    module.waitForCompletion();
    fExperiment = experiment;
    fUstTrace = ustTrace;
    fKernelModule = module;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) Before(org.junit.Before)

Example 15 with ITmfTrace

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

the class UstKernelSyncTest method testWholeUstTrace.

/**
 * Test going through the whole UST trace, making sure the VTID context of
 * each event corresponds to the TID given by the kernel analysis at the
 * same timestamp.
 */
@Test
public void testWholeUstTrace() {
    TmfExperiment experiment = fExperiment;
    ITmfTrace ustTrace = fUstTrace;
    KernelAnalysisModule module = fKernelModule;
    assertNotNull(experiment);
    assertNotNull(ustTrace);
    assertNotNull(module);
    ITmfContext context = ustTrace.seekEvent(0L);
    CtfTmfEvent ustEvent = (CtfTmfEvent) ustTrace.getNext(context);
    int count = 0;
    while (ustEvent != null) {
        Long ustVtid = ustEvent.getContent().getFieldValue(Long.class, "context._vtid");
        /* All events in the trace should have that context */
        assertNotNull(ustVtid);
        long ts = ustEvent.getTimestamp().toNanos();
        long cpu = ustEvent.getCPU();
        Integer kernelTid = KernelThreadInformationProvider.getThreadOnCpu(module, cpu, ts);
        assertNotNull(kernelTid);
        assertEquals("Wrong TID for trace event " + ustEvent.toString(), ustVtid.longValue(), kernelTid.longValue());
        ustEvent = (CtfTmfEvent) ustTrace.getNext(context);
        count++;
    }
    /* Make sure we've read all expected events */
    assertEquals(UST_TRACE.getNbEvents(), count);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) CtfTmfEvent(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule) Test(org.junit.Test)

Aggregations

ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)352 Test (org.junit.Test)120 NonNull (org.eclipse.jdt.annotation.NonNull)47 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)45 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)33 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)27 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)27 Nullable (org.eclipse.jdt.annotation.Nullable)25 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)25 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)23 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)22 File (java.io.File)21 BeforeClass (org.junit.BeforeClass)21 ArrayList (java.util.ArrayList)20 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)19 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)17 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)15 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)15 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)15