Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2012-06-12 12:43:40 +0000
committerFrancois Chouinard2012-06-12 12:43:40 +0000
commitc76e383b93007456b5f9f1fdc5fc9d6415cdaae2 (patch)
tree75b1a38213488596006f600d7ea27c8cb0a7a247 /lttng/org.eclipse.linuxtools.tmf.core
parent9a6edbb3e54e4a76afbb02529ba9385cf5c93d75 (diff)
downloadorg.eclipse.linuxtools-c76e383b93007456b5f9f1fdc5fc9d6415cdaae2.tar.gz
org.eclipse.linuxtools-c76e383b93007456b5f9f1fdc5fc9d6415cdaae2.tar.xz
org.eclipse.linuxtools-c76e383b93007456b5f9f1fdc5fc9d6415cdaae2.zip
Revert "Fix for bug 381411: Incorrect experiment location after getNext."
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.core')
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java40
1 files changed, 37 insertions, 3 deletions
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 a5d0716f3a..a6a189cd16 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
@@ -264,6 +264,37 @@ 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
@@ -379,6 +410,12 @@ 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);
}
@@ -404,9 +441,6 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I
updateAttributes(expContext, event.getTimestamp());
expContext.increaseRank();
expContext.setLastTrace(trace);
- final TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
- final ITmfContext traceContext = expContext.getContexts()[trace];
- location.getLocation().getLocations()[trace] = traceContext.getLocation().clone();
fExperimentContext = expContext;
processEvent(event);
}

Back to the top