Example #1
0
 public synchronized void removeTracePattern(final TracePattern pattern) {
   tracePatterns.remove(pattern);
   for (final ITraceNodeObserver listener : listeners) {
     try {
       listener.updateTracePatterns();
     } catch (final Exception e) {
       ErlLogger.error(e);
     }
   }
 }
Example #2
0
 public void loadTracePatterns(final TracePattern[] patterns) {
   tracePatterns.clear();
   tracePatterns.addAll(Arrays.asList(patterns));
   for (final ITraceNodeObserver listener : listeners) {
     try {
       listener.updateTracePatterns();
     } catch (final Exception e) {
       ErlLogger.error(e);
     }
   }
 }
Example #3
0
 /**
  * Removes selected tracing result from list.
  *
  * @param tracingResult tracing result to be removed
  */
 public synchronized void removeTracingResult(final TracingResultsNode tracingResult) {
   activeResultSet = null;
   TraceCollections.getFilesList().remove(tracingResult);
   TraceCollections.getTracesList().clear();
   for (final ITraceNodeObserver listener : listeners) {
     try {
       listener.removeFile();
     } catch (final Exception e) {
       ErlLogger.error(e);
     }
   }
 }
Example #4
0
 /**
  * Performs actions after loading file or trace data.
  *
  * @param status status
  */
 private void finishLoading(final TracingStatus status) {
   tracerBackend.getEventDaemon().removeHandler(handler);
   for (final ITraceNodeObserver listener : listeners) {
     try {
       if (loadingFileInfo) {
         listener.finishLoadingFile(status);
       } else {
         listener.finishLoadingTraces(status);
       }
     } catch (final Exception e) {
       ErlLogger.error(e);
     }
   }
   loading = false;
   tracing = false;
 }
Example #5
0
  /**
   * 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.getEventDaemon().addHandler(handler);

            // list of nodes being traced
            final List<OtpErlangObject> erlangObjects = new ArrayList<OtpErlangObject>();
            notActivatedNodes = new HashSet<String>();
            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.call(
                    Constants.ERLANG_HELPER_MODULE,
                    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) {
            e.printStackTrace();
            ErlLogger.error("Could not start tracing tool: " + e.getMessage());
            status = TracingStatus.EXCEPTION_THROWN;
            errorObject = e;
            tracing = false;
          }
        }
      }
    }
    return status;
  }