Search in sources :

Example 21 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfCoalescedEventRequestTest method trigger.

@TmfSignalHandler
public void trigger(final TmfTestTriggerSignal signal) {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    final long REQUEST_OFFSET = 1000;
    requestedEvents1 = new Vector<>();
    request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents1.add(event);
                if (signal.forceCancel) {
                    cancel();
                }
            }
        }
    };
    requestedEvents2 = new Vector<>();
    request2 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents2.add(event);
            }
        }
    };
    requestedEvents3 = new Vector<>();
    request3 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents3.add(event);
            }
        }
    };
    providers = TmfProviderManager.getProviders(ITmfEvent.class, TmfTraceStub.class);
    providers[0].sendRequest(request1);
    providers[0].sendRequest(request2);
    providers[0].sendRequest(request3);
}
Also used : ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 22 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfEventRequestTest method testTmfEventRequestWithDependencyLevel.

@Test
public void testTmfEventRequestWithDependencyLevel() {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
    TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range, 100, 200, ExecutionType.FOREGROUND, 1);
    assertEquals("getDataType", ITmfEvent.class, request.getDataType());
    assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
    assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
    assertEquals("getIndex", 0, request.getIndex());
    assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
    assertFalse("isCompleted", request.isCompleted());
    assertFalse("isFailed", request.isFailed());
    assertFalse("isCancelled", request.isCancelled());
    assertEquals("getNbRead", 0, request.getNbRead());
    assertEquals("getDependencyLevel", 1, request.getDependencyLevel());
}
Also used : TmfEventRequestStub(org.eclipse.tracecompass.tmf.tests.stubs.request.TmfEventRequestStub) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) Test(org.junit.Test)

Example 23 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfEventRequestTest method testTmfEventRequestTimeRangeNbRequestedBlocksize.

@Test
public void testTmfEventRequestTimeRangeNbRequestedBlocksize() {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
    TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range, 100, 200);
    assertEquals("getDataType", ITmfEvent.class, request.getDataType());
    assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
    assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
    assertEquals("getIndex", 0, request.getIndex());
    assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
    assertFalse("isCompleted", request.isCompleted());
    assertFalse("isFailed", request.isFailed());
    assertFalse("isCancelled", request.isCancelled());
    assertEquals("getNbRead", 0, request.getNbRead());
    assertEquals("getDependencyLevel", 0, request.getDependencyLevel());
}
Also used : TmfEventRequestStub(org.eclipse.tracecompass.tmf.tests.stubs.request.TmfEventRequestStub) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) Test(org.junit.Test)

Example 24 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfEventRequestTest method testTmfEventRequestTimeRange.

@Test
public void testTmfEventRequestTimeRange() {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
    TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range);
    assertEquals("getDataType", ITmfEvent.class, request.getDataType());
    assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
    assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
    assertEquals("getIndex", 0, request.getIndex());
    assertEquals("getNbRequestedEvents", ITmfEventRequest.ALL_DATA, request.getNbRequested());
    assertFalse("isCompleted", request.isCompleted());
    assertFalse("isFailed", request.isFailed());
    assertFalse("isCancelled", request.isCancelled());
    assertEquals("getNbRead", 0, request.getNbRead());
    assertEquals("getDependencyLevel", 0, request.getDependencyLevel());
}
Also used : TmfEventRequestStub(org.eclipse.tracecompass.tmf.tests.stubs.request.TmfEventRequestStub) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) Test(org.junit.Test)

Example 25 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfExperimentTest method testProcessRequestForAllEvents.

@Test
public void testProcessRequestForAllEvents() throws InterruptedException {
    final int nbEvents = ITmfEventRequest.ALL_DATA;
    final Vector<ITmfEvent> requestedEvents = new Vector<>();
    final long nbExpectedEvents = NB_EVENTS;
    final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, 0, nbEvents, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(final ITmfEvent event) {
            super.handleData(event);
            requestedEvents.add(event);
        }
    };
    fExperiment.sendRequest(request);
    request.waitForCompletion();
    assertEquals("nbEvents", nbExpectedEvents, requestedEvents.size());
    assertTrue("isCompleted", request.isCompleted());
    assertFalse("isCancelled", request.isCancelled());
    // Don't go overboard: we are not validating the stub!
    for (int i = 0; i < nbExpectedEvents; i++) {
        assertEquals("Distinct events", i + 1, requestedEvents.get(i).getTimestamp().getValue());
    }
}
Also used : ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Vector(java.util.Vector) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Aggregations

TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)168 Test (org.junit.Test)98 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)53 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)24 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)24 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)21 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)19 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)16 Vector (java.util.Vector)13 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)12 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)10 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)9 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)9 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)8 Point (org.eclipse.swt.graphics.Point)7