summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMatthew Khouzam2012-04-03 17:41:06 (EDT)
committer Francois Chouinard2012-04-16 14:20:23 (EDT)
commiteb53d527a2cadcb4f367ecbcc9e0a127c39c2a4d (patch)
tree0929f79b21e67f87fdec93941cda53c53989b40c
parent2919a69f6f41680224803d99f3acec8590370540 (diff)
downloadorg.eclipse.linuxtools-eb53d527a2cadcb4f367ecbcc9e0a127c39c2a4d.zip
org.eclipse.linuxtools-eb53d527a2cadcb4f367ecbcc9e0a127c39c2a4d.tar.gz
org.eclipse.linuxtools-eb53d527a2cadcb4f367ecbcc9e0a127c39c2a4d.tar.bz2
Add support in the UI for LTTng 2.0.
signed-off by: YEAH BABY
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java58
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java1
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketIndexEntry.java4
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java6
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java36
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java5
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterNode.java15
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterTreeNode.java16
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java2
9 files changed, 83 insertions, 60 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 5ebf5cc..791cc3f 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
@@ -238,7 +238,21 @@ public class CTFTraceReader {
if (top == null) {
return false;
}
-
+ /*
+ * index if needed
+ */
+ if (hasMoreEvents()) {
+ StreamInputPacketReader packetReader = top.getPacketReader();
+ boolean packetHasMoreEvents = packetReader.hasMoreEvents();
+ StreamInputPacketIndexEntry currentPacket = packetReader
+ .getCurrentPacket();
+ if (!packetHasMoreEvents) {
+ int n = this.streamInputReaders.indexOf(top);
+ currentPacket.setIndexBegin(startIndex[n]);
+ currentPacket.setIndexEnd(index);
+ startIndex[n] = index + 1;
+ }
+ }
/*
* Read the next event of this reader.
*/
@@ -250,28 +264,18 @@ public class CTFTraceReader {
final long topEnd = top.getCurrentEvent().timestamp;
this.endTime = Math.max(topEnd, this.endTime);
this.eventCountPerTraceFile[top.getName()]++;
- }
- if (hasMoreEvents()) {
/*
* increment the index
*/
index++;
- StreamInputPacketReader packetReader = top.getPacketReader();
-
- if (packetReader.hasMoreEvents() == false) {
- int n = this.streamInputReaders.indexOf(top);
- StreamInputPacketIndexEntry currentPacket = packetReader
- .getCurrentPacket();
- currentPacket.setIndexBegin(startIndex[n]);
- currentPacket.setIndexEnd(index);
- startIndex[n] = index + 1;
- }
}
+ boolean hasMoreEvents = hasMoreEvents();
+
/*
* If there is no reader in the queue, it means the trace reader reached
* the end of the trace.
*/
- return hasMoreEvents();
+ return hasMoreEvents;
}
/**
@@ -352,8 +356,8 @@ public class CTFTraceReader {
}
} catch (CTFReaderException e) {
/*
- * Important, if it failed, it's because it's not yet indexed,
- * so we have to manually advance to the right value.
+ * Important, if it failed, it's because it's not yet indexed, so we
+ * have to manually advance to the right value.
*/
for (StreamInputReader streamInputReader : this.streamInputReaders) {
/*
@@ -372,16 +376,22 @@ public class CTFTraceReader {
this.prio.add(streamInputReader);
}
}
- /*
- * advance for offset
- */
- while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp)
- && hasMoreEvents()) {
- this.advance();
+ if (tempIndex == Long.MAX_VALUE) {
+ tempIndex = 0;
}
long pos = tempIndex;
- for (pos = tempIndex; (pos < index) && hasMoreEvents(); pos++) {
- this.advance();
+ if (index > tempIndex) {
+ /*
+ * advance for offset
+ */
+ while ((prio.peek().getCurrentEvent().timestamp < tempTimestamp)
+ && hasMoreEvents()) {
+ this.advance();
+ }
+
+ for (pos = tempIndex; (pos < index) && hasMoreEvents(); pos++) {
+ this.advance();
+ }
}
this.index = pos;
return hasMoreEvents();
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
index 878e8ec..23ad52d 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
@@ -357,6 +357,7 @@ public class StreamInput implements IDefinitionScope {
packetOffsetBytes += (packetIndex.getPacketSizeBits() + 7) / 8;
}
+ index.getEntries().get(0).setIndexBegin(0L);
}
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketIndexEntry.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketIndexEntry.java
index 12672a7..10cfdc2 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketIndexEntry.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketIndexEntry.java
@@ -56,9 +56,9 @@ public class StreamInputPacketIndexEntry {
private long timestampEnd = 0;
- private long indexBegin = -1;
+ private long indexBegin = Long.MAX_VALUE;
- private long indexEnd = -1;
+ private long indexEnd = Long.MAX_VALUE;
// ------------------------------------------------------------------------
// Constructors
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java
index 8d1404d..3262e50 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Tracer.java
@@ -3,6 +3,7 @@ package org.eclipse.linuxtools.internal.tmf.core;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import org.eclipse.core.runtime.Platform;
import org.eclipse.linuxtools.tmf.core.component.ITmfComponent;
@@ -27,7 +28,7 @@ public class Tracer {
static Boolean EVENT = Boolean.FALSE;
private static String LOGNAME = "trace.log";
- private static BufferedWriter fTraceLog = null;
+ private static BufferedWriter fTraceLog = new BufferedWriter(new OutputStreamWriter(System.out));
private static BufferedWriter openLogFile(String filename) {
BufferedWriter outfile = null;
@@ -93,8 +94,9 @@ public class Tracer {
}
public static void stop() {
- if (fTraceLog == null)
+ if (fTraceLog == null) {
return;
+ }
try {
fTraceLog.close();
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
index 85ee867..8ca36fe 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
@@ -20,12 +20,11 @@ import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.Definition;
import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
+import org.eclipse.linuxtools.internal.tmf.core.TmfCorePlugin;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
/**
* <b><u>CTFEvent</u></b>
@@ -41,6 +40,7 @@ public final class CtfTmfEvent implements ITmfEvent {
private static final String NO_STREAM = "No stream"; //$NON-NLS-1$
private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
+ private static final String CONTEXT_ID = "Ctf Event"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
@@ -53,7 +53,7 @@ public final class CtfTmfEvent implements ITmfEvent {
private final String eventName;
private final String fileName;
- private final TmfEventField fContent;
+ private final CtfTmfContent fContent;
// ------------------------------------------------------------------------
// Constructors
@@ -91,7 +91,7 @@ public final class CtfTmfEvent implements ITmfEvent {
this.fileName = top.getStreamInput().getFilename();
/* Read the fields */
- this.fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID,
+ this.fContent = new CtfTmfContent(ITmfEventField.ROOT_FIELD_ID,
parseFields(eventDef));
}
@@ -143,14 +143,14 @@ public final class CtfTmfEvent implements ITmfEvent {
this.fileName = other.fileName;
/* Copy the fields over */
- this.fContent = other.fContent.clone();
+ this.fContent = (CtfTmfContent) other.fContent.clone();
}
/**
* Inner constructor to create "null" events. Don't use this directly, use
* CTFEvent.getNullEvent();
*/
- private CtfTmfEvent() {
+ public CtfTmfEvent() {
this.fTrace = null;
this.timestamp = -1;
this.sourceCPU = -1;
@@ -243,21 +243,28 @@ public final class CtfTmfEvent implements ITmfEvent {
@Override
public ITmfTimestamp getTimestamp() {
if (fTimestamp == null) {
- fTimestamp = new TmfTimestamp(timestamp);
+ fTimestamp = new CtfTmfTimestamp(timestamp, fTrace);
}
return fTimestamp;
}
+ String fSource = null;
@Override
public String getSource() {
- // TODO Returns eventName for now
- return eventName;
+ // TODO Returns CPU for now
+ if(fSource == null) {
+ fSource= Integer.toString(getCPU());
+ }
+ return fSource;
}
+ private CtfTmfEventType type = null;
@Override
public ITmfEventType getType() {
- // TODO Auto-generated method stub
- return null;
+ if(type == null){
+ type = new CtfTmfEventType(CONTEXT_ID, eventName, fContent);
+ }
+ return type;
}
@Override
@@ -265,10 +272,13 @@ public final class CtfTmfEvent implements ITmfEvent {
return fContent;
}
+ String fReference = null;
@Override
public String getReference() {
- // TODO Auto-generated method stub
- return null;
+ if( fReference == null){
+ fReference = getChannelName();
+ }
+ return fReference;
}
@Override
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
index 418cc38..ffcb77c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
@@ -83,8 +83,6 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
// this.fEndTime.clone()));
}
-
-
@Override
public void indexTrace(boolean waitForCompletion) {
}
@@ -237,6 +235,9 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
@Override
public ITmfContext seekLocation(ITmfLocation<?> location) {
+ if (location == null) {
+ location = new CtfLocation(0L);
+ }
iterator.setLocation(location);
return iterator;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterNode.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterNode.java
index a3dc3a1..3aac38a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterNode.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterNode.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2010 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Patrick Tasse - Initial API and implementation
*******************************************************************************/
@@ -19,12 +19,12 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
public class TmfFilterNode extends TmfFilterTreeNode {
-
+
public static final String NODE_NAME = "FILTER"; //$NON-NLS-1$
public static final String NAME_ATTR = "name"; //$NON-NLS-1$
-
+
String fFilterName;
-
+
public TmfFilterNode(String filterName) {
super(null);
fFilterName = filterName;
@@ -63,9 +63,8 @@ public class TmfFilterNode extends TmfFilterTreeNode {
public List<String> getValidChildren() {
if (getChildrenCount() == 0) {
return super.getValidChildren();
- } else {
- return new ArrayList<String>(0); // only one child allowed
}
+ return new ArrayList<String>(0); // only one child allowed
}
@Override
@@ -77,7 +76,7 @@ public class TmfFilterNode extends TmfFilterTreeNode {
for (int i = 0; i < getChildrenCount(); i++) {
ITmfFilterTreeNode node = getChildren()[i];
buf.append(node.toString());
- if (i < getChildrenCount() - 1) {
+ if (i < (getChildrenCount() - 1)) {
buf.append(" and "); //$NON-NLS-1$
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterTreeNode.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterTreeNode.java
index 52c5bb8..9c6536b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterTreeNode.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterTreeNode.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2010 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Yuriy Vashchuk (yvashchuk@gmail.com) - Initial API and implementation
* Patrick Tasse - Refactoring
@@ -27,7 +27,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
* <p>
*/
public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable {
-
+
private static final String[] VALID_CHILDREN = {
TmfFilterEventTypeNode.NODE_NAME,
TmfFilterAndNode.NODE_NAME,
@@ -37,7 +37,7 @@ public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable
TmfFilterMatchesNode.NODE_NAME,
TmfFilterCompareNode.NODE_NAME
};
-
+
private ITmfFilterTreeNode parent = null;
private ArrayList<ITmfFilterTreeNode> children = new ArrayList<ITmfFilterTreeNode>();
@@ -46,7 +46,7 @@ public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable
parent.addChild(this);
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode#getParent()
*/
@@ -144,7 +144,7 @@ public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable
this.parent = parent;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode#matches(org.eclipse.linuxtools.tmf.event.TmfEvent)
*/
@@ -166,7 +166,7 @@ public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable
value = event.getType().getName();
}
else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) {
- value = ((Long) event.getTimestamp().getValue()).toString();
+ value = event.getTimestamp().toString();
}
else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) {
value = event.getSource();
@@ -182,7 +182,7 @@ public abstract class TmfFilterTreeNode implements ITmfFilterTreeNode, Cloneable
/* (non-Javadoc)
* @see org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode#getValidChildren()
- *
+ *
* By default, all node types are valid children. Override if different.
*/
@Override
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
index c5dbf74..f1a613c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
@@ -1383,7 +1383,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
protected ITmfEventField[] extractItemFields(ITmfEvent event) {
ITmfEventField[] fields = new TmfEventField[0];
if (event != null) {
- String timestamp = ((Long) event.getTimestamp().getValue()).toString();
+ String timestamp = event.getTimestamp().toString();
String source = event.getSource();
String type = event.getType().getName();
String reference = event.getReference();