Search in sources :

Example 91 with ITmfEvent

use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.

the class BtfTraceTest method testRead10thEvent2.

/**
 * Read the tenth event without seeking
 */
@Test
public void testRead10thEvent2() {
    ITmfContext ctx = fixture.seekEvent(0);
    ITmfEvent event = fixture.getNext(ctx);
    for (int i = 0; i < EVENT_RANK_10; i++) {
        event = fixture.getNext(ctx);
    }
    assertNotNull(event);
    validateCommentEvent(ECXPECT_CONTENT_EVENT_10, event);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 92 with ITmfEvent

use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.

the class BtfTraceTest method testRead10thEvent1.

/**
 * Read the tenth event
 */
@Test
public void testRead10thEvent1() {
    ITmfContext ctx = fixture.seekEvent(EVENT_RANK_10);
    ITmfEvent event = fixture.getNext(ctx);
    assertNotNull(event);
    validateCommentEvent(ECXPECT_CONTENT_EVENT_10, event);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 93 with ITmfEvent

use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.

the class BtfTraceTest method testReadCommentLineEvent1.

/**
 * Read the event after comment line
 */
@Test
public void testReadCommentLineEvent1() {
    ITmfContext ctx = fixture.seekEvent(EVENT_RANK_COMMENT_TEST);
    ITmfEvent event = fixture.getNext(ctx);
    assertNotNull(event);
    validateCommentEvent(ECXPECT_CONTENT_COMMENT_EVENT, event);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 94 with ITmfEvent

use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.

the class BtfTraceTest method testTwoContexts.

/**
 * Read two contexts
 */
@Test
public void testTwoContexts() {
    ITmfContext ctx0 = fixture.seekEvent(0);
    ITmfContext ctx1 = fixture.seekEvent(10);
    ITmfEvent event = null;
    for (int i = 0; i < 11; i++) {
        event = fixture.getNext(ctx0);
    }
    ITmfEvent event1 = fixture.getNext(ctx1);
    assertNotNull(event);
    assertNotNull(event1);
    assertEquals(event, event1);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) Test(org.junit.Test)

Example 95 with ITmfEvent

use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.

the class StreamListAnalysis method executeAnalysis.

@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
    IProgressMonitor mon = (monitor == null ? new NullProgressMonitor() : monitor);
    ITmfTrace trace = getTrace();
    if (trace == null) {
        /* This analysis was cancelled in the meantime */
        return false;
    }
    ITmfEventRequest request = fRequest;
    if ((request != null) && (!request.isCompleted())) {
        request.cancel();
    }
    request = new TmfEventRequest(PcapEvent.class, TmfTimeRange.ETERNITY, 0L, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND) {

        @Override
        public void handleData(ITmfEvent data) {
            // Called for each event
            super.handleData(data);
            if (!(data instanceof PcapEvent)) {
                return;
            }
            PcapEvent event = (PcapEvent) data;
            for (Map.Entry<TmfPcapProtocol, TmfPacketStreamBuilder> entry : fBuilders.entrySet()) {
                entry.getValue().addEventToStream(event);
            }
        }
    };
    trace.sendRequest(request);
    fRequest = request;
    try {
        request.waitForCompletion();
    } catch (InterruptedException e) {
        // Request was canceled.
        return false;
    }
    return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Aggregations

ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)182 Test (org.junit.Test)127 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)112 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)40 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)30 AnalysisManagerTest (org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest)27 ITmfLocation (org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation)25 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)24 NonNull (org.eclipse.jdt.annotation.NonNull)20 TmfEvent (org.eclipse.tracecompass.tmf.core.event.TmfEvent)17 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 Vector (java.util.Vector)15 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)15 Predicate (java.util.function.Predicate)14 TmfTraceUtils (org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils)14 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)13 CtfTestTrace (org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace)13 CtfTmfTestTraceUtils (org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils)13 Assert.assertEquals (org.junit.Assert.assertEquals)13 Assert.assertNotNull (org.junit.Assert.assertNotNull)13