aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2012-04-25 16:58:15 (EDT)
committerMatthew Khouzam2012-05-01 09:47:45 (EDT)
commitd98cd1cfb1a34ba44b6f4c084b2a7dc82143098c (patch)
treec889de8e15c8592340d52a7af0601e9d0b6ae890
parent315334f0b35862e29a2e9365d9d0efc9930da117 (diff)
downloadorg.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.zip
org.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.tar.gz
org.eclipse.linuxtools-d98cd1cfb1a34ba44b6f4c084b2a7dc82143098c.tar.bz2
Fix problem with multiple channels including empty channels and ones
created after start. Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java22
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java2
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 da15fb7..e352330 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 707d073..1e0f366 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();