Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java293
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java294
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java211
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java9
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java58
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java1
7 files changed, 780 insertions, 89 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
index 30f1277572..9968c89651 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
@@ -160,12 +161,14 @@ public class TmfExperimentTest extends TestCase {
// ------------------------------------------------------------------------
public void testGetTimestamp() throws Exception {
- assertTrue("getTimestamp", fExperiment.getTimestamp( 0).equals(new TmfTimestamp( 1, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 10).equals(new TmfTimestamp( 11, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 100).equals(new TmfTimestamp( 101, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 1000).equals(new TmfTimestamp(1001, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 2000).equals(new TmfTimestamp(2001, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 2500).equals(new TmfTimestamp(2501, (byte) -3)));
+ assertEquals("getTimestamp", new TmfTimestamp( 1, (byte) -3), fExperiment.getTimestamp( 0));
+ assertEquals("getTimestamp", new TmfTimestamp( 2, (byte) -3), fExperiment.getTimestamp( 1));
+ assertEquals("getTimestamp", new TmfTimestamp( 11, (byte) -3), fExperiment.getTimestamp( 10));
+ assertEquals("getTimestamp", new TmfTimestamp( 101, (byte) -3), fExperiment.getTimestamp( 100));
+ assertEquals("getTimestamp", new TmfTimestamp( 1001, (byte) -3), fExperiment.getTimestamp(1000));
+ assertEquals("getTimestamp", new TmfTimestamp( 2001, (byte) -3), fExperiment.getTimestamp(2000));
+ assertEquals("getTimestamp", new TmfTimestamp( 2501, (byte) -3), fExperiment.getTimestamp(2500));
+ assertEquals("getTimestamp", new TmfTimestamp(10000, (byte) -3), fExperiment.getTimestamp(9999));
assertNull("getTimestamp", fExperiment.getTimestamp(10000));
}
@@ -264,7 +267,7 @@ public class TmfExperimentTest extends TestCase {
assertEquals("getLocationRatio", ratio, ratio2);
}
-// @SuppressWarnings({ "unchecked", "rawtypes" })
+// @SuppressWarnings("rawtypes")
// public void testGetCurrentLocation() throws Exception {
// ITmfContext context = fExperiment.seekEvent((ITmfLocation) null);
// ITmfLocation location = fExperiment.getCurrentLocation();
@@ -538,22 +541,280 @@ public class TmfExperimentTest extends TestCase {
}
// ------------------------------------------------------------------------
- // readtNextEvent - updates the context
+ // getNext - updates the context
// ------------------------------------------------------------------------
- public void testReadNextEvent() throws Exception {
+ private void validateContextRanks(ITmfContext context) {
+ assertTrue("Experiment context type", context instanceof TmfExperimentContext);
+ TmfExperimentContext ctx = (TmfExperimentContext) context;
- // On lower bound, returns the first event (ts = 0)
- final ITmfContext context = fExperiment.seekEvent(0);
- ITmfEvent event = fExperiment.getNext(context);
- assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
+ int nbTraces = ctx.getContexts().length;
+
+ // expRank = sum(trace ranks) - nbTraces + 1 (if lastTraceRead != NO_TRACE)
+ long expRank = -nbTraces + ((ctx.getLastTrace() != TmfExperimentContext.NO_TRACE) ? 1 : 0);
+ for (int i = 0; i < nbTraces; i++) {
+ long rank = ctx.getContexts()[i].getRank();
+ if (rank == -1) {
+ expRank = -1;
+ break;
+ }
+ expRank += rank;
+ }
+ assertEquals("Experiment context rank", expRank, ctx.getRank());
+ }
+
+ public void testGetNextAfteSeekingOnTS_1() throws Exception {
- for (int i = 2; i < 20; i++) {
+ final long INITIAL_TS = 1;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 1)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
event = fExperiment.getNext(context);
- assertEquals("Event timestamp", i, event.getTimestamp().getValue());
+ 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);
}
+ public void testGetNextAfteSeekingOnTS_2() throws Exception {
+
+ final long INITIAL_TS = 2;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 2)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ 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);
+ }
+
+ public void testGetNextAfteSeekingOnTS_3() throws Exception {
+
+ final long INITIAL_TS = 500;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 500)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnRank_1() throws Exception {
+
+ final long INITIAL_RANK = 0L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fExperiment.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnRank_2() throws Exception {
+
+ final long INITIAL_RANK = 1L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fExperiment.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnRank_3() throws Exception {
+
+ final long INITIAL_RANK = 500L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fExperiment.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextLocation() throws Exception {
+ ITmfContext context1 = fExperiment.seekEvent(0);
+ fExperiment.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfEvent event1 = fExperiment.getNext(context1);
+ ITmfContext context2 = fExperiment.seekEvent(location);
+ ITmfEvent event2 = fExperiment.getNext(context2);
+ assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
+ }
+
+ public void testGetNextEndLocation() throws Exception {
+ ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
+ fExperiment.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfContext context2 = fExperiment.seekEvent(location);
+ ITmfEvent event = fExperiment.getNext(context2);
+ assertNull("Event", event);
+ }
+
// ------------------------------------------------------------------------
// processRequest
// ------------------------------------------------------------------------
@@ -679,4 +940,4 @@ public class TmfExperimentTest extends TestCase {
assertTrue("isCancelled", request.isCancelled());
}
-} \ No newline at end of file
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
index 9c1d646a8b..6b4c46e24a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
@@ -387,20 +388,278 @@ public class TmfMultiTraceExperimentTest extends TestCase {
}
// ------------------------------------------------------------------------
- // readtNextEvent - updates the context
+ // getNext - updates the context
// ------------------------------------------------------------------------
- public void testReadNextEvent() throws Exception {
+ private void validateContextRanks(ITmfContext context) {
+ assertTrue("Experiment context type", context instanceof TmfExperimentContext);
+ TmfExperimentContext ctx = (TmfExperimentContext) context;
- // On lower bound, returns the first event (ts = 0)
- final ITmfContext context = fExperiment.seekEvent(0);
- ITmfEvent event = fExperiment.getNext(context);
- assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
+ int nbTraces = ctx.getContexts().length;
+
+ // expRank = sum(trace ranks) - nbTraces + 1 (if lastTraceRead != NO_TRACE)
+ long expRank = -nbTraces + ((ctx.getLastTrace() != TmfExperimentContext.NO_TRACE) ? 1 : 0);
+ for (int i = 0; i < nbTraces; i++) {
+ long rank = ctx.getContexts()[i].getRank();
+ if (rank == -1) {
+ expRank = -1;
+ break;
+ }
+ expRank += rank;
+ }
+ assertEquals("Experiment context rank", expRank, ctx.getRank());
+ }
+
+ public void testGetNextAfteSeekingOnTS_1() throws Exception {
+
+ final long INITIAL_TS = 1;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 1)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ 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);
+ }
+
+ public void testGetNextAfteSeekingOnTS_2() throws Exception {
+
+ final long INITIAL_TS = 2;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 2)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ 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);
+ }
+
+ public void testGetNextAfteSeekingOnTS_3() throws Exception {
+
+ final long INITIAL_TS = 500;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 500)
+ final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnRank_1() throws Exception {
+
+ final long INITIAL_RANK = 0L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fExperiment.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnRank_2() throws Exception {
+
+ final long INITIAL_RANK = 1L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
- for (int i = 2; i < 20; i++) {
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
event = fExperiment.getNext(context);
- assertEquals("Event timestamp", i, event.getTimestamp().getValue());
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
}
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnRank_3() throws Exception {
+
+ final long INITIAL_RANK = 500L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fExperiment.seekEvent(INITIAL_RANK);
+
+ validateContextRanks(context);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fExperiment.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fExperiment.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+
+ validateContextRanks(context);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+
+ 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);
+ }
+
+ public void testGetNextLocation() throws Exception {
+ ITmfContext context1 = fExperiment.seekEvent(0);
+ fExperiment.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfEvent event1 = fExperiment.getNext(context1);
+ ITmfContext context2 = fExperiment.seekEvent(location);
+ ITmfEvent event2 = fExperiment.getNext(context2);
+ assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
+ }
+
+ public void testGetNextEndLocation() throws Exception {
+ ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
+ fExperiment.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfContext context2 = fExperiment.seekEvent(location);
+ ITmfEvent event = fExperiment.getNext(context2);
+ assertNull("Event", event);
}
// ------------------------------------------------------------------------
@@ -533,13 +792,16 @@ public class TmfMultiTraceExperimentTest extends TestCase {
// ------------------------------------------------------------------------
public void testGetTimestamp() throws Exception {
-
- assertTrue("getTimestamp", fExperiment.getTimestamp( 0).equals(new TmfTimestamp( 1, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 10).equals(new TmfTimestamp( 11, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp( 100).equals(new TmfTimestamp( 101, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp(1000).equals(new TmfTimestamp(1001, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp(2000).equals(new TmfTimestamp(2001, (byte) -3)));
- assertTrue("getTimestamp", fExperiment.getTimestamp(2500).equals(new TmfTimestamp(2501, (byte) -3)));
+ assertEquals("getTimestamp", new TmfTimestamp( 1, (byte) -3), fExperiment.getTimestamp( 0));
+ assertEquals("getTimestamp", new TmfTimestamp( 2, (byte) -3), fExperiment.getTimestamp( 1));
+ assertEquals("getTimestamp", new TmfTimestamp( 11, (byte) -3), fExperiment.getTimestamp( 10));
+ assertEquals("getTimestamp", new TmfTimestamp( 101, (byte) -3), fExperiment.getTimestamp( 100));
+ assertEquals("getTimestamp", new TmfTimestamp( 1001, (byte) -3), fExperiment.getTimestamp( 1000));
+ assertEquals("getTimestamp", new TmfTimestamp( 2001, (byte) -3), fExperiment.getTimestamp( 2000));
+ assertEquals("getTimestamp", new TmfTimestamp( 2501, (byte) -3), fExperiment.getTimestamp( 2500));
+ assertEquals("getTimestamp", new TmfTimestamp(10000, (byte) -3), fExperiment.getTimestamp( 9999));
+ assertEquals("getTimestamp", new TmfTimestamp(20000, (byte) -3), fExperiment.getTimestamp(19999));
+ assertNull("getTimestamp", fExperiment.getTimestamp(20000));
}
-} \ No newline at end of file
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
index 70c039dd93..a0bab9788d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
@@ -35,6 +35,7 @@ import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
@@ -246,6 +247,7 @@ public class TmfTraceTest extends TestCase {
assertEquals("getEndTime", NB_EVENTS, trace.getEndTime().getValue());
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public void testCopyConstructor() throws Exception {
TmfTraceStub original = null;
TmfTraceStub trace = null;
@@ -963,28 +965,223 @@ public class TmfTraceTest extends TestCase {
}
// ------------------------------------------------------------------------
- // readNextEvent - updates the context
+ // getNext - updates the context
// ------------------------------------------------------------------------
- public void testReadNextEvent() throws Exception {
+ public void testGetNextAfteSeekingOnTS_1() throws Exception {
+ final long INITIAL_TS = 1;
final int NB_READS = 20;
// On lower bound, returns the first event (ts = 1)
- final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(0, SCALE, 0));
+ final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
// Read NB_EVENTS
ITmfEvent event;
for (int i = 0; i < NB_READS; i++) {
event = fTrace.getNext(context);
- assertEquals("Event timestamp", i + 1, event.getTimestamp().getValue());
- assertEquals("Event rank", i + 1, context.getRank());
+ assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_TS + i, context.getRank());
}
// Make sure we stay positioned
event = fTrace.parseEvent(context);
- assertEquals("Event timestamp", NB_READS + 1, event.getTimestamp().getValue());
- assertEquals("Event rank", NB_READS, context.getRank());
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+ }
+
+ public void testGetNextAfteSeekingOnTS_2() throws Exception {
+
+ final long INITIAL_TS = 2;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 500)
+ final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.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 = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+ }
+
+ public void testGetNextAfteSeekingOnTS_3() throws Exception {
+
+ final long INITIAL_TS = 500;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 500)
+ final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE, 0));
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.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 = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+ }
+
+ public void testGetNextAfterSeekingOnRank_1() throws Exception {
+
+ final long INITIAL_RANK = 0L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ public void testGetNextAfterSeekingOnRank_2() throws Exception {
+
+ final long INITIAL_RANK = 1L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ public void testGetNextAfterSeekingOnRank_3() throws Exception {
+
+ final long INITIAL_RANK = 500L;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (rank = 0)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_RANK);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_RANK + i + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + i + 1, context.getRank());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_RANK + NB_READS + 1, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_RANK + NB_READS, context.getRank());
+ }
+
+ public void testGetNextAfterSeekingOnLocation_1() throws Exception {
+
+ 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 = fTrace.seekEvent(INITIAL_LOC);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.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 = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ assertEquals("Event rank", INITIAL_TS + NB_READS - 1, context.getRank());
+ }
+
+ public void testGetNextAfterSeekingOnLocation_2() throws Exception {
+
+ final ITmfLocation<?> INITIAL_LOC = fTrace.seekEvent(1L).getLocation();
+ final long INITIAL_TS = 2;
+ final int NB_READS = 20;
+
+ // On lower bound, returns the first event (ts = 501)
+ final ITmfContext context = fTrace.seekEvent(INITIAL_LOC);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ }
+
+ public void testGetNextAfterSeekingOnLocation_3() throws Exception {
+
+ final ITmfLocation<?> INITIAL_LOC = fTrace.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 = fTrace.seekEvent(INITIAL_LOC);
+
+ // Read NB_EVENTS
+ ITmfEvent event;
+ for (int i = 0; i < NB_READS; i++) {
+ event = fTrace.getNext(context);
+ assertEquals("Event timestamp", INITIAL_TS + i, event.getTimestamp().getValue());
+ }
+
+ // Make sure we stay positioned
+ event = fTrace.parseEvent(context);
+ assertEquals("Event timestamp", INITIAL_TS + NB_READS, event.getTimestamp().getValue());
+ }
+
+ public void testGetNextLocation() throws Exception {
+ ITmfContext context1 = fTrace.seekEvent(0);
+ fTrace.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfEvent event1 = fTrace.getNext(context1);
+ ITmfContext context2 = fTrace.seekEvent(location);
+ ITmfEvent event2 = fTrace.getNext(context2);
+ assertEquals("Event timestamp", event1.getTimestamp().getValue(), event2.getTimestamp().getValue());
+ }
+
+ public void testGetNextEndLocation() throws Exception {
+ ITmfContext context1 = fTrace.seekEvent(fTrace.getNbEvents() - 1);
+ fTrace.getNext(context1);
+ ITmfLocation<?> location = context1.getLocation().clone();
+ ITmfContext context2 = fTrace.seekEvent(location);
+ ITmfEvent event = fTrace.getNext(context2);
+ assertNull("Event", event);
}
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
index 7f987d9ed1..21047497a5 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
@@ -247,7 +247,7 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
final long position = rank / fCheckpointInterval;
// Add new entry at proper location (if empty)
if (fTraceIndex.size() == position) {
- fTraceIndex.add(new TmfCheckpoint(timestamp.clone(), shrinkContext(context)));
+ fTraceIndex.add(new TmfCheckpoint(timestamp.clone(), saveContext(context)));
}
}
}
@@ -336,15 +336,15 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
// Context conversion functions
// ------------------------------------------------------------------------
- private static ITmfContext shrinkContext(ITmfContext context) {
+ private static ITmfContext saveContext(ITmfContext context) {
if (context instanceof TmfExperimentContext) {
- return shrinkExpContext(context);
+ return saveExpContext(context);
}
TmfContext ctx = new TmfContext(context.getLocation().clone(), context.getRank());
return ctx;
}
- private static ITmfContext shrinkExpContext(ITmfContext context) {
+ private static ITmfContext saveExpContext(ITmfContext context) {
TmfExperimentContext expContext = (TmfExperimentContext) context;
int size = expContext.getContexts().length;
ITmfContext[] trcCtxts = new TmfContext[size];
@@ -392,4 +392,5 @@ public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITm
}
return ctx;
}
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
index 7d62f4334f..07ac017010 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
@@ -150,18 +150,18 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
// ------------------------------------------------------------------------
/* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
+ * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
*/
@Override
- public boolean validate(final IProject project, final String path) {
- return true;
+ public void initTrace(final IResource resource, final String path, final Class<T> type) {
}
/* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
*/
@Override
- public void initTrace(final IResource resource, final String path, final Class<T> type) {
+ public boolean validate(final IProject project, final String path) {
+ return true;
}
// ------------------------------------------------------------------------
@@ -265,37 +265,6 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
// ------------------------------------------------------------------------
/* (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#seekEvent(long)
- *
- * TmfTrace.seekEvent(rank) will return a context that will position the
- * trace to read the event at rank 'rank' in the trace. In the case of an
- * experiment context, that event has to be actually read in the fEvents
- * buffer and the corresponding trace context has to point to the next
- * event (rank + 1) in the trace (the sum of the traces contexts ranks
- * should equal [exp context rank + #traces] (corner cases not considered).
- *
- * In the likely case that TmfTrace.seekEvent() computed the context
- * by using a read loop (reading from the experiment), the 'lastTraceRead'
- * field will be set to the actual trace that needs to be read to obtain
- * event at rank 'rank'.
- *
- * Therefore, if 'lastTraceRead' is set, we need to read that particular
- * trace *and* then decrease the context rank (which has to correspond to
- * the rank of the event to be returned next by TmfExperiemnt.getNext().
- */
- @Override
- public synchronized ITmfContext seekEvent(final long rank) {
- TmfExperimentContext context = (TmfExperimentContext) super.seekEvent(rank);
- int lastTrace = context.getLastTrace();
- if (lastTrace != TmfExperimentContext.NO_TRACE) {
- getNext(context);
- context.setRank(rank);
- context.setLastTrace(TmfExperimentContext.NO_TRACE);
- }
- return context;
- }
-
- /* (non-Javadoc)
*
* Returns a brand new context based on the location provided and
* initializes the event queues
@@ -332,7 +301,7 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
// Finalize context
context.setLocation(expLocation);
context.setLastTrace(TmfExperimentContext.NO_TRACE);
- context.setRank(ITmfContext.UNKNOWN_RANK);
+ context.setRank((location == null) ? 0 : ITmfContext.UNKNOWN_RANK);
fExperimentContext = context;
return context;
@@ -411,12 +380,6 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
final int lastTrace = expContext.getLastTrace();
if (lastTrace != TmfExperimentContext.NO_TRACE) {
final ITmfContext traceContext = expContext.getContexts()[lastTrace];
-
- TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
- if (location != null) {
- location.getLocation().getLocations()[lastTrace] = traceContext.getLocation().clone();
- }
-
expContext.getEvents()[lastTrace] = fTraces[lastTrace].getNext(traceContext);
expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
}
@@ -442,7 +405,14 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
updateAttributes(expContext, event.getTimestamp());
expContext.increaseRank();
expContext.setLastTrace(trace);
- fExperimentContext = expContext;
+ final ITmfContext traceContext = expContext.getContexts()[trace];
+
+ TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
+ if (location != null) {
+ location.getLocation().getLocations()[trace] = traceContext.getLocation().clone();
+ }
+
+ fExperimentContext = expContext.clone();
processEvent(event);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
index f1a4804562..7699fe4372 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
@@ -482,7 +482,6 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
final ITmfContext nextEventContext = context.clone(); // Must use clone() to get the right subtype...
ITmfEvent event = getNext(nextEventContext);
while (event != null && event.getTimestamp().compareTo(timestamp, false) < 0) {
-// getNext(context);
context = nextEventContext.clone();
event = getNext(nextEventContext);
}
@@ -492,7 +491,7 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T>
}
return context;
}
-
+
// ------------------------------------------------------------------------
// ITmfTrace - Read operations (returning an actual event)
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java
index 8d9e618660..beb33a348b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java
@@ -540,6 +540,7 @@ public class Utils {
* expects.
* @return The mangled string of types
*/
+ @SuppressWarnings("nls")
static public String getTypeSignature(String type) {
int dim = 0;
for (int j = 0; j < type.length(); j++) {

Back to the top