use of org.erlide.tracing.core.mvc.model.treenodes.ITreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processCallTrace.
private ITreeNode processCallTrace(final String label, final OtpErlangTuple tuple) {
final ITreeNode processNode = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.PROCESS_NODE));
final ITreeNode node = createFunctionNode(createNodeLabel(label + ": "), tuple.elementAt(TraceDataHandler.INDEX_FUNCTION));
node.setImage(Activator.getImage(Images.CALL_NODE));
node.addChildren(processNode);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.ITreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processExceptionFrom.
private ITreeNode processExceptionFrom(final String label, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode processNode = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.PROCESS_NODE));
final OtpErlangTuple exceptionTuple = (OtpErlangTuple) tuple.elementAt(TraceDataHandler.INDEX_EXCEPTION);
final OtpErlangObject exceptionClass = exceptionTuple.elementAt(TraceDataHandler.INDEX_EXCEPTION_CLASS);
final OtpErlangObject exceptionValue = exceptionTuple.elementAt(TraceDataHandler.INDEX_EXCEPTION_VALUE);
labelBuilder.append(exceptionClass.toString());
final ITreeNode exceptionClassNode = new TreeNode(exceptionClass.toString(), Activator.getImage(Images.INFO_NODE));
exceptionClassNode.addChildren(new TreeNode(exceptionValue.toString()));
final ITreeNode node = processReturnTrace(labelBuilder.toString(), Images.EXCEPTION_NODE, tuple, false);
node.addChildren(processNode, exceptionClassNode);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.ITreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method createFunctionNode.
private ITreeNode createFunctionNode(final String label, final OtpErlangObject erlangObject) {
final ITreeNode node = new TreeNode();
if (erlangObject instanceof OtpErlangTuple) {
final OtpErlangTuple functionTuple = (OtpErlangTuple) erlangObject;
final OtpErlangAtom moduleName = (OtpErlangAtom) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_MODULE);
final OtpErlangAtom functionName = (OtpErlangAtom) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_NAME);
// args or arity node
final TreeNode argsNode = new TreeNode();
argsNode.setImage(Activator.getImage(Images.INFO_NODE));
final OtpErlangObject arityOrArgs = functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS);
int arityValue = -1;
if (arityOrArgs instanceof OtpErlangList) {
// last element is a list of arguments
final OtpErlangList arguments = (OtpErlangList) arityOrArgs;
final StringBuilder builder = new StringBuilder("arguments: ");
for (int i = 1; i < arguments.arity(); i++) {
builder.append(arguments.elementAt(i)).append(", ");
}
arityValue = arguments.arity() - 1;
argsNode.setLabel(builder.substring(0, builder.length() - 2));
} else {
// last element is arity
try {
if (functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS) instanceof OtpErlangInt) {
arityValue = ((OtpErlangInt) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS)).intValue();
} else {
arityValue = (int) ((OtpErlangLong) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS)).longValue();
}
argsNode.setLabel("arity: " + arityValue);
} catch (final OtpErlangRangeException e) {
ErlLogger.error(e);
}
}
// module name node
final TreeNode moduleNameNode = new ModuleNode(moduleName.atomValue());
moduleNameNode.setLabel("module: " + moduleName);
// function name node
final TreeNode functionNameNode = new FunctionNode(moduleName.atomValue(), functionName.atomValue(), arityValue);
functionNameNode.setLabel("function: " + functionName);
node.addChildren(moduleNameNode, functionNameNode, argsNode);
lastFunctionDescription = label + moduleName + ":" + functionName + "/" + arityValue;
} else {
lastFunctionDescription = "unknown";
}
node.setLabel(lastFunctionDescription);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.ITreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processRegisterTrace.
private ITreeNode processRegisterTrace(final String label, final Images image, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode process = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
process.setImage(Activator.getImage(Images.REGISTER_NODE));
labelBuilder.append(lastProcessDescription).append("->");
final TreeNode regName = new TreeNode("name: " + tuple.elementAt(TraceDataHandler.INDEX_REGNAME).toString(), Activator.getImage(Images.INFO_NODE));
labelBuilder.append(regName);
final ITreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()), Activator.getImage(image));
node.addChildren(process, regName);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.ITreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processGcTrace.
// functions processing different trace types
private ITreeNode processGcTrace(final String label, final Images image, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode processNode = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.PROCESS_NODE));
labelBuilder.append(lastProcessDescription);
final ITreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()), Activator.getImage(image));
node.addChildren(processNode);
final OtpErlangList list = (OtpErlangList) tuple.elementAt(TraceDataHandler.INDEX_INFO);
for (final OtpErlangObject otpErlangObject : list) {
final OtpErlangTuple infoTuple = (OtpErlangTuple) otpErlangObject;
final OtpErlangObject key = infoTuple.elementAt(0);
final OtpErlangObject value = infoTuple.elementAt(1);
final TreeNode treeNode = new TreeNode(key.toString() + ": " + value.toString());
treeNode.setImage(Activator.getImage(Images.INFO_NODE));
node.addChildren(treeNode);
}
return node;
}
Aggregations