aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron2013-11-18 21:14:46 (EST)
committerAlexandre Montplaisir2013-11-23 03:37:18 (EST)
commit7b9585cd9b362ac22bb20b0f31d939e7529ac1e6 (patch)
tree337027cbe02f5f1b1d50905715aa5bd9cb6468a8
parent8798c2b5fe4c8dea6e74dac041e324c222d55294 (diff)
downloadorg.eclipse.linuxtools-7b9585cd9b362ac22bb20b0f31d939e7529ac1e6.zip
org.eclipse.linuxtools-7b9585cd9b362ac22bb20b0f31d939e7529ac1e6.tar.gz
org.eclipse.linuxtools-7b9585cd9b362ac22bb20b0f31d939e7529ac1e6.tar.bz2
Avoid multiple seek to the same location.refs/changes/61/18461/8
There is multiple instance of seeking to the same location twice. To solve this issue the seek method check if the current location is the same. Here is the explanation: [CtfTmfContext.java] public void setLocation(ITmfLocation location) { curLocation = (CtfLocation) location; if (curLocation != null) { getIterator().seek(curLocation.getLocationInfo()); } } GetIterator --> will force a seek to curLocation .seek --> force an other seek to curLocation Here are the called method: private CtfIterator getIterator() { return CtfIteratorManager.getIterator(fTrace, this); } public static synchronized CtfIterator getIterator(final CtfTmfTrace trace, final CtfTmfContext ctx) { return map.get(trace).getIterator(ctx); } public CtfIterator getIterator(final CtfTmfContext context) { [...] if (context.getLocation() != null) { final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo(); retVal.seek(location); /// FORCE SEEK!!!!!!!!!!!! } Change-Id: Ib5ad6d05eb47045660c7ab5076930a30e829c7a0 Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/18461 Reviewed-by: Fran├žois Doray <fdoray.eclipse@gmail.com> Tested-by: Hudson CI Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
index 9635d55..0f250a9 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
@@ -125,6 +125,11 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
public synchronized boolean seek(final CtfLocationInfo ctfLocationData) {
boolean ret = false;
+ /* Avoid the cost of seeking at the current location. */
+ if (curLocation.getLocationInfo().equals(ctfLocationData)) {
+ return super.hasMoreEvents();
+ }
+
/* Adjust the timestamp depending on the trace's offset */
long currTimestamp = ctfLocationData.getTimestamp();
final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp);