use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.
the class TraceBackend method start.
/**
* Starts tracing given nodes.
*
* @return <code>true</code> if successful, <code>false</code> otherwise
*/
public TracingStatus start() {
TracingStatus status = TracingStatus.OK;
if (!tracing) {
synchronized (this) {
if (!tracing) {
try {
tracing = true;
getBackend(true);
loadingFileInfo = true;
handler = new TraceEventHandler();
tracerBackend.getRuntime().registerEventListener(handler);
// list of nodes being traced
final List<OtpErlangObject> erlangObjects = new ArrayList<>();
notActivatedNodes = new HashSet<>();
for (final TracedNode tracedNode : tracedNodes) {
if (tracedNode.isEnabled()) {
final OtpErlangAtom name = new OtpErlangAtom(tracedNode.getNodeName());
final OtpErlangAtom cookie = new OtpErlangAtom(tracedNode.getCookie());
erlangObjects.add(new OtpErlangTuple(new OtpErlangObject[] { name, cookie }));
notActivatedNodes.add(tracedNode.getNodeName());
}
}
final OtpErlangList nodes = new OtpErlangList(erlangObjects.toArray(new OtpErlangObject[erlangObjects.size()]));
// net tick time
final int tickTimeValue = Activator.getDefault().getPreferenceStore().getInt(PreferenceNames.TICK_TIME);
final OtpErlangInt netTickTime = new OtpErlangInt(tickTimeValue);
final OtpErlangObject callResult = tracerBackend.getOtpRpc().call(Constants.ERLANG_HELPER_MODULE, TraceBackend.FUN_START, "xsi", nodes, Constants.OUTPUT_FILE, netTickTime);
status = processResult(callResult);
if (TracingStatus.OK.equals(status) || TracingStatus.NOT_ALL_NODES_ACTIVATED.equals(status)) {
setProcessFlags();
setFunctionTracePatterns();
for (final ITraceNodeObserver listener : listeners) {
try {
listener.startTracing();
} catch (final Exception e) {
ErlLogger.error(e);
}
}
} else {
tracing = false;
}
} catch (final Exception e) {
ErlLogger.error(e);
status = TracingStatus.EXCEPTION_THROWN;
errorObject = e;
tracing = false;
}
}
}
}
return status;
}
Aggregations