Ejemplo n.º 1
0
  /**
   * Initialization of an experiment, taking the type, path, traces, indexPageSize and resource
   *
   * @param type the event type
   * @param path the experiment path
   * @param traces the experiment set of traces
   * @param indexPageSize the experiment index page size
   * @param resource the resource associated to the experiment
   * @since 3.0
   */
  public void initExperiment(
      final Class<? extends ITmfEvent> type,
      final String path,
      final ITmfTrace[] traces,
      final int indexPageSize,
      IResource resource) {
    setCacheSize(indexPageSize);
    setStreamingInterval(0);
    setParser(this);
    // traces have to be set before super.initialize()
    fTraces = traces;
    try {
      super.initialize(resource, path, type);
    } catch (TmfTraceException e) {
      Activator.logError("Error initializing experiment", e); // $NON-NLS-1$
    }

    if (resource != null) {
      try {
        this.synchronizeTraces();
      } catch (TmfTraceException e) {
        Activator.logError("Error synchronizing experiment", e); // $NON-NLS-1$
      }
    }
  }
Ejemplo n.º 2
0
  /** @since 3.0 */
  @Override
  public void setTimestampTransform(final ITmfTimestampTransform tt) {
    fTsTransform = tt;

    /* Save the timestamp transform to a file */
    File sync_file = getSyncFormulaFile();
    if (sync_file != null) {
      if (sync_file.exists()) {
        sync_file.delete();
      }
      FileOutputStream fos;
      ObjectOutputStream oos;

      /* Save the header of the file */
      try {
        fos = new FileOutputStream(sync_file, false);
        oos = new ObjectOutputStream(fos);

        oos.writeObject(fTsTransform);
        oos.close();
        fos.close();
      } catch (IOException e1) {
        Activator.logError("Error writing timestamp transform for trace", e1); // $NON-NLS-1$
      }
    }
  }
Ejemplo n.º 3
0
  @Override
  @TmfSignalHandler
  public void traceOpened(TmfTraceOpenedSignal signal) {
    if (signal.getTrace() == this) {
      initializeStreamingMonitor();

      /* Initialize the analysis */
      MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
      status.add(executeAnalysis());
      if (!status.isOK()) {
        Activator.log(status);
      }
      TmfTraceManager.refreshSupplementaryFiles(this);
    }
  }
Ejemplo n.º 4
0
  /**
   * Handler for the Trace Opened signal
   *
   * @param signal The incoming signal
   * @since 2.0
   */
  @TmfSignalHandler
  public void traceOpened(TmfTraceOpenedSignal signal) {
    boolean signalIsForUs = false;
    for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
      if (trace == this) {
        signalIsForUs = true;
        break;
      }
    }

    if (!signalIsForUs) {
      return;
    }

    /*
     * The signal is either for this trace, or for an experiment containing
     * this trace.
     */
    IStatus status = executeAnalysis();
    if (!status.isOK()) {
      Activator.log(status);
    }

    TmfTraceManager.refreshSupplementaryFiles(this);

    if (signal.getTrace() == this) {
      /* Additionally, the signal is directly for this trace. */
      if (getNbEvents() == 0) {
        return;
      }

      /* For a streaming trace, the range updated signal should be sent
       * by the subclass when a new safe time is determined.
       */
      if (getStreamingInterval() > 0) {
        return;
      }

      final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH);
      final TmfTraceRangeUpdatedSignal rangeUpdatedsignal =
          new TmfTraceRangeUpdatedSignal(this, this, timeRange);

      // Broadcast in separate thread to prevent deadlock
      broadcastAsync(rangeUpdatedsignal);
      return;
    }
  }