Search in sources :

Example 1 with ITmfLocation

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

the class TmfExperimentTest method testGetNextLocation.

@Test
public void testGetNextLocation() {
    ITmfContext context1 = fExperiment.seekEvent(0);
    fExperiment.getNext(context1);
    ITmfLocation location = context1.getLocation();
    ITmfEvent event1 = fExperiment.getNext(context1);
    ITmfContext context2 = fExperiment.seekEvent(location);
    ITmfEvent event2 = fExperiment.getNext(context2);
    assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfLocation(org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Example 2 with ITmfLocation

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

the class TmfExperimentTest method testGetNextAfterSeekingOnLocation_1.

@Test
public void testGetNextAfterSeekingOnLocation_1() {
    final ITmfLocation INITIAL_LOC = null;
    final long INITIAL_TS = 1;
    final int NB_READS = 20;
    // On lower bound, returns the first event (ts = 1)
    final ITmfContext context = fExperiment.seekEvent(INITIAL_LOC);
    validateContextRanks(context);
    // Read NB_EVENTS
    ITmfEvent event;
    for (int i = 0; i < NB_READS; i++) {
        event = fExperiment.getNext(context);
        assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
        assertEquals("Event rank", INITIAL_TS + i, context.getRank());
    }
    // Make sure we stay positioned
    event = fExperiment.parseEvent(context);
    assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
    assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
    validateContextRanks(context);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfLocation(org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Example 3 with ITmfLocation

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

the class TmfExperimentTest method testGetNextAfterSeekingOnLocation_2.

@Test
public void testGetNextAfterSeekingOnLocation_2() {
    final ITmfLocation INITIAL_LOC = fExperiment.seekEvent(1L).getLocation();
    final long INITIAL_TS = 2;
    final int NB_READS = 20;
    // On lower bound, returns the first event (ts = 2)
    final ITmfContext context = fExperiment.seekEvent(INITIAL_LOC);
    validateContextRanks(context);
    // Read NB_EVENTS
    ITmfEvent event;
    for (int i = 0; i < NB_READS; i++) {
        event = fExperiment.getNext(context);
        assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
    }
    // Make sure we stay positioned
    event = fExperiment.parseEvent(context);
    assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
    validateContextRanks(context);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfLocation(org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Example 4 with ITmfLocation

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

the class TmfExperimentTest method testGetNextAfterSeekingOnLocation_3.

@Test
public void testGetNextAfterSeekingOnLocation_3() {
    final ITmfLocation INITIAL_LOC = fExperiment.seekEvent(500L).getLocation();
    final long INITIAL_TS = 501;
    final int NB_READS = 20;
    // On lower bound, returns the first event (ts = 501)
    final ITmfContext context = fExperiment.seekEvent(INITIAL_LOC);
    validateContextRanks(context);
    // Read NB_EVENTS
    ITmfEvent event;
    for (int i = 0; i < NB_READS; i++) {
        event = fExperiment.getNext(context);
        assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
    }
    // Make sure we stay positioned
    event = fExperiment.parseEvent(context);
    assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
    validateContextRanks(context);
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfLocation(org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Example 5 with ITmfLocation

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

the class TmfMultiTraceExperimentTest method testGetNextLocation.

@Test
public void testGetNextLocation() {
    ITmfContext context1 = fExperiment.seekEvent(0);
    fExperiment.getNext(context1);
    ITmfLocation location = context1.getLocation();
    ITmfEvent event1 = fExperiment.getNext(context1);
    ITmfContext context2 = fExperiment.seekEvent(location);
    ITmfEvent event2 = fExperiment.getNext(context2);
    assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfLocation(org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation) Test(org.junit.Test)

Aggregations

ITmfLocation (org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation)43 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)25 Test (org.junit.Test)20 IOException (java.io.IOException)15 TmfLongLocation (org.eclipse.tracecompass.tmf.core.trace.location.TmfLongLocation)13 TmfContext (org.eclipse.tracecompass.tmf.core.trace.TmfContext)7 AnalysisManagerTest (org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest)5 ITmfCheckpoint (org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint)5 TmfExperimentLocation (org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentLocation)4 TmfLocationArray (org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfLocationArray)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)4 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)3 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)3 TmfCheckpoint (org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpoint)3 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)3 Before (org.junit.Before)3 Matcher (java.util.regex.Matcher)2 NonNull (org.eclipse.jdt.annotation.NonNull)2 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2