import org.eclipse.linuxtools.lttng.jni.JniEvent;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
import org.eclipse.linuxtools.tmf.event.TmfEventSource;
+import org.eclipse.linuxtools.tmf.trace.TmfTrace;
/**
* <b><u>LttngEvent</u></b><p>
// Reference to the JNI JniEvent. Should only be used INTERNALLY
private JniEvent jniEventReference = null;
-
+
+ // Reference to the parent trace that own this event
+ private TmfTrace<LttngEvent> parentTrace = null;
+
/**
* Constructor with parameters.<p>
*
* @see org.eclipse.linuxtools.lttng.event.LttngEventReference
* @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniEvent
*/
- public LttngEvent(LttngTimestamp timestamp, TmfEventSource source, LttngEventType type, LttngEventContent content, LttngEventReference reference, JniEvent lttEvent) {
+ public LttngEvent(TmfTrace<LttngEvent> parent, LttngTimestamp timestamp, TmfEventSource source, LttngEventType type, LttngEventContent content, LttngEventReference reference, JniEvent lttEvent) {
super(timestamp, source, type, reference);
fContent = content;
jniEventReference = lttEvent;
+ setParentTrace(parent);
}
/**
* @param oldEvent Event we want to copy from.
*/
public LttngEvent(LttngEvent oldEvent) {
- this( (LttngTimestamp)oldEvent.getTimestamp(),
+ this(
+ oldEvent.getParentTrace(),
+ (LttngTimestamp)oldEvent.getTimestamp(),
(TmfEventSource)oldEvent.getSource(),
(LttngEventType)oldEvent.getType(),
(LttngEventContent)oldEvent.getContent(),
/**
+ * Return the parent trace asoociated with this event
+ *
+ * @return Parent trace
+ */
+ public TmfTrace<LttngEvent> getParentTrace() {
+ return parentTrace;
+ }
+
+ /**
+ * Set a new parent trace for this event
+ *
+ * @param parentTrace The new parent
+ */
+ public void setParentTrace(TmfTrace<LttngEvent> parentTrace) {
+ this.parentTrace = parentTrace;
+ }
+
+
+ /**
* Return the channel name of this event.<p>
*
* @return Channel (tracefile) for this event
return ( (LttngEventType)this.getType() ).getMarkerName();
}
- /**
- * Set a new JniReference for this event.<p>
- *
- * Note : Reference is used to get back to the Jni during event parsing and need to be consistent.
- *
- * @param newJniEventReference New reference
- *
- * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniEvent
- */
- public void updateJniEventReference(JniEvent newJniEventReference) {
- this.jniEventReference = newJniEventReference;
- }
-
@Override
public LttngEventContent getContent() {
return (LttngEventContent)fContent;
fType = newType;
}
+ /**
+ * Set a new JniReference for this event.<p>
+ *
+ * Note : Reference is used to get back to the Jni during event parsing and need to be consistent.
+ *
+ * @param newJniEventReference New reference
+ *
+ * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniEvent
+ */
+ public void updateJniEventReference(JniEvent newJniEventReference) {
+ this.jniEventReference = newJniEventReference;
+ }
/**
* Convert this event into a Jni JniEvent.<p>
eventContent = new TextLttngEventContent(currentLttngEvent);
eventReference = new LttngEventReference(this.getName());
- currentLttngEvent = new TextLttngEvent(eventTimestamp, eventSource, eventType, eventContent, eventReference);
+ currentLttngEvent = new TextLttngEvent(this, eventTimestamp, eventSource, eventType, eventContent, eventReference);
eventContent.setEvent(currentLttngEvent);
if ( positionToFirstEvent() == false ) {
// Redefine event to override method we know won't work with a Text tracefile
class TextLttngEvent extends LttngEvent {
- public TextLttngEvent( LttngTimestamp timestamp,
+ public TextLttngEvent( TmfTrace<LttngEvent> parent,
+ LttngTimestamp timestamp,
LttngEventSource source,
LttngEventType type,
LttngEventContent content,
LttngEventReference reference)
{
- super(timestamp, source, type, content, reference, null);
+ super(parent, timestamp, source, type, content, reference, null);
}
public TextLttngEvent(TextLttngEvent oldEvent) {
this(
+ oldEvent.getParentTrace(),
(LttngTimestamp)oldEvent.getTimestamp(),
(LttngEventSource)oldEvent.getSource(),
(LttngEventType)oldEvent.getType(),
eventReference = new LttngEventReference(this.getName());
// Create the skeleton event
- currentLttngEvent = new LttngEvent(eventTimestamp, eventSource, eventType, eventContent, eventReference, null);
+ currentLttngEvent = new LttngEvent(this, eventTimestamp, eventSource, eventType, eventContent, eventReference, null);
// Create a new current location
previousLocation = new LttngLocation();
eventReference = new LttngEventReference(jniEvent.getParentTracefile().getTracefilePath(), this.getName());
eventType = new LttngEventType(traceTypes.get( EventTypeKey.getEventTypeKey(jniEvent) ));
eventContent = new LttngEventContent(currentLttngEvent);
- currentLttngEvent = new LttngEvent(eventTimestamp, eventSource, eventType, eventContent, eventReference, null);
+ currentLttngEvent = new LttngEvent(this, eventTimestamp, eventSource, eventType, eventContent, eventReference, null);
// The jni reference is no longer reliable but we will keep it anyhow
currentLttngEvent.updateJniEventReference(jniEvent);