diff options
author | Matthew Khouzam | 2012-04-25 20:58:15 +0000 |
---|---|---|
committer | Matthew Khouzam | 2012-05-01 13:47:45 +0000 |
commit | d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c (patch) | |
tree | c889de8e15c8592340d52a7af0601e9d0b6ae890 /lttng/org.eclipse.linuxtools.ctf.core | |
parent | 315334f0b35862e29a2e9365d9d0efc9930da117 (diff) | |
download | org.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.tar.gz org.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.tar.xz org.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.zip |
Fix problem with multiple channels including empty channels and ones
created after start.
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Diffstat (limited to 'lttng/org.eclipse.linuxtools.ctf.core')
2 files changed, 13 insertions, 11 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java index da15fb733a..e3523307be 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java @@ -13,6 +13,7 @@ package org.eclipse.linuxtools.ctf.core.trace; import java.util.Collection; +import java.util.HashMap; import java.util.PriorityQueue; import java.util.Set; import java.util.Vector; @@ -69,7 +70,7 @@ public class CTFTraceReader { */ private long fIndex; - private final long startIndex[]; + private final HashMap<Integer, Long> startIndex; // ------------------------------------------------------------------------ // Constructors @@ -100,11 +101,8 @@ public class CTFTraceReader { */ this.startTime = prio.peek().getCurrentEvent().timestamp; this.endTime = this.startTime; - this.fIndex = 0; - startIndex = new long[prio.size()]; - for (int i = 0; i < prio.size(); i++) { - startIndex[i] = 0; - } + this.index = 0; + startIndex = new HashMap<Integer, Long>(); } /** @@ -252,9 +250,13 @@ public class CTFTraceReader { .getCurrentPacket(); if (!packetHasMoreEvents) { int n = this.streamInputReaders.indexOf(top); - currentPacket.setIndexBegin(startIndex[n]); - currentPacket.setIndexEnd(fIndex); - startIndex[n] = fIndex + 1; + + if(!startIndex.containsKey(n)){ + startIndex.put(n, 0L); + } + currentPacket.setIndexBegin(startIndex.get(n)); + currentPacket.setIndexEnd(index); + startIndex.put(n, index + 1); } } /* @@ -352,7 +354,7 @@ public class CTFTraceReader { * Seek the trace reader. */ final long streamIndex = streamInputReader.seekIndex(index); - if( streamIndex != -1 ) + if( streamInputReader.getCurrentEvent() != null ) { tempIndex = Math.max(tempIndex, streamIndex); EventDefinition currentEvent = streamInputReader.getCurrentEvent(); diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java index 707d07352c..1e0f3663ec 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java @@ -223,7 +223,7 @@ public class StreamInputReader { throw new CTFReaderException( "Current packet null in index seek, did you index your trace yet?"); //$NON-NLS-1$ } - return -1; + return 0; } return this.packetReader.getCurrentPacket().getIndexBegin(); |