org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.ctf.core,
- org.eclipse.tracecompass.lttng2.control.core
+ org.eclipse.tracecompass.lttng2.control.core,
+ org.eclipse.tracecompass.ctf.core
Import-Package: com.google.common.base,
com.google.common.collect,
com.google.common.io
point="org.eclipse.linuxtools.tmf.core.tracetype">
<type
category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
- event_type="org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent"
+ event_type="org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent"
id="org.eclipse.linuxtools.lttng2.ust.tracetype"
isDirectory="true"
name="%tracetype.type.ust"
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
+ *
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.lttng2.ust.core.trace;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAspect;
+import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
+import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Event type for use in LTTng-UST traces.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+@NonNullByDefault
+public class LttngUstEvent extends CtfTmfEvent implements ITmfSourceLookup {
+
+ /**
+ * Default constructor. Only for use by extension points, should not be
+ * called directly.
+ */
+ @Deprecated
+ public LttngUstEvent() {
+ super();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param trace
+ * The trace to which this event belongs
+ * @param rank
+ * The rank of the event
+ * @param timestamp
+ * The timestamp
+ * @param channel
+ * The CTF channel of this event
+ * @param cpu
+ * The event's CPU
+ * @param declaration
+ * The event declaration
+ * @param eventDefinition
+ * The event definition
+ */
+ protected LttngUstEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
+ String channel, int cpu, IEventDeclaration declaration, EventDefinition eventDefinition) {
+ super(trace, rank, timestamp, channel, cpu, declaration, eventDefinition);
+ }
+
+ @Override
+ public @Nullable ITmfCallsite getCallsite() {
+ return UstDebugInfoAspect.INSTANCE.resolve(this);
+ }
+}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2015 Ericsson and others
+ *
+ * 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
+ **********************************************************************/
+
+package org.eclipse.tracecompass.lttng2.ust.core.trace;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Factory for {@link LttngUstEvent}.
+ *
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public class LttngUstEventFactory extends CtfTmfEventFactory {
+
+ private static final @NonNull LttngUstEventFactory INSTANCE = new LttngUstEventFactory();
+
+ /**
+ * Private constructor.
+ */
+ private LttngUstEventFactory() {
+ super();
+ }
+
+ public static @NonNull LttngUstEventFactory instance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, String fileName) {
+ /* Prepare what to pass to CtfTmfEvent's constructor */
+ final IEventDeclaration eventDecl = eventDef.getDeclaration();
+ final long ts = eventDef.getTimestamp();
+ final TmfNanoTimestamp timestamp = trace.createTimestamp(trace.timestampCyclesToNanos(ts));
+
+ int sourceCPU = eventDef.getCPU();
+
+ String reference = (fileName == null ? NO_STREAM : fileName);
+
+ /* Handle the special case of lost events */
+ if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
+ return createLostEvent(trace, eventDef, eventDecl, ts, timestamp, sourceCPU, reference);
+ }
+
+ /* Handle standard event types */
+ return new LttngUstEvent(trace,
+ ITmfContext.UNKNOWN_RANK,
+ timestamp,
+ reference, // filename
+ sourceCPU,
+ eventDecl,
+ eventDef);
+ }
+}
\ No newline at end of file
* Default constructor
*/
public LttngUstTrace() {
- super();
+ super(LttngUstEventFactory.instance());
}
/**