projects
/
deliverable
/
tracecompass.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LTTng: CPU usage analysis from the LTTng kernel trace
[deliverable/tracecompass.git]
/
org.eclipse.linuxtools.tmf.core
/
src
/
org
/
eclipse
/
linuxtools
/
tmf
/
core
/
ctfadaptor
/
CtfTmfEvent.java
diff --git
a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
index ae002a0cc9a2b3ef3ff71ac7d519c58ece5c2663..8cab950ec05c60a4eb65b5453e6dd9cdad63f538 100644
(file)
--- a/
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
+++ b/
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
@@
-1,5
+1,5
@@
/*******************************************************************************
/*******************************************************************************
- * Copyright (c) 2011, 201
3
Ericsson
+ * Copyright (c) 2011, 201
4
Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
@@
-18,6
+18,7
@@
import java.util.Set;
import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
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.event.ITmfCustomAttributes;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
@@
-28,14
+29,14
@@
import org.eclipse.linuxtools.tmf.core.event.lookup.ITmfSourceLookup;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
/**
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
* @since 2.0
*/
*
* @version 1.0
* @author Alexandre Montplaisir
* @since 2.0
*/
-public
final
class CtfTmfEvent extends TmfEvent
+public class CtfTmfEvent extends TmfEvent
implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
// ------------------------------------------------------------------------
implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
// ------------------------------------------------------------------------
@@
-49,9
+50,9
@@
public final class CtfTmfEvent extends TmfEvent
// Attributes
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private final int
s
ourceCPU;
- private final long
t
ypeId;
- private final String
e
ventName;
+ private final int
fS
ourceCPU;
+ private final long
fT
ypeId;
+ private final String
fE
ventName;
private final IEventDeclaration fDeclaration;
// ------------------------------------------------------------------------
private final IEventDeclaration fDeclaration;
// ------------------------------------------------------------------------
@@
-74,9
+75,10
@@
public final class CtfTmfEvent extends TmfEvent
);
fDeclaration = declaration;
);
fDeclaration = declaration;
- sourceCPU = cpu;
- typeId = declaration.getId();
- eventName = declaration.getName();
+ fSourceCPU = cpu;
+ fTypeId = declaration.getId();
+ fEventName = declaration.getName();
+
}
/**
}
/**
@@
-95,10
+97,10
@@
public final class CtfTmfEvent extends TmfEvent
null,
new TmfEventField("", null, new CtfTmfEventField[0]), //$NON-NLS-1$
NO_STREAM);
null,
new TmfEventField("", null, new CtfTmfEventField[0]), //$NON-NLS-1$
NO_STREAM);
-
this.s
ourceCPU = -1;
-
this.t
ypeId = -1;
-
this.e
ventName = EMPTY_CTF_EVENT_NAME;
-
this.
fDeclaration = null;
+
fS
ourceCPU = -1;
+
fT
ypeId = -1;
+
fE
ventName = EMPTY_CTF_EVENT_NAME;
+ fDeclaration = null;
}
// ------------------------------------------------------------------------
}
// ------------------------------------------------------------------------
@@
-111,7
+113,7
@@
public final class CtfTmfEvent extends TmfEvent
* @return The cpu id for a given source. In lttng it's from CPUINFO
*/
public int getCPU() {
* @return The cpu id for a given source. In lttng it's from CPUINFO
*/
public int getCPU() {
- return
this.s
ourceCPU;
+ return
fS
ourceCPU;
}
/**
}
/**
@@
-123,30
+125,24
@@
public final class CtfTmfEvent extends TmfEvent
* @return The event ID
*/
public long getID() {
* @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() {
}
@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() {
return (CtfTmfTrace) super.getTrace();
}
@Override
public ITmfEventType getType() {
- CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(
e
ventName);
+ CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(
getTrace(), fE
ventName);
if (ctfTmfEventType == null) {
/* Should only return null the first time */
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;
}
}
return ctfTmfEventType;
}
@@
-157,7
+153,7
@@
public final class CtfTmfEvent extends TmfEvent
@Override
public Set<String> listCustomAttributes() {
if (fDeclaration == null) {
@Override
public Set<String> listCustomAttributes() {
if (fDeclaration == null) {
- return new HashSet<
String
>();
+ return new HashSet<>();
}
return fDeclaration.getCustomAttributes();
}
}
return fDeclaration.getCustomAttributes();
}
@@
-182,18
+178,24
@@
public final class CtfTmfEvent extends TmfEvent
@Override
public CtfTmfCallsite getCallsite() {
CTFCallsite callsite = null;
@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();
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(e
ventName, ip);
+ callsite =
ctfTrace.getCallsite(fE
ventName, ip);
}
}
if (callsite == null) {
}
}
if (callsite == null) {
- callsite =
getTrace().getCTFTrace().getCallsite(e
ventName);
+ callsite =
ctfTrace.getCallsite(fE
ventName);
}
if (callsite != null) {
return new CtfTmfCallsite(callsite);
}
if (callsite != null) {
return new CtfTmfCallsite(callsite);
This page took
0.028096 seconds
and
5
git commands to generate.