X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.core%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fcore%2Fctfadaptor%2FCtfIterator.java;h=62add563df8ee91460fab568d9751e418dddc8dc;hb=77ef700d1a3ab5fa9723ca10451e1df5379bef4e;hp=d215d76371f84bf47187d779a949d8797be0d00b;hpb=1d7277f317fe1a75f274719fc9a87eaf33fada84;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java index d215d76371..62add563df 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java @@ -122,7 +122,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext, /* Adjust the timestamp depending on the trace's offset */ long currTimestamp = ctfLocationData.getTimestamp(); - final long offsetTimestamp = currTimestamp - this.getTrace().getOffset(); + final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp); if (offsetTimestamp < 0) { ret = super.seek(0L); } else { @@ -133,17 +133,21 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext, * Check if there is already one or more events for that timestamp, and * assign the location index correctly */ - currTimestamp = this.getCurrentEvent().getTimestampValue(); long index = 0; - for (long i = 0; i < ctfLocationData.getIndex(); i++) { - if (currTimestamp == this.getCurrentEvent().getTimestampValue()) { - index++; - } else { - index = 0; + if (this.getCurrentEvent() != null) { + currTimestamp = this.getCurrentEvent().getTimestampValue(); + + for (long i = 0; i < ctfLocationData.getIndex(); i++) { + if (currTimestamp == this.getCurrentEvent().getTimestampValue()) { + index++; + } else { + index = 0; + } + this.advance(); } - this.advance(); + } else { + ret= false; } - /* Seek the current location accordingly */ if (ret) { curLocation.setLocation(new CtfLocationData(getCurrentEvent().getTimestampValue(), index));