/*******************************************************************************
- * Copyright (c) 2011, 2013 Ericsson
+ * Copyright (c) 2011, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.tmf.core.event.ITmfCustomAttributes;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
/**
- * A wrapper class around CTF's Event Definition/Declaration that maps all
- * types of Declaration to native Java types.
+ * 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
// Attributes
// ------------------------------------------------------------------------
- private final int sourceCPU;
- private final long typeId;
- private final String eventName;
+ private final int fSourceCPU;
+ private final long fTypeId;
+ private final String fEventName;
private final IEventDeclaration fDeclaration;
// ------------------------------------------------------------------------
);
fDeclaration = declaration;
- sourceCPU = cpu;
- typeId = declaration.getId();
- eventName = declaration.getName();
+ fSourceCPU = cpu;
+ fTypeId = declaration.getId();
+ fEventName = declaration.getName();
}
null,
new TmfEventField("", null, new CtfTmfEventField[0]), //$NON-NLS-1$
NO_STREAM);
- this.sourceCPU = -1;
- this.typeId = -1;
- this.eventName = EMPTY_CTF_EVENT_NAME;
- this.fDeclaration = null;
+ fSourceCPU = -1;
+ fTypeId = -1;
+ fEventName = EMPTY_CTF_EVENT_NAME;
+ fDeclaration = null;
}
// ------------------------------------------------------------------------
* @return The cpu id for a given source. In lttng it's from CPUINFO
*/
public int getCPU() {
- return this.sourceCPU;
+ return fSourceCPU;
}
/**
* @return The event ID
*/
public long getID() {
- return this.typeId;
- }
-
- /**
- * Gets the name of a current event.
- *
- * @return The event name
- */
- public String getEventName() {
- return eventName;
+ return fTypeId;
}
@Override
public CtfTmfTrace getTrace() {
- /* Should be of the right type, since we take a CtfTmfTrace at the constructor */
+ /*
+ * Should be of the right type, since we take a CtfTmfTrace at the
+ * constructor
+ */
return (CtfTmfTrace) super.getTrace();
}
@Override
public ITmfEventType getType() {
- CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(eventName);
+ CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(getTrace(), fEventName);
if (ctfTmfEventType == null) {
/* Should only return null the first time */
- ctfTmfEventType = new CtfTmfEventType(this.getEventName(), this.getContent());
+ ctfTmfEventType = new CtfTmfEventType(fEventName, getTrace(), getContent());
}
return ctfTmfEventType;
}
@Override
public Set<String> listCustomAttributes() {
if (fDeclaration == null) {
- return new HashSet<String>();
+ return new HashSet<>();
}
return fDeclaration.getCustomAttributes();
}
@Override
public CtfTmfCallsite getCallsite() {
CTFCallsite callsite = null;
- if (getTrace() == null) {
+ CtfTmfTrace trace = getTrace();
+ if (trace == null) {
+ return null;
+ }
+ 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 = getTrace().getCTFTrace().getCallsite(eventName, ip);
+ callsite = ctfTrace.getCallsite(fEventName, ip);
}
}
if (callsite == null) {
- callsite = getTrace().getCTFTrace().getCallsite(eventName);
+ callsite = ctfTrace.getCallsite(fEventName);
}
if (callsite != null) {
return new CtfTmfCallsite(callsite);