diff options
author | Francois Chouinard | 2012-05-22 19:07:48 +0000 |
---|---|---|
committer | Francois Chouinard | 2012-05-22 19:07:48 +0000 |
commit | 34e2c4fbec7a439ac6a484d5a2e8c5978acf4fa6 (patch) | |
tree | aac481d5117f52feec13c77f2f635aea35a4ea07 /lttng/org.eclipse.linuxtools.tmf.core | |
parent | 3a0f4a0568006f0a12d8e5c5e73e8072c26d45ba (diff) | |
download | org.eclipse.linuxtools-34e2c4fbec7a439ac6a484d5a2e8c5978acf4fa6.tar.gz org.eclipse.linuxtools-34e2c4fbec7a439ac6a484d5a2e8c5978acf4fa6.tar.xz org.eclipse.linuxtools-34e2c4fbec7a439ac6a484d5a2e8c5978acf4fa6.zip |
Fix for the handling of legacy LTTng traces
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.core')
2 files changed, 39 insertions, 6 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 ec08f6c9be..2e9e453c55 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 @@ -24,6 +24,8 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; +import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; +import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest; import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal; import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal; import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal; @@ -71,6 +73,10 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I */ private IFile fBookmarksFile; + + // Saved experiment context (optimization) + private TmfExperimentContext fExperimentContext; + // ------------------------------------------------------------------------ // Construction // ------------------------------------------------------------------------ @@ -213,6 +219,30 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I } // ------------------------------------------------------------------------ + // Request management + // ------------------------------------------------------------------------ + + @Override + protected ITmfContext armRequest(final ITmfDataRequest<T> request) { + if (request instanceof ITmfEventRequest<?> + && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime()) + && request.getIndex() == 0) + { + final ITmfContext context = seekEvent(((ITmfEventRequest<T>) request).getRange().getStartTime()); + ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank()); + return context; + + } + + // Check if we are already at the right index + if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) { + return fExperimentContext; + } + + return seekEvent(request.getIndex()); + } + + // ------------------------------------------------------------------------ // ITmfTrace trace positioning // ------------------------------------------------------------------------ @@ -254,6 +284,9 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I context.setLocation(expLocation); context.setLastTrace(TmfExperimentContext.NO_TRACE); context.setRank(ITmfContext.UNKNOWN_RANK); + + fExperimentContext = context; + return (ITmfContext) context; } @@ -303,11 +336,11 @@ public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements I if (event != null) { updateAttributes(previousContext, event.getTimestamp()); - TmfExperimentContext expContext = (TmfExperimentContext) context; - int trace = expContext.getLastTrace(); + fExperimentContext = (TmfExperimentContext) context; + int trace = fExperimentContext.getLastTrace(); if (trace != TmfExperimentContext.NO_TRACE) { - TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation(); - location.getLocation().getLocations()[trace] = expContext.getContexts()[trace].getLocation(); + TmfExperimentLocation location = (TmfExperimentLocation) fExperimentContext.getLocation(); + location.getLocation().getLocations()[trace] = fExperimentContext.getContexts()[trace].getLocation(); } context.increaseRank(); 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 6e04c189c4..5443bc5537 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 @@ -519,10 +519,10 @@ public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T> */ protected synchronized void updateAttributes(final ITmfContext context, final ITmfTimestamp timestamp) { if (fStartTime.equals(TmfTimestamp.BIG_BANG) || fStartTime.compareTo(timestamp, false) > 0) { - fStartTime = timestamp; + fStartTime = timestamp.clone(); } if (fEndTime.equals(TmfTimestamp.BIG_CRUNCH) || fEndTime.compareTo(timestamp, false) < 0) { - fEndTime = timestamp; + fEndTime = timestamp.clone(); } if (context.hasValidRank()) { long rank = context.getRank(); |