Exemple #1
0
 private void setFunctionTracePatterns() {
   for (final TracePattern tracePattern : tracePatterns) {
     if (tracePattern.isEnabled()) {
       final String function = tracePattern.isLocal() ? FUN_TPL : FUN_TP;
       try {
         OtpErlangObject matchSpec = null;
         if (tracePattern.getMatchSpec().getMsObject() != null) {
           matchSpec = tracePattern.getMatchSpec().getMsObject();
         } else {
           matchSpec = new OtpErlangList();
         }
         if (tracePattern.getArity() < 0) {
           tracerBackend.call(
               Constants.TTB_MODULE,
               function,
               "aax",
               tracePattern.getModuleName(),
               tracePattern.getFunctionName(),
               matchSpec);
         } else {
           tracerBackend.call(
               Constants.TTB_MODULE,
               function,
               "aaxx",
               tracePattern.getModuleName(),
               tracePattern.getFunctionName(),
               new OtpErlangInt(tracePattern.getArity()),
               matchSpec);
         }
       } catch (final RpcException e) {
         ErlLogger.error("Could not add pattern: " + e.getMessage());
       }
     }
   }
 }
Exemple #2
0
 /** Stops tracing. */
 public void stop() {
   if (tracing && !loading) {
     synchronized (this) {
       if (tracing && !loading) {
         try {
           loading = true;
           tracerBackend.call(Constants.ERLANG_HELPER_MODULE, FUN_STOP, "");
         } catch (final RpcException e) {
           ErlLogger.error("Could not stop tracing tool: " + e.getMessage());
           errorObject = e;
           finishLoading(TracingStatus.EXCEPTION_THROWN);
         }
       }
     }
   }
 }