import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
import org.eclipse.tracecompass.tmf.core.event.ITmfCustomAttributes;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfModelLookup;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
-import org.eclipse.tracecompass.tmf.ctf.core.timestamp.CtfTmfTimestamp;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
/**
* A wrapper class around CTF's Event Definition/Declaration that maps all types
* of Declaration to native Java types.
*
- * @version 1.0
* @author Alexandre Montplaisir
- * @since 2.0
*/
public class CtfTmfEvent extends TmfEvent
implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
/**
* Constructor used by {@link CtfTmfEventFactory#createEvent}
*/
- CtfTmfEvent(CtfTmfTrace trace, long rank, CtfTmfTimestamp timestamp,
+ CtfTmfEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
String fileName, int cpu, IEventDeclaration declaration, @NonNull EventDefinition eventDefinition) {
super(trace,
rank,
CtfTmfEvent(CtfTmfTrace trace) {
super(trace,
ITmfContext.UNKNOWN_RANK,
- new CtfTmfTimestamp(-1),
+ new TmfNanoTimestamp(-1),
null,
new TmfEventField("", null, new CtfTmfEventField[0])); //$NON-NLS-1$
fSourceCPU = -1;
return fCtfTmfEventType;
}
- /**
- * @since 2.0
- */
+ @Override
+ public String getName() {
+ return fEventName;
+ }
+
@Override
public Set<String> listCustomAttributes() {
if (fEventDeclaration == null) {
return fEventDeclaration.getCustomAttributes();
}
- /**
- * @since 2.0
- */
@Override
public String getCustomAttribute(String name) {
if (fEventDeclaration == null) {
* Get the call site for this event.
*
* @return the call site information, or null if there is none
- * @since 2.0
*/
@Override
public CtfTmfCallsite getCallsite() {
- CTFCallsite callsite = null;
+ CtfTmfCallsite callsite = null;
CtfTmfTrace trace = getTrace();
- CTFTrace ctfTrace = trace.getCTFTrace();
- /* Should not happen, but it is a good check */
- if (ctfTrace == null) {
- return null;
- }
+
if (getContent() != null) {
ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
if (ipField != null && ipField.getValue() instanceof Long) {
long ip = (Long) ipField.getValue();
- callsite = ctfTrace.getCallsite(fEventName, ip);
+ callsite = trace.getCallsite(fEventName, ip);
}
}
if (callsite == null) {
- callsite = ctfTrace.getCallsite(fEventName);
+ callsite = trace.getCallsite(fEventName);
}
- if (callsite != null) {
- return new CtfTmfCallsite(callsite);
- }
- return null;
+ return callsite;
}
- /**
- * @since 2.0
- */
@Override
public String getModelUri() {
return getCustomAttribute(CtfConstants.MODEL_URI_KEY);