import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.tracecompass.tmf.core.signal.TmfTimeSynchSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsTable;
/**
import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
import org.junit.BeforeClass;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.tests.stubs.analysis.TestExperimentAnalysis;
import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfExperimentStub;
import org.junit.After;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentContext;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentLocation;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentContext;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentLocation;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
import org.eclipse.tracecompass.tmf.core.trace.location.TmfLongLocation;
import org.eclipse.tracecompass.tmf.tests.stubs.analysis.TestExperimentAnalysis;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentContext;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentContext;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
import java.nio.ByteBuffer;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentLocation;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfLocationArray;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentLocation;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfLocationArray;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
import org.eclipse.tracecompass.tmf.core.trace.location.TmfLocation;
import org.eclipse.core.resources.IResource;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
/**
org.eclipse.tracecompass.internal.tmf.core.statesystem.mipmap;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.synchronization;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.synchronization.graph;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
- org.eclipse.tracecompass.internal.tmf.core.trace;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
+ org.eclipse.tracecompass.internal.tmf.core.trace.experiment;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.internal.tmf.core.trace.indexer;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.core.analysis,
org.eclipse.tracecompass.tmf.core.synchronization,
org.eclipse.tracecompass.tmf.core.timestamp,
org.eclipse.tracecompass.tmf.core.trace,
+ org.eclipse.tracecompass.tmf.core.trace.experiment,
org.eclipse.tracecompass.tmf.core.trace.indexer,
org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint,
org.eclipse.tracecompass.tmf.core.trace.location,
</tracetype>
<tracetype
applies="false"
- class="org.eclipse.tracecompass.tmf.core.trace.TmfExperiment">
+ class="org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment">
</tracetype>
</module>
</extension>
<experiment
id="org.eclipse.linuxtools.tmf.core.experiment.generic"
name="%experimenttype.type.generic"
- experiment_type="org.eclipse.tracecompass.tmf.core.trace.TmfExperiment">
+ experiment_type="org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment">
</experiment>
</extension>
</plugin>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.core.trace;
-
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
-
-/**
- * <b><u>TmfExperimentCheckpoint</u></b>
- * <p>
- * TODO: Implement me. Please.
- */
-public class TmfExperimentCheckpoint implements Comparable<TmfExperimentCheckpoint> {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final TmfTimestamp fTimestamp;
- private final long[] fRanks;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * @param ts the checkpoint timestamp
- * @param contexts the corresponding set of trace contexts
- */
- public TmfExperimentCheckpoint(final TmfTimestamp ts, final TmfContext[] contexts) {
- fTimestamp = ts;
- fRanks = new long[contexts.length];
- for (int i = 0; i < fRanks.length; i++) {
- fRanks[i] = contexts[i].getRank();
- }
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * @return the checkpoint event timestamp
- */
- public TmfTimestamp getTimestamp() {
- return fTimestamp;
- }
-
- /**
- * @return the checkpoint event rank
- */
- public long[] getRanks() {
- return fRanks;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- int result = 37;
- result = 17 * result + fTimestamp.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof TmfExperimentCheckpoint)) {
- return false;
- }
- final TmfExperimentCheckpoint o = (TmfExperimentCheckpoint) other;
- return fTimestamp.equals(o.fTimestamp);
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- public int compareTo(final TmfExperimentCheckpoint other) {
- return fTimestamp.compareTo(other.fTimestamp);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Put in shape for 1.0
- * Patrick Tasse - Updated for removal of context clone
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.core.trace;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
-
-/**
- * The experiment context in TMF.
- * <p>
- * The experiment keeps track of the next event from each of its traces so it
- * can pick the next one in chronological order.
- * <p>
- * This implies that the "next" event from each trace has already been
- * read and that we at least know its timestamp.
- * <p>
- * The last trace refers to the trace from which the last event was "consumed"
- * at the experiment level.
- */
-public final class TmfExperimentContext extends TmfContext {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * No last trace read indicator
- */
- public static final int NO_TRACE = -1;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final List<ITmfContext> fContexts;
- private final List<ITmfEvent> fEvents;
- private int fLastTraceRead;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Standard constructor
- *
- * @param nbTraces
- * The number of traces in the experiment
- */
- public TmfExperimentContext(final int nbTraces) {
- super();
- fLastTraceRead = NO_TRACE;
- fContexts = new ArrayList<>(nbTraces);
- fEvents = new ArrayList<>(nbTraces);
-
-
- /* Initialize the arrays to the requested size */
- for (int i = 0; i < nbTraces; i++) {
- fContexts.add(null);
- fEvents.add(null);
- }
- }
-
- @Override
- public void dispose() {
- for (ITmfContext context : fContexts) {
- context.dispose();
- }
- super.dispose();
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Return how many traces this experiment context tracks the contexts of
- * (a.k.a., the number of traces in the experiment).
- *
- * @return The number of traces in the experiment
- */
- public int getNbTraces() {
- return fContexts.size();
- }
-
- /**
- * Get the current context of a specific trace
- *
- * @param traceIndex
- * The index of the trace in the experiment
- * @return The matching context object for that trace
- */
- @Nullable
- public ITmfContext getContext(int traceIndex) {
- return fContexts.get(traceIndex);
- }
-
- /**
- * Set the context of a trace
- *
- * @param traceIndex
- * The index of the trace in the experiment
- * @param ctx
- * The new context object for that trace
- */
- public void setContext(int traceIndex, ITmfContext ctx) {
- fContexts.set(traceIndex, ctx);
- }
-
- /**
- * Get the current event for a specific trace in the experiment.
- *
- * @param traceIndex
- * The index of the trace in the experiment
- * @return The event matching the trace/context
- *
- */
- @Nullable
- public ITmfEvent getEvent(int traceIndex) {
- return fEvents.get(traceIndex);
- }
-
- /**
- * Set the context's event for a specific trace
- *
- * @param traceIndex
- * The index of the trace in the experiment
- * @param event
- * The event at the context in the trace
- */
- public void setEvent(int traceIndex, ITmfEvent event) {
- fEvents.set(traceIndex, event);
- }
-
- /**
- * Get the index of the trace that was last read (so the trace whose
- * current context will match this experiment's).
- *
- * @return The index of the trace
- */
- public int getLastTrace() {
- return fLastTraceRead;
- }
-
- /**
- * Set the last trace read index
- *
- * @param newIndex
- * The new value to assign
- */
- public void setLastTrace(final int newIndex) {
- fLastTraceRead = newIndex;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- int result = 17;
- for (int i = 0; i < fContexts.size(); i++) {
- result = 37 * result + fContexts.get(i).hashCode();
- }
- return result;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (this == other) {
- return true;
- }
- if (!super.equals(other)) {
- return false;
- }
- if (!(other instanceof TmfExperimentContext)) {
- return false;
- }
- final TmfExperimentContext o = (TmfExperimentContext) other;
- boolean isEqual = true;
- int i = 0;
- while (isEqual && (i < fContexts.size())) {
- isEqual &= fContexts.get(i).equals(o.fContexts.get(i));
- i++;
- }
- return isEqual;
- }
-
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- StringBuilder sb = new StringBuilder("TmfExperimentContext [\n");
- sb.append("\tfLocation=" + getLocation() + ", fRank=" + getRank() + "\n");
- sb.append("\tfContexts=[");
- for (int i = 0; i < fContexts.size(); i++) {
- sb.append("(" + fContexts.get(i).getLocation() + "," + fContexts.get(i).getRank() + ((i < fContexts.size() - 1) ? ")," : ")]\n"));
- }
- sb.append("\tfEvents=[");
- for (int i = 0; i < fEvents.size(); i++) {
- ITmfEvent event = fEvents.get(i);
- sb.append(((event != null) ? fEvents.get(i).getTimestamp() : "(null)") + ((i < fEvents.size() - 1) ? "," : "]\n"));
- }
- sb.append("\tfLastTraceRead=" + fLastTraceRead + "\n");
- sb.append("]");
- return sb.toString();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Trace Model 1.0
- * Patrick Tasse - Updated for ranks in experiment location
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.core.trace;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-
-
-/**
- * The experiment location in TMF.
- * <p>
- * An experiment location is actually the set of locations of the traces it
- * contains. By setting the individual traces to their corresponding locations,
- * the experiment can be positioned to read the next chronological event.
- * <p>
- * It is the responsibility of the user the individual trace locations are valid
- * and that they are matched to the correct trace.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see TmfLocationArray
- */
-public final class TmfExperimentLocation implements ITmfLocation {
-
- private final TmfLocationArray fLocation;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The standard constructor
- *
- * @param locations the set of trace locations
- */
- public TmfExperimentLocation(TmfLocationArray locations) {
- fLocation = locations;
- }
-
- /**
- * The copy constructor
- *
- * @param location the other experiment location
- */
- public TmfExperimentLocation(TmfExperimentLocation location) {
- this(location.getLocationInfo());
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- StringBuilder result = new StringBuilder("TmfExperimentLocation [");
- result.append(fLocation.toString());
- result.append("]");
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLocation != null) ? fLocation.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TmfExperimentLocation other = (TmfExperimentLocation) obj;
- if (fLocation == null) {
- if (other.fLocation != null) {
- return false;
- }
- } else if (!fLocation.equals(other.fLocation)) {
- return false;
- }
- return true;
- }
-
- @Override
- public TmfLocationArray getLocationInfo() {
- return fLocation;
- }
-
- @Override
- public void serialize(ByteBuffer bufferOut) {
- ITmfLocation[] locations = fLocation.getLocations();
- long[] ranks = fLocation.getRanks();
- for (int i = 0; i < locations.length; ++i) {
- locations[i].serialize(bufferOut);
- bufferOut.putLong(ranks[i]);
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tasse - Initial API and implementation
- * Francois Chouinard - Put in shape for 1.0
- * Patrick Tasse - Updated for ranks in experiment location
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.core.trace;
-
-import java.util.Arrays;
-
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-
-
-/**
- * A convenience class to store trace location arrays. The main purpose is to
- * provide an immutable and Comparable implementation for TmfExperimentLocation.
- *
- * @version 1.0
- * @author Patrick Tasse
- */
-public final class TmfLocationArray implements Comparable<TmfLocationArray> {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final ITmfLocation[] fLocations;
- private final long [] fRanks;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The standard constructor.
- *
- * @param locations the locations
- * @param ranks the ranks
- */
- public TmfLocationArray(ITmfLocation[] locations, long[] ranks) {
- fLocations = Arrays.copyOf(locations, locations.length);
- fRanks = Arrays.copyOf(ranks, ranks.length);
- }
-
- /**
- * The update constructor. Copies the arrays and updates a single entry.
- *
- * @param locationArray the location array
- * @param index the updated index
- * @param location the updated location
- * @param rank the updated rank
- */
- public TmfLocationArray(TmfLocationArray locationArray, int index, ITmfLocation location, long rank) {
- fLocations = Arrays.copyOf(locationArray.fLocations, locationArray.fLocations.length);
- fLocations[index] = location;
- fRanks = Arrays.copyOf(locationArray.fRanks, locationArray.fRanks.length);
- fRanks[index] = rank;
- }
-
- /**
- * The empty constructor.
- *
- * @param size the number of elements in the array
- */
- public TmfLocationArray(int size) {
- fLocations = new ITmfLocation[size];
- fRanks = new long[size];
- }
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * Returns the number of elements in this array.
- *
- * @return the number of elements in this array
- */
- public int size() {
- return fLocations.length;
- }
-
- /**
- * Get the locations inside this array.
- *
- * @return a copy of the locations array
- */
- public ITmfLocation[] getLocations() {
- return Arrays.copyOf(fLocations, fLocations.length);
- }
-
- /**
- * Get a specific location
- *
- * @param index the location element
- *
- * @return the specific location (possibly null)
- */
- public ITmfLocation getLocation(int index) {
- if (index >= 0 && index < fLocations.length) {
- return fLocations[index];
- }
- return null;
- }
-
- /**
- * Get the ranks inside this array.
- *
- * @return a copy of the ranks array
- */
- public long[] getRanks() {
- return Arrays.copyOf(fRanks, fRanks.length);
- }
-
- /**
- * Get a specific rank
- *
- * @param index the rank element
- *
- * @return the specific rank
- */
- public long getRank(int index) {
- if (index >= 0 && index < fRanks.length) {
- return fRanks[index];
- }
- return 0;
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- public int compareTo(TmfLocationArray o) {
- for (int i = 0; i < fRanks.length; i++) {
- long rank1 = fRanks[i];
- long rank2 = o.fRanks[i];
- if (rank1 < rank2) {
- return -1;
- } else if (rank1 > rank2) {
- return 1;
- }
- }
- return 0;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(fLocations);
- result = prime * result + Arrays.hashCode(fRanks);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TmfLocationArray other = (TmfLocationArray) obj;
- if (!Arrays.equals(fLocations, other.fLocations)) {
- return false;
- }
- if (!Arrays.equals(fRanks, other.fRanks)) {
- return false;
- }
- return true;
- }
-
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(getClass().getSimpleName() + " [");
- for (int i = 0; i < fLocations.length; i++) {
- if (i > 0) {
- sb.append(", ");
- }
- sb.append("[location=" + fLocations[i] + ",rank=" + fRanks[i] + "]");
- }
- sb.append("]");
- return sb.toString();
- }
-
-}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.trace.experiment;
+
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
+
+/**
+ * <b><u>TmfExperimentCheckpoint</u></b>
+ * <p>
+ * TODO: Implement me. Please.
+ */
+public class TmfExperimentCheckpoint implements Comparable<TmfExperimentCheckpoint> {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final TmfTimestamp fTimestamp;
+ private final long[] fRanks;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * @param ts the checkpoint timestamp
+ * @param contexts the corresponding set of trace contexts
+ */
+ public TmfExperimentCheckpoint(final TmfTimestamp ts, final TmfContext[] contexts) {
+ fTimestamp = ts;
+ fRanks = new long[contexts.length];
+ for (int i = 0; i < fRanks.length; i++) {
+ fRanks[i] = contexts[i].getRank();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the checkpoint event timestamp
+ */
+ public TmfTimestamp getTimestamp() {
+ return fTimestamp;
+ }
+
+ /**
+ * @return the checkpoint event rank
+ */
+ public long[] getRanks() {
+ return fRanks;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ int result = 37;
+ result = 17 * result + fTimestamp.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof TmfExperimentCheckpoint)) {
+ return false;
+ }
+ final TmfExperimentCheckpoint o = (TmfExperimentCheckpoint) other;
+ return fTimestamp.equals(o.fTimestamp);
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int compareTo(final TmfExperimentCheckpoint other) {
+ return fTimestamp.compareTo(other.fTimestamp);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Put in shape for 1.0
+ * Patrick Tasse - Updated for removal of context clone
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.trace.experiment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
+
+/**
+ * The experiment context in TMF.
+ * <p>
+ * The experiment keeps track of the next event from each of its traces so it
+ * can pick the next one in chronological order.
+ * <p>
+ * This implies that the "next" event from each trace has already been
+ * read and that we at least know its timestamp.
+ * <p>
+ * The last trace refers to the trace from which the last event was "consumed"
+ * at the experiment level.
+ */
+public final class TmfExperimentContext extends TmfContext {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * No last trace read indicator
+ */
+ public static final int NO_TRACE = -1;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final List<ITmfContext> fContexts;
+ private final List<ITmfEvent> fEvents;
+ private int fLastTraceRead;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Standard constructor
+ *
+ * @param nbTraces
+ * The number of traces in the experiment
+ */
+ public TmfExperimentContext(final int nbTraces) {
+ super();
+ fLastTraceRead = NO_TRACE;
+ fContexts = new ArrayList<>(nbTraces);
+ fEvents = new ArrayList<>(nbTraces);
+
+
+ /* Initialize the arrays to the requested size */
+ for (int i = 0; i < nbTraces; i++) {
+ fContexts.add(null);
+ fEvents.add(null);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ for (ITmfContext context : fContexts) {
+ context.dispose();
+ }
+ super.dispose();
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return how many traces this experiment context tracks the contexts of
+ * (a.k.a., the number of traces in the experiment).
+ *
+ * @return The number of traces in the experiment
+ */
+ public int getNbTraces() {
+ return fContexts.size();
+ }
+
+ /**
+ * Get the current context of a specific trace
+ *
+ * @param traceIndex
+ * The index of the trace in the experiment
+ * @return The matching context object for that trace
+ */
+ @Nullable
+ public ITmfContext getContext(int traceIndex) {
+ return fContexts.get(traceIndex);
+ }
+
+ /**
+ * Set the context of a trace
+ *
+ * @param traceIndex
+ * The index of the trace in the experiment
+ * @param ctx
+ * The new context object for that trace
+ */
+ public void setContext(int traceIndex, ITmfContext ctx) {
+ fContexts.set(traceIndex, ctx);
+ }
+
+ /**
+ * Get the current event for a specific trace in the experiment.
+ *
+ * @param traceIndex
+ * The index of the trace in the experiment
+ * @return The event matching the trace/context
+ *
+ */
+ @Nullable
+ public ITmfEvent getEvent(int traceIndex) {
+ return fEvents.get(traceIndex);
+ }
+
+ /**
+ * Set the context's event for a specific trace
+ *
+ * @param traceIndex
+ * The index of the trace in the experiment
+ * @param event
+ * The event at the context in the trace
+ */
+ public void setEvent(int traceIndex, ITmfEvent event) {
+ fEvents.set(traceIndex, event);
+ }
+
+ /**
+ * Get the index of the trace that was last read (so the trace whose
+ * current context will match this experiment's).
+ *
+ * @return The index of the trace
+ */
+ public int getLastTrace() {
+ return fLastTraceRead;
+ }
+
+ /**
+ * Set the last trace read index
+ *
+ * @param newIndex
+ * The new value to assign
+ */
+ public void setLastTrace(final int newIndex) {
+ fLastTraceRead = newIndex;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ for (int i = 0; i < fContexts.size(); i++) {
+ result = 37 * result + fContexts.get(i).hashCode();
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!super.equals(other)) {
+ return false;
+ }
+ if (!(other instanceof TmfExperimentContext)) {
+ return false;
+ }
+ final TmfExperimentContext o = (TmfExperimentContext) other;
+ boolean isEqual = true;
+ int i = 0;
+ while (isEqual && (i < fContexts.size())) {
+ isEqual &= fContexts.get(i).equals(o.fContexts.get(i));
+ i++;
+ }
+ return isEqual;
+ }
+
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TmfExperimentContext [\n");
+ sb.append("\tfLocation=" + getLocation() + ", fRank=" + getRank() + "\n");
+ sb.append("\tfContexts=[");
+ for (int i = 0; i < fContexts.size(); i++) {
+ sb.append("(" + fContexts.get(i).getLocation() + "," + fContexts.get(i).getRank() + ((i < fContexts.size() - 1) ? ")," : ")]\n"));
+ }
+ sb.append("\tfEvents=[");
+ for (int i = 0; i < fEvents.size(); i++) {
+ ITmfEvent event = fEvents.get(i);
+ sb.append(((event != null) ? fEvents.get(i).getTimestamp() : "(null)") + ((i < fEvents.size() - 1) ? "," : "]\n"));
+ }
+ sb.append("\tfLastTraceRead=" + fLastTraceRead + "\n");
+ sb.append("]");
+ return sb.toString();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Trace Model 1.0
+ * Patrick Tasse - Updated for ranks in experiment location
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.trace.experiment;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+
+
+/**
+ * The experiment location in TMF.
+ * <p>
+ * An experiment location is actually the set of locations of the traces it
+ * contains. By setting the individual traces to their corresponding locations,
+ * the experiment can be positioned to read the next chronological event.
+ * <p>
+ * It is the responsibility of the user the individual trace locations are valid
+ * and that they are matched to the correct trace.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ * @see TmfLocationArray
+ */
+public final class TmfExperimentLocation implements ITmfLocation {
+
+ private final TmfLocationArray fLocation;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The standard constructor
+ *
+ * @param locations the set of trace locations
+ */
+ public TmfExperimentLocation(TmfLocationArray locations) {
+ fLocation = locations;
+ }
+
+ /**
+ * The copy constructor
+ *
+ * @param location the other experiment location
+ */
+ public TmfExperimentLocation(TmfExperimentLocation location) {
+ this(location.getLocationInfo());
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder result = new StringBuilder("TmfExperimentLocation [");
+ result.append(fLocation.toString());
+ result.append("]");
+ return result.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fLocation != null) ? fLocation.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TmfExperimentLocation other = (TmfExperimentLocation) obj;
+ if (fLocation == null) {
+ if (other.fLocation != null) {
+ return false;
+ }
+ } else if (!fLocation.equals(other.fLocation)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public TmfLocationArray getLocationInfo() {
+ return fLocation;
+ }
+
+ @Override
+ public void serialize(ByteBuffer bufferOut) {
+ ITmfLocation[] locations = fLocation.getLocations();
+ long[] ranks = fLocation.getRanks();
+ for (int i = 0; i < locations.length; ++i) {
+ locations[i].serialize(bufferOut);
+ bufferOut.putLong(ranks[i]);
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tasse - Initial API and implementation
+ * Francois Chouinard - Put in shape for 1.0
+ * Patrick Tasse - Updated for ranks in experiment location
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.trace.experiment;
+
+import java.util.Arrays;
+
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+
+
+/**
+ * A convenience class to store trace location arrays. The main purpose is to
+ * provide an immutable and Comparable implementation for TmfExperimentLocation.
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ */
+public final class TmfLocationArray implements Comparable<TmfLocationArray> {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final ITmfLocation[] fLocations;
+ private final long [] fRanks;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The standard constructor.
+ *
+ * @param locations the locations
+ * @param ranks the ranks
+ */
+ public TmfLocationArray(ITmfLocation[] locations, long[] ranks) {
+ fLocations = Arrays.copyOf(locations, locations.length);
+ fRanks = Arrays.copyOf(ranks, ranks.length);
+ }
+
+ /**
+ * The update constructor. Copies the arrays and updates a single entry.
+ *
+ * @param locationArray the location array
+ * @param index the updated index
+ * @param location the updated location
+ * @param rank the updated rank
+ */
+ public TmfLocationArray(TmfLocationArray locationArray, int index, ITmfLocation location, long rank) {
+ fLocations = Arrays.copyOf(locationArray.fLocations, locationArray.fLocations.length);
+ fLocations[index] = location;
+ fRanks = Arrays.copyOf(locationArray.fRanks, locationArray.fRanks.length);
+ fRanks[index] = rank;
+ }
+
+ /**
+ * The empty constructor.
+ *
+ * @param size the number of elements in the array
+ */
+ public TmfLocationArray(int size) {
+ fLocations = new ITmfLocation[size];
+ fRanks = new long[size];
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the number of elements in this array.
+ *
+ * @return the number of elements in this array
+ */
+ public int size() {
+ return fLocations.length;
+ }
+
+ /**
+ * Get the locations inside this array.
+ *
+ * @return a copy of the locations array
+ */
+ public ITmfLocation[] getLocations() {
+ return Arrays.copyOf(fLocations, fLocations.length);
+ }
+
+ /**
+ * Get a specific location
+ *
+ * @param index the location element
+ *
+ * @return the specific location (possibly null)
+ */
+ public ITmfLocation getLocation(int index) {
+ if (index >= 0 && index < fLocations.length) {
+ return fLocations[index];
+ }
+ return null;
+ }
+
+ /**
+ * Get the ranks inside this array.
+ *
+ * @return a copy of the ranks array
+ */
+ public long[] getRanks() {
+ return Arrays.copyOf(fRanks, fRanks.length);
+ }
+
+ /**
+ * Get a specific rank
+ *
+ * @param index the rank element
+ *
+ * @return the specific rank
+ */
+ public long getRank(int index) {
+ if (index >= 0 && index < fRanks.length) {
+ return fRanks[index];
+ }
+ return 0;
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int compareTo(TmfLocationArray o) {
+ for (int i = 0; i < fRanks.length; i++) {
+ long rank1 = fRanks[i];
+ long rank2 = o.fRanks[i];
+ if (rank1 < rank2) {
+ return -1;
+ } else if (rank1 > rank2) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(fLocations);
+ result = prime * result + Arrays.hashCode(fRanks);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ TmfLocationArray other = (TmfLocationArray) obj;
+ if (!Arrays.equals(fLocations, other.fLocations)) {
+ return false;
+ }
+ if (!Arrays.equals(fRanks, other.fRanks)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(getClass().getSimpleName() + " [");
+ for (int i = 0; i < fLocations.length; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append("[location=" + fLocations[i] + ",rank=" + fRanks[i] + "]");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+}
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceCompleteness;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
/**
* Abstract analysis module to generate a state system. It is a base class that
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2014 Ericsson, École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Trace Model 1.0
- * Patrick Tasse - Updated for removal of context clone
- * Patrick Tasse - Updated for ranks in experiment location
- * Geneviève Bastien - Added support of experiment synchronization
- * Added the initExperiment method and default constructor
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.core.trace;
-
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.tmf.core.Activator;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentContext;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfExperimentLocation;
-import org.eclipse.tracecompass.internal.tmf.core.trace.TmfLocationArray;
-import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSynchronizedSignal;
-import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
-import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationManager;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-
-/**
- * TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
- * that are part of a tracing experiment.
- *
- * @version 1.0
- * @author Francois Chouinard
- */
-public class TmfExperiment extends TmfTrace implements ITmfEventParser, ITmfPersistentlyIndexable {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * The file name of the Synchronization
- *
- * @since 3.0
- * @deprecated This file name shouldn't be used directly anymore. All
- * synchronization files have been moved to a folder and you
- * should use the {@link #getSynchronizationFolder(boolean)}
- * method to return the path to this folder.
- */
- @Deprecated
- public static final String SYNCHRONIZATION_FILE_NAME = "synchronization.bin"; //$NON-NLS-1$
-
- /**
- * The name of the directory containing trace synchronization data. This
- * directory typically will be preserved when traces are synchronized.
- * Analysis involved in synchronization can put their supplementary files in
- * there so they are not deleted when synchronized traces are copied.
- */
- private static final String SYNCHRONIZATION_DIRECTORY = "sync_data"; //$NON-NLS-1$
-
- /**
- * The default index page size
- */
- public static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The set of traces that constitute the experiment
- */
- protected ITmfTrace[] fTraces;
-
- /**
- * The set of traces that constitute the experiment
- */
- private boolean fInitialized = false;
-
-
- // ------------------------------------------------------------------------
- // Construction
- // ------------------------------------------------------------------------
-
- /**
- * Default constructor. Should not be used directly, but is needed for
- * extension points.
- *
- * @deprecated Do not call this directly (but do not remove it either!)
- */
- @Deprecated
- public TmfExperiment() {
- super();
- }
-
- /**
- * Constructor 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. You can use
- * {@link TmfExperiment#DEFAULT_INDEX_PAGE_SIZE} for a default
- * value.
- * @param resource
- * The resource associated to the experiment. You can use 'null'
- * for no resources (tests, etc.)
- */
- public TmfExperiment(final Class<? extends ITmfEvent> type,
- final String path,
- final ITmfTrace[] traces,
- final int indexPageSize,
- final @Nullable IResource resource) {
- initExperiment(type, path, traces, indexPageSize, resource);
- }
-
- @Override
- protected ITmfTraceIndexer createIndexer(int interval) {
- if (getCheckpointSize() > 0) {
- return new TmfBTreeTraceIndexer(this, interval);
- }
- return super.createIndexer(interval);
- }
-
- /**
- * Clears the experiment
- */
- @Override
- public synchronized void dispose() {
-
- // Clean up the index if applicable
- if (getIndexer() != null) {
- getIndexer().dispose();
- }
-
- if (fTraces != null) {
- for (final ITmfTrace trace : fTraces) {
- trace.dispose();
- }
- fTraces = null;
- }
- super.dispose();
- }
-
- // ------------------------------------------------------------------------
- // ITmfTrace - Initializers
- // ------------------------------------------------------------------------
-
- @Override
- public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) {
- /* Do nothing for experiments */
- }
-
- /**
- * 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,
- final @Nullable 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) {
- this.synchronizeTraces();
- }
- }
-
- /**
- * @since 2.0
- */
- @Override
- public IStatus validate(final IProject project, final String path) {
- return Status.OK_STATUS;
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Get the traces contained in this experiment.
- *
- * @return The array of contained traces
- */
- public ITmfTrace[] getTraces() {
- return fTraces;
- }
-
- /**
- * Returns the timestamp of the event at the requested index. If none,
- * returns null.
- *
- * @param index
- * the event index (rank)
- * @return the corresponding event timestamp
- * @since 2.0
- */
- public ITmfTimestamp getTimestamp(final int index) {
- final ITmfContext context = seekEvent(index);
- final ITmfEvent event = getNext(context);
- context.dispose();
- return (event != null) ? event.getTimestamp() : null;
- }
-
- // ------------------------------------------------------------------------
- // Request management
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public synchronized ITmfContext armRequest(final ITmfEventRequest request) {
-
- // Make sure we have something to read from
- if (fTraces == null) {
- return null;
- }
-
- if (!TmfTimestamp.BIG_BANG.equals(request.getRange().getStartTime())
- && request.getIndex() == 0) {
- final ITmfContext context = seekEvent(request.getRange().getStartTime());
- request.setStartIndex((int) context.getRank());
- return context;
-
- }
-
- return seekEvent(request.getIndex());
- }
-
- // ------------------------------------------------------------------------
- // ITmfTrace trace positioning
- // ------------------------------------------------------------------------
-
- /**
- * @since 3.0
- */
- @Override
- public synchronized ITmfContext seekEvent(final ITmfLocation location) {
- // Validate the location
- if (location != null && !(location instanceof TmfExperimentLocation)) {
- return null; // Throw an exception?
- }
- // Make sure we have something to read from
- if (fTraces == null) {
- return null;
- }
-
- // Initialize the location array if necessary
- TmfLocationArray locationArray = ((location == null) ?
- new TmfLocationArray(fTraces.length) :
- ((TmfExperimentLocation) location).getLocationInfo());
-
- ITmfLocation[] locations = locationArray.getLocations();
- long[] ranks = locationArray.getRanks();
-
- // Create and populate the context's traces contexts
- final TmfExperimentContext context = new TmfExperimentContext(fTraces.length);
-
- // Position the traces
- long rank = 0;
- for (int i = 0; i < fTraces.length; i++) {
- // Get the relevant trace attributes
- final ITmfContext traceContext = fTraces[i].seekEvent(locations[i]);
- context.setContext(i, traceContext);
- traceContext.setRank(ranks[i]);
- // update location after seek
- locations[i] = traceContext.getLocation();
- context.setEvent(i, fTraces[i].getNext(traceContext));
- rank += ranks[i];
- }
-
- // Finalize context
- context.setLocation(new TmfExperimentLocation(new TmfLocationArray(locations, ranks)));
- context.setLastTrace(TmfExperimentContext.NO_TRACE);
- context.setRank(rank);
-
- return context;
- }
-
- // ------------------------------------------------------------------------
- // ITmfTrace - SeekEvent operations (returning a trace context)
- // ------------------------------------------------------------------------
-
- @Override
- public ITmfContext seekEvent(final double ratio) {
- final ITmfContext context = seekEvent(Math.round(ratio * getNbEvents()));
- return context;
- }
-
- /**
- * @since 3.0
- */
- @Override
- public double getLocationRatio(final ITmfLocation location) {
- if (location instanceof TmfExperimentLocation) {
- long rank = 0;
- TmfLocationArray locationArray = ((TmfExperimentLocation) location).getLocationInfo();
- for (int i = 0; i < locationArray.size(); i++) {
- rank += locationArray.getRank(i);
- }
- return (double) rank / getNbEvents();
- }
- return 0.0;
- }
-
- /**
- * @since 3.0
- */
- @Override
- public ITmfLocation getCurrentLocation() {
- // never used
- return null;
- }
-
- // ------------------------------------------------------------------------
- // ITmfTrace trace positioning
- // ------------------------------------------------------------------------
-
- @Override
- public synchronized ITmfEvent parseEvent(final ITmfContext context) {
- final ITmfContext tmpContext = seekEvent(context.getLocation());
- final ITmfEvent event = getNext(tmpContext);
- return event;
- }
-
- @Override
- public synchronized ITmfEvent getNext(ITmfContext context) {
-
- // Validate the context
- if (!(context instanceof TmfExperimentContext)) {
- return null; // Throw an exception?
- }
-
- // Make sure that we have something to read from
- if (fTraces == null) {
- return null;
- }
-
- TmfExperimentContext expContext = (TmfExperimentContext) context;
-
- // If an event was consumed previously, first get the next one from that
- // trace
- final int lastTrace = expContext.getLastTrace();
- if (lastTrace != TmfExperimentContext.NO_TRACE) {
- final ITmfContext traceContext = expContext.getContext(lastTrace);
- expContext.setEvent(lastTrace, fTraces[lastTrace].getNext(traceContext));
- expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
- }
-
- // Scan the candidate events and identify the "next" trace to read from
- int trace = TmfExperimentContext.NO_TRACE;
- ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH;
- for (int i = 0; i < fTraces.length; i++) {
- final ITmfEvent event = expContext.getEvent(i);
- if (event != null && event.getTimestamp() != null) {
- final ITmfTimestamp otherTS = event.getTimestamp();
- if (otherTS.compareTo(timestamp) < 0) {
- trace = i;
- timestamp = otherTS;
- }
- }
- }
-
- ITmfEvent event = null;
- if (trace != TmfExperimentContext.NO_TRACE) {
- event = expContext.getEvent(trace);
- if (event != null) {
- updateAttributes(expContext, event.getTimestamp());
- expContext.increaseRank();
- expContext.setLastTrace(trace);
- final ITmfContext traceContext = expContext.getContext(trace);
- if (traceContext == null) {
- throw new IllegalStateException();
- }
-
- // Update the experiment location
- TmfLocationArray locationArray = new TmfLocationArray(
- ((TmfExperimentLocation) expContext.getLocation()).getLocationInfo(),
- trace, traceContext.getLocation(), traceContext.getRank());
- expContext.setLocation(new TmfExperimentLocation(locationArray));
-
- processEvent(event);
- }
- }
-
- return event;
- }
-
- /**
- * @since 2.0
- */
- @Override
- public ITmfTimestamp getInitialRangeOffset() {
- if ((fTraces == null) || (fTraces.length == 0)) {
- return super.getInitialRangeOffset();
- }
-
- ITmfTimestamp initTs = TmfTimestamp.BIG_CRUNCH;
- for (int i = 0; i < fTraces.length; i++) {
- ITmfTimestamp ts = fTraces[i].getInitialRangeOffset();
- if (ts.compareTo(initTs) < 0) {
- initTs = ts;
- }
- }
- return initTs;
- }
-
- /**
- * Get the path to the folder in the supplementary file where
- * synchronization-related data can be kept so they are not deleted when the
- * experiment is synchronized. Analysis involved in synchronization can put
- * their supplementary files in there so they are preserved after
- * synchronization.
- *
- * If the directory does not exist, it will be created. A return value of
- * <code>null</code> means either the trace resource does not exist or
- * supplementary resources cannot be kept.
- *
- * @param absolute
- * If <code>true</code>, it returns the absolute path in the file
- * system, including the supplementary file path. Otherwise, it
- * returns only the directory name.
- * @return The path to the folder where synchronization-related
- * supplementary files can be kept or <code>null</code> if not
- * available.
- * @since 3.2
- */
- public String getSynchronizationFolder(boolean absolute) {
- /* Set up the path to the synchronization file we'll use */
- IResource resource = this.getResource();
- String syncDirectory = null;
-
- try {
- /* get the directory where the file will be stored. */
- if (resource != null) {
- String fullDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
- /* Create the synchronization data directory if not present */
- if (fullDirectory != null) {
- fullDirectory = fullDirectory + File.separator + SYNCHRONIZATION_DIRECTORY;
- File syncDir = new File(fullDirectory);
- syncDir.mkdirs();
- }
- if (absolute) {
- syncDirectory = fullDirectory;
- } else {
- syncDirectory = SYNCHRONIZATION_DIRECTORY;
- }
- }
- } catch (CoreException e) {
- return null;
- }
-
- return syncDirectory;
- }
-
- /**
- * Synchronizes the traces of an experiment. By default it only tries to
- * read a synchronization file if it exists
- *
- * @return The synchronization object
- * @since 3.0
- */
- public synchronized SynchronizationAlgorithm synchronizeTraces() {
- return synchronizeTraces(false);
- }
-
- /**
- * Synchronizes the traces of an experiment.
- *
- * @param doSync
- * Whether to actually synchronize or just try opening a sync
- * file
- * @return The synchronization object
- * @since 3.0
- */
- public synchronized SynchronizationAlgorithm synchronizeTraces(boolean doSync) {
-
- String syncDirectory = getSynchronizationFolder(true);
-
- final File syncFile = (syncDirectory != null) ? new File(syncDirectory + File.separator + SYNCHRONIZATION_FILE_NAME) : null;
-
- final SynchronizationAlgorithm syncAlgo = SynchronizationManager.synchronizeTraces(syncFile, Arrays.asList(fTraces), doSync);
-
- final TmfTraceSynchronizedSignal signal = new TmfTraceSynchronizedSignal(this, syncAlgo);
-
- /* Broadcast in separate thread to prevent deadlock */
- new Thread() {
- @Override
- public void run() {
- broadcast(signal);
- }
- }.start();
-
- return syncAlgo;
- }
-
- @Override
- @SuppressWarnings("nls")
- public synchronized String toString() {
- return "[TmfExperiment (" + getName() + ")]";
- }
-
- // ------------------------------------------------------------------------
- // Streaming support
- // ------------------------------------------------------------------------
-
- private synchronized void initializeStreamingMonitor() {
-
- if (fInitialized) {
- return;
- }
- fInitialized = true;
-
- if (getStreamingInterval() == 0) {
- final ITmfContext context = seekEvent(0);
- final ITmfEvent event = getNext(context);
- context.dispose();
- if (event == null) {
- return;
- }
- final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp(), TmfTimestamp.BIG_CRUNCH);
- final TmfTraceRangeUpdatedSignal signal = new TmfTraceRangeUpdatedSignal(this, this, timeRange);
-
- // Broadcast in separate thread to prevent deadlock
- new Thread() {
- @Override
- public void run() {
- broadcast(signal);
- }
- }.start();
- return;
- }
-
- final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
- private ITmfTimestamp safeTimestamp = null;
- private ITmfTimestamp lastSafeTimestamp = null;
- private TmfTimeRange timeRange = null;
-
- @Override
- public void run() {
- while (!executorIsShutdown()) {
- if (!getIndexer().isIndexing()) {
- ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
- ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
- for (final ITmfTrace trace : fTraces) {
- if (trace.getStartTime().compareTo(startTimestamp) < 0) {
- startTimestamp = trace.getStartTime();
- }
- if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) {
- endTimestamp = trace.getEndTime();
- }
- }
- if (safeTimestamp != null && (lastSafeTimestamp == null || safeTimestamp.compareTo(lastSafeTimestamp) > 0)) {
- timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
- lastSafeTimestamp = safeTimestamp;
- } else {
- timeRange = null;
- }
- safeTimestamp = endTimestamp;
- if (timeRange != null) {
- final TmfTraceRangeUpdatedSignal signal =
- new TmfTraceRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
- broadcast(signal);
- }
- }
- try {
- Thread.sleep(getStreamingInterval());
- } catch (final InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- };
- thread.start();
- }
-
- @Override
- public long getStreamingInterval() {
- long interval = 0;
- for (final ITmfTrace trace : fTraces) {
- interval = Math.max(interval, trace.getStreamingInterval());
- }
- return interval;
- }
-
- // ------------------------------------------------------------------------
- // Signal handlers
- // ------------------------------------------------------------------------
-
- @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);
- }
- }
-
- /**
- * @since 3.0
- */
- @Override
- public synchronized int getCheckpointSize() {
- int totalCheckpointSize = 0;
- try {
- if (fTraces != null) {
- for (final ITmfTrace trace : fTraces) {
- if (!(trace instanceof ITmfPersistentlyIndexable)) {
- return 0;
- }
-
- ITmfPersistentlyIndexable persistableIndexTrace = (ITmfPersistentlyIndexable) trace;
- int currentTraceCheckpointSize = persistableIndexTrace.getCheckpointSize();
- if (currentTraceCheckpointSize <= 0) {
- return 0;
- }
- totalCheckpointSize += currentTraceCheckpointSize;
- // each entry in the TmfLocationArray has a rank in addition
- // of the location
- totalCheckpointSize += 8;
- }
- }
- } catch (UnsupportedOperationException e) {
- return 0;
- }
-
- return totalCheckpointSize;
- }
-
- /**
- * @since 3.0
- */
- @Override
- public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
- ITmfLocation[] locations = new ITmfLocation[fTraces.length];
- long[] ranks = new long[fTraces.length];
- for (int i = 0; i < fTraces.length; ++i) {
- final ITmfTrace trace = fTraces[i];
- locations[i] = ((ITmfPersistentlyIndexable) trace).restoreLocation(bufferIn);
- ranks[i] = bufferIn.getLong();
- }
- TmfLocationArray arr = new TmfLocationArray(locations, ranks);
- TmfExperimentLocation l = new TmfExperimentLocation(arr);
- return l;
- }
-
-}
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
/**
* Central trace manager for TMF. It tracks the currently opened traces and
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2014 Ericsson, École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Trace Model 1.0
+ * Patrick Tasse - Updated for removal of context clone
+ * Patrick Tasse - Updated for ranks in experiment location
+ * Geneviève Bastien - Added support of experiment synchronization
+ * Added the initExperiment method and default constructor
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.trace.experiment;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.tmf.core.Activator;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentContext;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentLocation;
+import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfLocationArray;
+import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSynchronizedSignal;
+import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
+import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationManager;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfEventParser;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
+ * that are part of a tracing experiment.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
+ */
+public class TmfExperiment extends TmfTrace implements ITmfEventParser, ITmfPersistentlyIndexable {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * The file name of the Synchronization
+ *
+ * @since 3.0
+ * @deprecated This file name shouldn't be used directly anymore. All
+ * synchronization files have been moved to a folder and you
+ * should use the {@link #getSynchronizationFolder(boolean)}
+ * method to return the path to this folder.
+ */
+ @Deprecated
+ public static final String SYNCHRONIZATION_FILE_NAME = "synchronization.bin"; //$NON-NLS-1$
+
+ /**
+ * The name of the directory containing trace synchronization data. This
+ * directory typically will be preserved when traces are synchronized.
+ * Analysis involved in synchronization can put their supplementary files in
+ * there so they are not deleted when synchronized traces are copied.
+ */
+ private static final String SYNCHRONIZATION_DIRECTORY = "sync_data"; //$NON-NLS-1$
+
+ /**
+ * The default index page size
+ */
+ public static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The set of traces that constitute the experiment
+ */
+ protected ITmfTrace[] fTraces;
+
+ /**
+ * The set of traces that constitute the experiment
+ */
+ private boolean fInitialized = false;
+
+
+ // ------------------------------------------------------------------------
+ // Construction
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default constructor. Should not be used directly, but is needed for
+ * extension points.
+ *
+ * @deprecated Do not call this directly (but do not remove it either!)
+ */
+ @Deprecated
+ public TmfExperiment() {
+ super();
+ }
+
+ /**
+ * Constructor 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. You can use
+ * {@link TmfExperiment#DEFAULT_INDEX_PAGE_SIZE} for a default
+ * value.
+ * @param resource
+ * The resource associated to the experiment. You can use 'null'
+ * for no resources (tests, etc.)
+ */
+ public TmfExperiment(final Class<? extends ITmfEvent> type,
+ final String path,
+ final ITmfTrace[] traces,
+ final int indexPageSize,
+ final @Nullable IResource resource) {
+ initExperiment(type, path, traces, indexPageSize, resource);
+ }
+
+ @Override
+ protected ITmfTraceIndexer createIndexer(int interval) {
+ if (getCheckpointSize() > 0) {
+ return new TmfBTreeTraceIndexer(this, interval);
+ }
+ return super.createIndexer(interval);
+ }
+
+ /**
+ * Clears the experiment
+ */
+ @Override
+ public synchronized void dispose() {
+
+ // Clean up the index if applicable
+ if (getIndexer() != null) {
+ getIndexer().dispose();
+ }
+
+ if (fTraces != null) {
+ for (final ITmfTrace trace : fTraces) {
+ trace.dispose();
+ }
+ fTraces = null;
+ }
+ super.dispose();
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTrace - Initializers
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) {
+ /* Do nothing for experiments */
+ }
+
+ /**
+ * 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,
+ final @Nullable 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) {
+ this.synchronizeTraces();
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public IStatus validate(final IProject project, final String path) {
+ return Status.OK_STATUS;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the traces contained in this experiment.
+ *
+ * @return The array of contained traces
+ */
+ public ITmfTrace[] getTraces() {
+ return fTraces;
+ }
+
+ /**
+ * Returns the timestamp of the event at the requested index. If none,
+ * returns null.
+ *
+ * @param index
+ * the event index (rank)
+ * @return the corresponding event timestamp
+ * @since 2.0
+ */
+ public ITmfTimestamp getTimestamp(final int index) {
+ final ITmfContext context = seekEvent(index);
+ final ITmfEvent event = getNext(context);
+ context.dispose();
+ return (event != null) ? event.getTimestamp() : null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Request management
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public synchronized ITmfContext armRequest(final ITmfEventRequest request) {
+
+ // Make sure we have something to read from
+ if (fTraces == null) {
+ return null;
+ }
+
+ if (!TmfTimestamp.BIG_BANG.equals(request.getRange().getStartTime())
+ && request.getIndex() == 0) {
+ final ITmfContext context = seekEvent(request.getRange().getStartTime());
+ request.setStartIndex((int) context.getRank());
+ return context;
+
+ }
+
+ return seekEvent(request.getIndex());
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTrace trace positioning
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 3.0
+ */
+ @Override
+ public synchronized ITmfContext seekEvent(final ITmfLocation location) {
+ // Validate the location
+ if (location != null && !(location instanceof TmfExperimentLocation)) {
+ return null; // Throw an exception?
+ }
+ // Make sure we have something to read from
+ if (fTraces == null) {
+ return null;
+ }
+
+ // Initialize the location array if necessary
+ TmfLocationArray locationArray = ((location == null) ?
+ new TmfLocationArray(fTraces.length) :
+ ((TmfExperimentLocation) location).getLocationInfo());
+
+ ITmfLocation[] locations = locationArray.getLocations();
+ long[] ranks = locationArray.getRanks();
+
+ // Create and populate the context's traces contexts
+ final TmfExperimentContext context = new TmfExperimentContext(fTraces.length);
+
+ // Position the traces
+ long rank = 0;
+ for (int i = 0; i < fTraces.length; i++) {
+ // Get the relevant trace attributes
+ final ITmfContext traceContext = fTraces[i].seekEvent(locations[i]);
+ context.setContext(i, traceContext);
+ traceContext.setRank(ranks[i]);
+ // update location after seek
+ locations[i] = traceContext.getLocation();
+ context.setEvent(i, fTraces[i].getNext(traceContext));
+ rank += ranks[i];
+ }
+
+ // Finalize context
+ context.setLocation(new TmfExperimentLocation(new TmfLocationArray(locations, ranks)));
+ context.setLastTrace(TmfExperimentContext.NO_TRACE);
+ context.setRank(rank);
+
+ return context;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTrace - SeekEvent operations (returning a trace context)
+ // ------------------------------------------------------------------------
+
+ @Override
+ public ITmfContext seekEvent(final double ratio) {
+ final ITmfContext context = seekEvent(Math.round(ratio * getNbEvents()));
+ return context;
+ }
+
+ /**
+ * @since 3.0
+ */
+ @Override
+ public double getLocationRatio(final ITmfLocation location) {
+ if (location instanceof TmfExperimentLocation) {
+ long rank = 0;
+ TmfLocationArray locationArray = ((TmfExperimentLocation) location).getLocationInfo();
+ for (int i = 0; i < locationArray.size(); i++) {
+ rank += locationArray.getRank(i);
+ }
+ return (double) rank / getNbEvents();
+ }
+ return 0.0;
+ }
+
+ /**
+ * @since 3.0
+ */
+ @Override
+ public ITmfLocation getCurrentLocation() {
+ // never used
+ return null;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTrace trace positioning
+ // ------------------------------------------------------------------------
+
+ @Override
+ public synchronized ITmfEvent parseEvent(final ITmfContext context) {
+ final ITmfContext tmpContext = seekEvent(context.getLocation());
+ final ITmfEvent event = getNext(tmpContext);
+ return event;
+ }
+
+ @Override
+ public synchronized ITmfEvent getNext(ITmfContext context) {
+
+ // Validate the context
+ if (!(context instanceof TmfExperimentContext)) {
+ return null; // Throw an exception?
+ }
+
+ // Make sure that we have something to read from
+ if (fTraces == null) {
+ return null;
+ }
+
+ TmfExperimentContext expContext = (TmfExperimentContext) context;
+
+ // If an event was consumed previously, first get the next one from that
+ // trace
+ final int lastTrace = expContext.getLastTrace();
+ if (lastTrace != TmfExperimentContext.NO_TRACE) {
+ final ITmfContext traceContext = expContext.getContext(lastTrace);
+ expContext.setEvent(lastTrace, fTraces[lastTrace].getNext(traceContext));
+ expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
+ }
+
+ // Scan the candidate events and identify the "next" trace to read from
+ int trace = TmfExperimentContext.NO_TRACE;
+ ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH;
+ for (int i = 0; i < fTraces.length; i++) {
+ final ITmfEvent event = expContext.getEvent(i);
+ if (event != null && event.getTimestamp() != null) {
+ final ITmfTimestamp otherTS = event.getTimestamp();
+ if (otherTS.compareTo(timestamp) < 0) {
+ trace = i;
+ timestamp = otherTS;
+ }
+ }
+ }
+
+ ITmfEvent event = null;
+ if (trace != TmfExperimentContext.NO_TRACE) {
+ event = expContext.getEvent(trace);
+ if (event != null) {
+ updateAttributes(expContext, event.getTimestamp());
+ expContext.increaseRank();
+ expContext.setLastTrace(trace);
+ final ITmfContext traceContext = expContext.getContext(trace);
+ if (traceContext == null) {
+ throw new IllegalStateException();
+ }
+
+ // Update the experiment location
+ TmfLocationArray locationArray = new TmfLocationArray(
+ ((TmfExperimentLocation) expContext.getLocation()).getLocationInfo(),
+ trace, traceContext.getLocation(), traceContext.getRank());
+ expContext.setLocation(new TmfExperimentLocation(locationArray));
+
+ processEvent(event);
+ }
+ }
+
+ return event;
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public ITmfTimestamp getInitialRangeOffset() {
+ if ((fTraces == null) || (fTraces.length == 0)) {
+ return super.getInitialRangeOffset();
+ }
+
+ ITmfTimestamp initTs = TmfTimestamp.BIG_CRUNCH;
+ for (int i = 0; i < fTraces.length; i++) {
+ ITmfTimestamp ts = fTraces[i].getInitialRangeOffset();
+ if (ts.compareTo(initTs) < 0) {
+ initTs = ts;
+ }
+ }
+ return initTs;
+ }
+
+ /**
+ * Get the path to the folder in the supplementary file where
+ * synchronization-related data can be kept so they are not deleted when the
+ * experiment is synchronized. Analysis involved in synchronization can put
+ * their supplementary files in there so they are preserved after
+ * synchronization.
+ *
+ * If the directory does not exist, it will be created. A return value of
+ * <code>null</code> means either the trace resource does not exist or
+ * supplementary resources cannot be kept.
+ *
+ * @param absolute
+ * If <code>true</code>, it returns the absolute path in the file
+ * system, including the supplementary file path. Otherwise, it
+ * returns only the directory name.
+ * @return The path to the folder where synchronization-related
+ * supplementary files can be kept or <code>null</code> if not
+ * available.
+ * @since 3.2
+ */
+ public String getSynchronizationFolder(boolean absolute) {
+ /* Set up the path to the synchronization file we'll use */
+ IResource resource = this.getResource();
+ String syncDirectory = null;
+
+ try {
+ /* get the directory where the file will be stored. */
+ if (resource != null) {
+ String fullDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
+ /* Create the synchronization data directory if not present */
+ if (fullDirectory != null) {
+ fullDirectory = fullDirectory + File.separator + SYNCHRONIZATION_DIRECTORY;
+ File syncDir = new File(fullDirectory);
+ syncDir.mkdirs();
+ }
+ if (absolute) {
+ syncDirectory = fullDirectory;
+ } else {
+ syncDirectory = SYNCHRONIZATION_DIRECTORY;
+ }
+ }
+ } catch (CoreException e) {
+ return null;
+ }
+
+ return syncDirectory;
+ }
+
+ /**
+ * Synchronizes the traces of an experiment. By default it only tries to
+ * read a synchronization file if it exists
+ *
+ * @return The synchronization object
+ * @since 3.0
+ */
+ public synchronized SynchronizationAlgorithm synchronizeTraces() {
+ return synchronizeTraces(false);
+ }
+
+ /**
+ * Synchronizes the traces of an experiment.
+ *
+ * @param doSync
+ * Whether to actually synchronize or just try opening a sync
+ * file
+ * @return The synchronization object
+ * @since 3.0
+ */
+ public synchronized SynchronizationAlgorithm synchronizeTraces(boolean doSync) {
+
+ String syncDirectory = getSynchronizationFolder(true);
+
+ final File syncFile = (syncDirectory != null) ? new File(syncDirectory + File.separator + SYNCHRONIZATION_FILE_NAME) : null;
+
+ final SynchronizationAlgorithm syncAlgo = SynchronizationManager.synchronizeTraces(syncFile, Arrays.asList(fTraces), doSync);
+
+ final TmfTraceSynchronizedSignal signal = new TmfTraceSynchronizedSignal(this, syncAlgo);
+
+ /* Broadcast in separate thread to prevent deadlock */
+ new Thread() {
+ @Override
+ public void run() {
+ broadcast(signal);
+ }
+ }.start();
+
+ return syncAlgo;
+ }
+
+ @Override
+ @SuppressWarnings("nls")
+ public synchronized String toString() {
+ return "[TmfExperiment (" + getName() + ")]";
+ }
+
+ // ------------------------------------------------------------------------
+ // Streaming support
+ // ------------------------------------------------------------------------
+
+ private synchronized void initializeStreamingMonitor() {
+
+ if (fInitialized) {
+ return;
+ }
+ fInitialized = true;
+
+ if (getStreamingInterval() == 0) {
+ final ITmfContext context = seekEvent(0);
+ final ITmfEvent event = getNext(context);
+ context.dispose();
+ if (event == null) {
+ return;
+ }
+ final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp(), TmfTimestamp.BIG_CRUNCH);
+ final TmfTraceRangeUpdatedSignal signal = new TmfTraceRangeUpdatedSignal(this, this, timeRange);
+
+ // Broadcast in separate thread to prevent deadlock
+ new Thread() {
+ @Override
+ public void run() {
+ broadcast(signal);
+ }
+ }.start();
+ return;
+ }
+
+ final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
+ private ITmfTimestamp safeTimestamp = null;
+ private ITmfTimestamp lastSafeTimestamp = null;
+ private TmfTimeRange timeRange = null;
+
+ @Override
+ public void run() {
+ while (!executorIsShutdown()) {
+ if (!getIndexer().isIndexing()) {
+ ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
+ ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
+ for (final ITmfTrace trace : fTraces) {
+ if (trace.getStartTime().compareTo(startTimestamp) < 0) {
+ startTimestamp = trace.getStartTime();
+ }
+ if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) {
+ endTimestamp = trace.getEndTime();
+ }
+ }
+ if (safeTimestamp != null && (lastSafeTimestamp == null || safeTimestamp.compareTo(lastSafeTimestamp) > 0)) {
+ timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
+ lastSafeTimestamp = safeTimestamp;
+ } else {
+ timeRange = null;
+ }
+ safeTimestamp = endTimestamp;
+ if (timeRange != null) {
+ final TmfTraceRangeUpdatedSignal signal =
+ new TmfTraceRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
+ broadcast(signal);
+ }
+ }
+ try {
+ Thread.sleep(getStreamingInterval());
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ };
+ thread.start();
+ }
+
+ @Override
+ public long getStreamingInterval() {
+ long interval = 0;
+ for (final ITmfTrace trace : fTraces) {
+ interval = Math.max(interval, trace.getStreamingInterval());
+ }
+ return interval;
+ }
+
+ // ------------------------------------------------------------------------
+ // Signal handlers
+ // ------------------------------------------------------------------------
+
+ @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);
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
+ @Override
+ public synchronized int getCheckpointSize() {
+ int totalCheckpointSize = 0;
+ try {
+ if (fTraces != null) {
+ for (final ITmfTrace trace : fTraces) {
+ if (!(trace instanceof ITmfPersistentlyIndexable)) {
+ return 0;
+ }
+
+ ITmfPersistentlyIndexable persistableIndexTrace = (ITmfPersistentlyIndexable) trace;
+ int currentTraceCheckpointSize = persistableIndexTrace.getCheckpointSize();
+ if (currentTraceCheckpointSize <= 0) {
+ return 0;
+ }
+ totalCheckpointSize += currentTraceCheckpointSize;
+ // each entry in the TmfLocationArray has a rank in addition
+ // of the location
+ totalCheckpointSize += 8;
+ }
+ }
+ } catch (UnsupportedOperationException e) {
+ return 0;
+ }
+
+ return totalCheckpointSize;
+ }
+
+ /**
+ * @since 3.0
+ */
+ @Override
+ public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
+ ITmfLocation[] locations = new ITmfLocation[fTraces.length];
+ long[] ranks = new long[fTraces.length];
+ for (int i = 0; i < fTraces.length; ++i) {
+ final ITmfTrace trace = fTraces[i];
+ locations[i] = ((ITmfPersistentlyIndexable) trace).restoreLocation(bufferIn);
+ ranks[i] = bufferIn.getLong();
+ }
+ TmfLocationArray arr = new TmfLocationArray(locations, ranks);
+ TmfExperimentLocation l = new TmfExperimentLocation(arr);
+ return l;
+ }
+
+}
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
import org.junit.After;
import org.junit.AfterClass;
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
/**
* A pcap-specific analysis that parse an entire trace to find all the streams.
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfExperimentStub;
import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.tracecompass.tmf.core.trace.ITmfEventParser;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TraceUtils;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.project.model.Messages;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.tracecompass.tmf.ui.project.model.TmfOpenTraceHelper;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
import org.eclipse.tracecompass.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.editors.TmfEditorInput;
import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.TmfUiRefreshHandler;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSynchronizedSignal;
import org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfExperiment;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
import org.eclipse.tracecompass.tmf.ui.views.TmfView;
/**