private final int fQuark;
private final int fStackLevel;
+ private final int fProcessId;
private final ITmfTrace fTrace;
private String fFunctionName;
private long fFunctionEntryTime;
* 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) {
* 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)}
*/
+ @Deprecated
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;
return fStackLevel;
}
+ /**
+ * 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.
*
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$
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);
}
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);
+ fProcessId = processId;
+ }
+
+ public int getProcessId() {
+ return fProcessId;
}
@Override
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);
}
return 0;
}
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 {
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++;
}
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) {
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());
}
}
- 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 {
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;
}