Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2014-04-01 22:38:05 +0000
committerMarc-Andre Laperle2014-07-24 18:58:53 +0000
commit220d6958f4757d8dea73a9cb1244199653a9f513 (patch)
tree82a32c7c60eddfab5ccf10251ce858f75766a7b3 /lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf
parent8be17f28d3f50247725b70b1dad20c5aad090bb0 (diff)
downloadorg.eclipse.linuxtools-220d6958f4757d8dea73a9cb1244199653a9f513.tar.gz
org.eclipse.linuxtools-220d6958f4757d8dea73a9cb1244199653a9f513.tar.xz
org.eclipse.linuxtools-220d6958f4757d8dea73a9cb1244199653a9f513.zip
lttng: Open a live trace and update the events table
With this patch, it becomes possible to import a live trace session in progress from the Control view. Once it's opened, the events table updates as more data is available when indicated by Relayd. Change-Id: I2470f4c3d4dd2570f4595455d2824806f0dacf09 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/29646 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Hudson CI
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf')
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceCompleteness.java38
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java34
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java10
3 files changed, 76 insertions, 6 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceCompleteness.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceCompleteness.java
new file mode 100644
index 0000000000..67a31eb414
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceCompleteness.java
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * Copyright (c) 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:
+ * Marc-Andre Laperle - Initial implementation
+ **********************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace;
+
+/**
+ * An interface that provides information about the completeness of a trace. A
+ * trace is considered complete when it is known that no more data will be added
+ * to it.
+ *
+ * @since 3.1
+ */
+public interface ITmfTraceCompleteness {
+
+ /**
+ * Returns whether or not a trace is complete.
+ *
+ * @return true if a trace is complete, false otherwise
+ */
+ boolean isComplete();
+
+ /**
+ * Set the completeness of a trace.
+ *
+ * @param isComplete
+ * whether the trace should be considered complete or not
+ */
+ void setComplete(boolean isComplete);
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
index 759e48413b..7374d9ab45 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java
@@ -87,7 +87,7 @@ import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
* @see ITmfTraceIndexer
* @see ITmfEventParser
*/
-public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
+public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, ITmfTraceCompleteness {
// ------------------------------------------------------------------------
// Attributes
@@ -723,11 +723,13 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
return;
}
- final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH);
- final TmfTraceRangeUpdatedSignal rangeUpdatedsignal = new TmfTraceRangeUpdatedSignal(this, this, timeRange);
+ if (isComplete()) {
+ final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH);
+ final TmfTraceRangeUpdatedSignal rangeUpdatedsignal = new TmfTraceRangeUpdatedSignal(this, this, timeRange);
- // Broadcast in separate thread to prevent deadlock
- broadcastAsync(rangeUpdatedsignal);
+ // Broadcast in separate thread to prevent deadlock
+ broadcastAsync(rangeUpdatedsignal);
+ }
return;
}
}
@@ -857,4 +859,26 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace {
+ ", fEndTime=" + fEndTime + ", fStreamingInterval=" + fStreamingInterval + "]";
}
+ /**
+ * @since 3.1
+ */
+ @Override
+ public boolean isComplete() {
+ /*
+ * Be default, all traces are "complete" which means no more data will
+ * be added later
+ */
+ return true;
+ }
+
+ /**
+ * @since 3.1
+ */
+ @Override
+ public void setComplete(boolean isComplete) {
+ /*
+ * This should be overridden by trace classes that can support live
+ * reading (traces in an incomplete state)
+ */
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java
index 3ce47dde70..eacdd0ef24 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java
@@ -28,6 +28,7 @@ import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceCompleteness;
import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
@@ -186,6 +187,7 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
return Status.OK_STATUS;
}
};
+ job.setSystem(!isCompleteTrace(fTrace));
job.schedule();
// Build a background request for all the trace data. The index is
@@ -206,7 +208,9 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
public void handleSuccess() {
fTraceIndex.setTimeRange(fTrace.getTimeRange());
fTraceIndex.setNbEvents(fTrace.getNbEvents());
- fTraceIndex.setIndexComplete();
+ if (isCompleteTrace(fTrace)) {
+ fTraceIndex.setIndexComplete();
+ }
updateTraceStatus();
}
@@ -344,4 +348,8 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
protected ITmfCheckpointIndex getTraceIndex() {
return fTraceIndex;
}
+
+ private static boolean isCompleteTrace(ITmfTrace trace) {
+ return !(trace instanceof ITmfTraceCompleteness) || ((ITmfTraceCompleteness)trace).isComplete();
+ }
}

Back to the top