Now that the Callstack analysis and view track the PIDs of each
function entry/exit, it can pass them along with the timesteamps
to the symbol providers, so that provider implementations making
use of the new methods can resolve symbols in the view too.
Also add proper comparison logic for ProcessEntries, they can use
numerical comparaison of the PID they now carry.
Change-Id: I7404ab4b893878dbdd8e526a646014739cfbe228
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/69970
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
private final int fQuark;
private final int fStackLevel;
private final int fQuark;
private final int fStackLevel;
+ private final int fProcessId;
private final ITmfTrace fTrace;
private String fFunctionName;
private long fFunctionEntryTime;
private final ITmfTrace fTrace;
private String fFunctionName;
private long fFunctionEntryTime;
* The stack level
* @param trace
* The trace that this view is talking about
* The stack level
* @param trace
* The trace that this view is talking about
- * @deprecated Use {@link #CallStackEntry(String, int, int, ITmfTrace, ITmfStateSystem)}
+ * @deprecated Use {@link #CallStackEntry(String, int, int, int, ITmfTrace, ITmfStateSystem)}
*/
@Deprecated
public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) {
*/
@Deprecated
public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) {
* The trace that this view is talking about
* @param ss
* The call stack state system
* The trace that this view is talking about
* @param ss
* The call stack state system
+ * @deprecated Use
+ * {@link #CallStackEntry(String, int, int, int, ITmfTrace, ITmfStateSystem)}
public CallStackEntry(String name, int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
super(name, 0, 0);
fQuark = quark;
fStackLevel = stackLevel;
public CallStackEntry(String name, int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
super(name, 0, 0);
fQuark = quark;
fStackLevel = stackLevel;
+ fProcessId = -1;
+ fTrace = trace;
+ fFunctionName = ""; //$NON-NLS-1$
+ fSS = ss;
+ }
+
+ /**
+ * Standard constructor
+ *
+ * @param name
+ * The parent thread name
+ * @param quark
+ * The call stack quark
+ * @param stackLevel
+ * The stack level
+ * @param processId The ID of the process this entry belongs to
+ * @param trace
+ * The trace that this view is talking about
+ * @param ss
+ * The call stack state system
+ * @since 2.0
+ */
+ public CallStackEntry(String name, int quark, int stackLevel, int processId,
+ ITmfTrace trace, @NonNull ITmfStateSystem ss) {
+ super(name, 0, 0);
+ fQuark = quark;
+ fStackLevel = stackLevel;
+ fProcessId = processId;
fTrace = trace;
fFunctionName = ""; //$NON-NLS-1$
fSS = ss;
fTrace = trace;
fFunctionName = ""; //$NON-NLS-1$
fSS = ss;
+ /**
+ * Retrieve the ID of the process this entry belongs to.
+ *
+ * @return The ID of the process
+ * @since 2.0
+ */
+ public int getProcessId() {
+ return fProcessId;
+ }
+
/**
* Retrieve the trace that is associated to this view.
*
/**
* Retrieve the trace that is associated to this view.
*
try {
ITmfStateValue value = ss.querySingleState(event.getTime(), entry.getQuark()).getStateValue();
if (!value.isNull()) {
try {
ITmfStateValue value = ss.querySingleState(event.getTime(), entry.getQuark()).getStateValue();
if (!value.isNull()) {
- return fView.getFunctionName(entry.getTrace(), value);
+ return fView.getFunctionName(entry.getTrace(), entry.getProcessId(), event.getTime(), value);
}
} catch (AttributeNotFoundException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
}
} catch (AttributeNotFoundException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
try {
ITmfStateValue value = ss.querySingleState(event.getTime(), entry.getQuark()).getStateValue();
if (!value.isNull()) {
try {
ITmfStateValue value = ss.querySingleState(event.getTime(), entry.getQuark()).getStateValue();
if (!value.isNull()) {
- String name = fView.getFunctionName(entry.getTrace(), value);
+ String name = fView.getFunctionName(entry.getTrace(), entry.getProcessId(), event.getTime(), value);
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
Utils.drawText(gc, name, bounds.x, bounds.y, bounds.width, bounds.height, true, true);
}
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
Utils.drawText(gc, name, bounds.x, bounds.y, bounds.width, bounds.height, true, true);
}
private static class ProcessEntry extends TimeGraphEntry {
private static class ProcessEntry extends TimeGraphEntry {
- public ProcessEntry(String name, long startTime, long endTime) {
+ private final int fProcessId;
+
+ public ProcessEntry(String name, int processId, long startTime, long endTime) {
super(name, startTime, endTime);
super(name, startTime, endTime);
+ fProcessId = processId;
+ }
+
+ public int getProcessId() {
+ return fProcessId;
public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
if (o1 instanceof ThreadEntry && o2 instanceof ThreadEntry) {
return fThreadComparator.compare(o1, o2);
public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
if (o1 instanceof ThreadEntry && o2 instanceof ThreadEntry) {
return fThreadComparator.compare(o1, o2);
+ } else if (o1 instanceof ProcessEntry && o2 instanceof ProcessEntry) {
+ return Integer.compare(((ProcessEntry) o1).fProcessId, ((ProcessEntry) o2).fProcessId);
ProcessEntry processEntry = processEntryMap.get(processQuark);
if (processEntry == null) {
String name = ss.getAttributeName(processQuark.intValue());
ProcessEntry processEntry = processEntryMap.get(processQuark);
if (processEntry == null) {
String name = ss.getAttributeName(processQuark.intValue());
- processEntry = new ProcessEntry(name, start, end);
+ /* The attribute name should already be parseable to integer */
+ int processId = Integer.parseInt(name);
+ processEntry = new ProcessEntry(name, processId, start, end);
processEntryMap.put(processQuark, processEntry);
traceEntry.addChild(processEntry);
} else {
processEntryMap.put(processQuark, processEntry);
traceEntry.addChild(processEntry);
} else {
int level = 1;
for (int stackLevelQuark : ss.getSubAttributes(callStackQuark, false)) {
if (level > threadEntry.getChildren().size()) {
int level = 1;
for (int stackLevelQuark : ss.getSubAttributes(callStackQuark, false)) {
if (level > threadEntry.getChildren().size()) {
- CallStackEntry callStackEntry = new CallStackEntry(threadName, stackLevelQuark, level, trace, ss);
+ int processId = processEntry.getProcessId();
+ CallStackEntry callStackEntry = new CallStackEntry(threadName, stackLevelQuark, level, processId, trace, ss);
threadEntry.addChild(callStackEntry);
}
level++;
threadEntry.addChild(callStackEntry);
}
level++;
}
for (TimeGraphEntry traceEntry : entryList) {
for (ITimeGraphEntry processEntry : traceEntry.getChildren()) {
}
for (TimeGraphEntry traceEntry : entryList) {
for (ITimeGraphEntry processEntry : traceEntry.getChildren()) {
+ /* The entries should all be parseable to an integer. */
+ int pid = Integer.parseInt(processEntry.getName());
+
for (ITimeGraphEntry threadEntry : processEntry.getChildren()) {
ITmfStateSystem ss = ((ThreadEntry) threadEntry).getStateSystem();
if (ss == null) {
for (ITimeGraphEntry threadEntry : processEntry.getChildren()) {
ITmfStateSystem ss = ((ThreadEntry) threadEntry).getStateSystem();
if (ss == null) {
try {
ITmfStateInterval stackLevelInterval = ss.querySingleState(time, callStackEntry.getQuark());
ITmfStateValue nameValue = stackLevelInterval.getStateValue();
try {
ITmfStateInterval stackLevelInterval = ss.querySingleState(time, callStackEntry.getQuark());
ITmfStateValue nameValue = stackLevelInterval.getStateValue();
- String name = getFunctionName(trace, nameValue);
+
+ String name = getFunctionName(trace, pid, time, nameValue);
callStackEntry.setFunctionName(name);
if (name.length() > 0) {
callStackEntry.setFunctionEntryTime(stackLevelInterval.getStartTime());
callStackEntry.setFunctionName(name);
if (name.length() > 0) {
callStackEntry.setFunctionEntryTime(stackLevelInterval.getStartTime());
- String getFunctionName(ITmfTrace trace, ITmfStateValue nameValue) {
+ String getFunctionName(ITmfTrace trace, int processId, long timestamp, ITmfStateValue nameValue) {
long address = Long.MAX_VALUE;
String name = ""; //$NON-NLS-1$
try {
long address = Long.MAX_VALUE;
String name = ""; //$NON-NLS-1$
try {
if (address != Long.MAX_VALUE) {
ISymbolProvider provider = fSymbolProviders.get(trace);
if (provider != null) {
if (address != Long.MAX_VALUE) {
ISymbolProvider provider = fSymbolProviders.get(trace);
if (provider != null) {
- String symbol = provider.getSymbolText(address);
+ String symbol = provider.getSymbolText(processId, timestamp, address);
if (symbol != null) {
name = symbol;
}
if (symbol != null) {
name = symbol;
}