public LttngEvent(TmfTrace<LttngEvent> parent, LttngTimestamp timestamp, String source, LttngEventType type, LttngEventContent content,
String reference, JniEvent lttEvent)
{
- super(timestamp, source, type, reference);
- super.setContent(content);
+ super(parent, timestamp, source, type, content, reference);
jniEventReference = lttEvent;
super.setTrace(parent);
}
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
/**
public void testDefaultConstructor() {
final ITmfEvent event = new TmfEvent();
assertNull("getTrace", event.getTrace());
- assertEquals("getRank", -1, event.getRank());
+ assertEquals("getRank", TmfContext.UNKNOWN_RANK, event.getRank());
assertNull("getTimestamp", event.getTimestamp());
assertNull("getSource", event.getSource());
assertNull("getType", event.getType());
public void testNoRankConstructor() {
final TmfEvent event = new TmfEvent(null, fTimestamp1, fSource, fType, fContent1, fReference1);
assertNull("getTrace", event.getTrace());
- assertEquals("getRank", -1, event.getRank());
+ assertEquals("getRank", TmfContext.UNKNOWN_RANK, event.getRank());
assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
assertEquals("getSource", fSource, event.getSource());
assertEquals("getType", fType, event.getType());
assertEquals("getReference", fReference1, event.getReference());
}
- public void testNoRankContentConstructor() {
- final TmfEvent event = new TmfEvent(null, fTimestamp1, fSource, fType, fReference1);
- assertNull("getTrace", event.getTrace());
- assertEquals("getRank", -1, event.getRank());
- assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
- assertEquals("getSource", fSource, event.getSource());
- assertEquals("getType", fType, event.getType());
- assertNull("getContent", event.getContent());
- assertEquals("getReference", fReference1, event.getReference());
- }
-
- public void testNoTraceRankContentConstructor() {
- final TmfEvent event = new TmfEvent(fTimestamp1, fSource, fType, fReference1);
- assertNull("getTrace", event.getTrace());
- assertEquals("getRank", -1, event.getRank());
- assertEquals("getTimestamp", fTimestamp1, event.getTimestamp());
- assertEquals("getSource", fSource, event.getSource());
- assertEquals("getType", fType, event.getType());
- assertNull("getContent", event.getContent());
- assertEquals("getReference", fReference1, event.getReference());
- }
-
public void testConstructorWithTrace() {
final ITmfTrace<TmfEvent> trace = openTrace();
final TmfEvent event = new TmfEvent(trace, 0, fTimestamp1, fSource, fType, fContent1, fReference1);
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
- * The basic event structure in TMF. In its canonical form, a data item has:
+ * The generic event structure in TMF. In its canonical form, an event has:
* <ul>
* <li> a parent trace
* <li> a rank (order within the trace)
*
* @see ITmfTimestamp
* @see ITmfEventType
- * @see ITmfEvetnField
+ * @see ITmfEventField
* @see TmfEvent
*/
public interface ITmfEvent extends Cloneable {
// ------------------------------------------------------------------------
/**
- * Pre-defined event attributes
+ * Pre-defined event timestamp attribute (for searching &filtering purposes)
*/
public static final String EVENT_FIELD_TIMESTAMP = ":timestamp:"; //$NON-NLS-1$
- public static final String EVENT_FIELD_SOURCE = ":source:"; //$NON-NLS-1$
- public static final String EVENT_FIELD_TYPE = ":type:"; //$NON-NLS-1$
- public static final String EVENT_FIELD_CONTENT = ":content:"; //$NON-NLS-1$
+
+ /**
+ * Pre-defined event source attribute (for searching &filtering purposes)
+ */
+ public static final String EVENT_FIELD_SOURCE = ":source:"; //$NON-NLS-1$
+
+ /**
+ * Pre-defined event type attribute (for searching &filtering purposes)
+ */
+ public static final String EVENT_FIELD_TYPE = ":type:"; //$NON-NLS-1$
+
+ /**
+ * Pre-defined event content attribute (for searching &filtering purposes)
+ */
+ public static final String EVENT_FIELD_CONTENT = ":content:"; //$NON-NLS-1$
+
+ /**
+ * Pre-defined event reference attribute (for searching &filtering purposes)
+ */
public static final String EVENT_FIELD_REFERENCE = ":reference:"; //$NON-NLS-1$
// ------------------------------------------------------------------------
package org.eclipse.linuxtools.tmf.core.event;
-
/**
- * The TMF event payload structure. Each field can be either a terminal or
+ * The generic event payload in TMF. Each field can be either a terminal or
* further decomposed into subfields.
*
* @since 1.0
* @version 1.0
* @author Francois Chouinard
*
- * @see TmfEventField
* @see ITmfEvent
+ * @see ITmfEventField
*/
public interface ITmfEventField extends Cloneable {
public Object getValue();
/**
- * @return the list of subfield names (empty if none)
+ * @return the list of subfield names (empty array if none)
*/
public String[] getFieldNames();
public String getFieldName(int index);
/**
- * @return the list of subfields (null if none)
+ * @return the list of subfields (empty array if none)
*/
public ITmfEventField[] getFields();
// ------------------------------------------------------------------------
/**
- * @return a clone of the event type
+ * @return a clone of the event field
*/
public ITmfEventField clone();
package org.eclipse.linuxtools.tmf.core.event;
-
/**
- * The TMF event event type. It contains a reference to the full field structure
+ * The generic event type in TMF. It contains a reference to the full field structure
* for that event type.
* <p>
* Types are unique within their context space.
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see TmfEventType
+ *
* @see ITmfEvent
+ * @see ITmfEventField
*/
public interface ITmfEventType extends Cloneable {
// ------------------------------------------------------------------------
/**
- * @return a clone of the event content
+ * @return a clone of the event type
*/
public ITmfEventType clone();
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see TmfTimestamp
- * @see TmfSimpleTimestamp
+ *
+ * @see ITmfEvent
* @see TmfTimeRange
*/
public interface ITmfTimestamp extends Cloneable, Comparable<ITmfTimestamp> {
package org.eclipse.linuxtools.tmf.core.event;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
/**
* A basic implementation of ITmfEvent.
* @since 1.0
* @version 1.0
* @author Francois Chouinard
+ *
* @see ITmfTimestamp
* @see ITmfEventType
* @see ITmfEventField
// ------------------------------------------------------------------------
/**
- * Default constructor
+ * Default constructor. All fields have their default value (null) and the
+ * event rank is set to TmfContext.UNKNOWN_RANK.
*/
public TmfEvent() {
- this(null, -1, null, null, null, null, null);
+ this(null, TmfContext.UNKNOWN_RANK, null, null, null, null, null);
}
/**
- * Constructor - no rank
- */
- public TmfEvent(final ITmfTrace<? extends ITmfEvent> trace, final ITmfTimestamp timestamp, final String source,
- final ITmfEventType type, final ITmfEventField content, final String reference)
- {
- this(trace, -1, timestamp, source, type, content, reference);
- }
+ * Standard constructor. The event rank will be set to TmfContext.UNKNOWN_RANK.
+ *
+ * @param trace the parent trace
+ * @param timestamp the event timestamp
+ * @param source the event source
+ * @param type the event type
+ * @param content the event content (payload)
+ * @param reference the event reference
- /**
- * Constructor - no rank, no content
*/
public TmfEvent(final ITmfTrace<? extends ITmfEvent> trace, final ITmfTimestamp timestamp, final String source,
- final ITmfEventType type, final String reference)
- {
- this(trace, -1, timestamp, source, type, null, reference);
- }
-
- /**
- * Constructor - no rank, no content, no trace
- */
- public TmfEvent(final ITmfTimestamp timestamp, final String source, final ITmfEventType type, final String reference)
+ final ITmfEventType type, final ITmfEventField content, final String reference)
{
- this(null, -1, timestamp, source, type, null, reference);
+ this(trace, TmfContext.UNKNOWN_RANK, timestamp, source, type, content, reference);
}
/**
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see ITmfEventField
- * @see ITmfEventType
+ *
* @see ITmfEvent
+ * @see ITmfEventType
*/
public class TmfEventField implements ITmfEventField {
}
/**
- * Constructor for a terminal field (i.e. no subfields)
+ * Constructor for a terminal field (no subfields)
*
* @param name the event field id
* @param value the event field value
package org.eclipse.linuxtools.tmf.core.event;
-
/**
* A basic implementation of ITmfEventType.
*
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see ITmfEventType
- * @see ITmfEventField
+ *
* @see ITmfEvent
+ * @see ITmfEventField
*/
public class TmfEventType implements ITmfEventType {
import java.util.HashMap;
import java.util.Map;
-
/**
- * The TmfEventTypeManager acts as a central repository for the available
- * event types. Types are managed in their context space.
+ * A central repository for the available event types. Types are managed by
+ * context space.
*
* @since 1.0
* @version 1.0
* @author Francois Chouinard
+ *
* @see ITmfEventType
*/
public final class TmfEventTypeManager {
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see ITmfTimestamp
- * @see TmfTimestamp
*/
public class TmfSimpleTimestamp extends TmfTimestamp {
// ------------------------------------------------------------------------
/**
- * Default constructor
+ * Default constructor (value = 0)
*/
public TmfSimpleTimestamp() {
this(0);
* @since 1.0
* @version 1.0
* @author Francois Chouinard
+ *
* @see ITmfTimestamp
- * @see TmfTimestamp
*/
public final class TmfTimeRange implements Cloneable {
* @since 1.0
* @version 1.0
* @author Francois Chouinard
- * @see ITmfTimestamp
- * @see TmfSimpleTimestamp
*/
public class TmfTimestamp implements ITmfTimestamp, Cloneable {
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
/**
- * <b><u>ITmfCheckpoint</u></b>
- * <p>
* The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
* to associate a trace location to an event timestamp.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see TmfCheckpoint
+ * @see ITmfTimestamp
+ * @see ITmfLocation
*/
public interface ITmfCheckpoint extends Cloneable, Comparable<ITmfCheckpoint> {
package org.eclipse.linuxtools.tmf.core.trace;
/**
- * <b><u>ITmfContext</u></b>
- * <p>
* The basic trace context structure in TMF. The purpose of the context is to
* associate a trace location to an event of a specific rank (order).
* <p>
* The context should be sufficient to allow the trace to position itself so
* that performing a trace read operation will yield the corresponding event.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfLocation
*/
public interface ITmfContext extends Cloneable {
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
/**
- * <b><u>ITmfEventParser</u></b>
- * <p>
+ * The TMF trace parser API.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfEvent
+ * @see ITmfContext
*/
public interface ITmfEventParser<T extends ITmfEvent> {
package org.eclipse.linuxtools.tmf.core.trace;
+
/**
- * <b><u>ITmfLocation</u></b>
- * <p>
* An ITmfLocation is the equivalent of a random-access file position, holding
* enough information to allow the positioning of the trace 'pointer' to read an
* arbitrary event.
* <p>
* This location is trace-specific but must be comparable.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see TmfLocation
*/
public interface ITmfLocation<L extends Comparable<?>> extends Cloneable {
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
/**
- * <b><u>ITmfTrace</u></b>
- * <p>
* The event stream structure in TMF. In its basic form, a trace has:
* <ul>
* <li> an associated Eclipse resource
* request.waitForCompletion();
* }
* </pre>
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
* @see ITmfEvent
* @see ITmfEventProvider
* @see ITmfEventRequest
+ * @see TmfTrace
*/
public interface ITmfTrace<T extends ITmfEvent> extends ITmfDataProvider<T> {
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
/**
- * <b><u>ITmfTraceIndexer</u></b>
- * <p>
+ * The trace indexer API.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfTrace
+ * @see ITmfEvent
*/
public interface ITmfTraceIndexer<T extends ITmfTrace<ITmfEvent>> {
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
/**
- * <b><u>TmfCheckpoint</u></b>
- * <p>
* This class maps an event timestamp to a generic location.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfCheckpoint
+ * @see ITmfLocation
+ * @see ITmfTimestamp
*/
public class TmfCheckpoint implements ITmfCheckpoint {
import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
/**
- * <b><u>TmfTraceIndexer</u></b>
- * <p>
* A simple trace indexer that builds an array of trace checkpoints. Checkpoints
* are stored at fixed intervals (event rank) in ascending timestamp order.
* <p>
* <p>
* Locating a specific checkpoint is trivial for both rank (rank % interval) and
* timestamp (bsearch in the array).
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfTraceIndexer
+ * @see ITmfTrace
+ * @see ITmfEvent
*/
public class TmfCheckpointIndexer<T extends ITmfTrace<ITmfEvent>> implements ITmfTraceIndexer<T> {
package org.eclipse.linuxtools.tmf.core.trace;
/**
- * <b><u>TmfContext</u></b>
- * <p>
* Trace context structure. It ties a trace location to an event rank. The
* context should be enough to restore the trace state so the corresponding
* event can be read.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfContext
+ * @see ITmfLocation
*/
public class TmfContext implements ITmfContext, Cloneable {
import java.lang.reflect.Method;
/**
- * <b><u>TmfLocation</u></b>
- * <p>
* A convenience implementation on of ITmfLocation. The generic class (L) must
* be comparable.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfLocation
*/
public class TmfLocation<L extends Comparable<L>> implements ITmfLocation<L> {
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
/**
- * <b><u>TmfTrace</u></b>
- * <p>
* Abstract implementation of ITmfTrace.
* <p>
* Since the concept of 'location' is trace specific, the concrete classes have
* The concrete class can either specify its own indexer or use the provided
* TmfCheckpointIndexer (default). In this case, the trace cache size will be
* used as checkpoint interval.
+ *
+ * @since 1.0
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see ITmfTrace
+ * @see TmfEventProvider
+ * @see ITmfEvent
+ * @see ITmfTraceIndexer
+ * @see ITmfEventParser
*/
public abstract class TmfTrace<T extends ITmfEvent> extends TmfEventProvider<T> implements ITmfTrace<T> {
}\r
\r
public CustomEvent(CustomTraceDefinition definition, ITmfTrace<?> parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) {\r
- super(parentTrace, timestamp, source, type, reference);\r
+ super(parentTrace, timestamp, source, type, null, reference);\r
fDefinition = definition;\r
fData = new HashMap<String, String>();\r
}\r