1 package org
.eclipse
.linuxtools
.lttng
.event
;
3 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
4 import org
.eclipse
.linuxtools
.tmf
.event
.TmfTimestamp
;
5 import org
.eclipse
.linuxtools
.lttng
.jni
.JniEvent
;
8 * <b><u>LttngEvent</u></b>
10 * Lttng specific TmfEvent implementation
12 * The main difference from the basic Tmf implementation is that we keep an internal reference to the Jni JniEvent<br>
13 * The conversion from this LttngEvent to the JniEvent is then possible.
16 @SuppressWarnings("unused")
17 public class LttngEvent
extends TmfEvent
{
18 // Reference to the JNI JniEvent. Should only used INTERNALLY
19 JniEvent jniEventReference
= null;
22 * Constructor with parameters <br>
25 * @param timestamp The timestamp of this event
26 * @param source The source of this event
27 * @param type The type of this event
28 * @param content The content of this event
29 * @param reference The reference of this event
30 * @param lttEvent A reference to a valid JniEvent object
32 * @see org.eclipse.linuxtools.tmf.event.TmfTimestamp
33 * @see org.eclipse.linuxtools.lttng.event.LttngEventSource
34 * @see org.eclipse.linuxtools.lttng.event.LttngEventType
35 * @see org.eclipse.linuxtools.lttng.event.LttngEventContent
36 * @see org.eclipse.linuxtools.lttng.event.LttngEventReference
37 * @see org.eclipse.linuxtools.lttng.jni.JniEvent
40 public LttngEvent(LttngTimestamp timestamp
, LttngEventSource source
, LttngEventType type
, LttngEventContent content
, LttngEventReference reference
, JniEvent lttEvent
) {
41 super(timestamp
, source
, type
, content
, reference
);
43 jniEventReference
= lttEvent
;
47 * Return the channel name of this event<br>
49 * @return String The name of the channel
51 public String
getChannelName() {
52 String returnedValue
= "";
54 if ( this.getType() instanceof LttngEventType
) {
55 returnedValue
= ( (LttngEventType
)this.getType() ).getChannelName();
62 * Return the cpu id number of this event<br>
64 * @return long The cpu id
66 public long getCpuId() {
67 long returnedValue
=-1;
69 if ( this.getType() instanceof LttngEventType
) {
70 returnedValue
= ( (LttngEventType
)this.getType() ).getCpuId();
77 * Return the marker name of this event<br>
79 * @return String The marker name
81 public String
getMarkerName() {
82 String returnedValue
= "";
84 if ( this.getType() instanceof LttngEventType
) {
85 returnedValue
= ( (LttngEventType
)this.getType() ).getMarkerName();
92 * Convert this event into a Jni JniEvent<br>
94 * Note : Some verification are done to make sure the event is still valid on the Jni side.<br>
95 * If it is not the case, null will be returned.
97 * @return JniEvent The converted event
98 * @see org.eclipse.linuxtools.lttng.jni.JniEvent
100 public JniEvent
convertEventTmfToJni() {
101 JniEvent tmpEvent
= null;
103 // We don't want to send away events that are outdated as their informations could be invalid
104 // If the timestamp between the event and the trace are not coherent we will not perform the conversion
105 if ( jniEventReference
.getParentTracefile().getParentTrace().getCurrentEventTimestamp().getTime() == getTimestamp().getValue() ) {
106 tmpEvent
= jniEventReference
;