Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2019-08-01 11:55:10 -0400
committerGenevieve Bastien2019-08-01 16:06:38 -0400
commitafa8d0397efb9c0fe4f9e5e55f0958729a1e3b0a (patch)
tree40a04b9952a8132a7cabf8a1c312f446677debff
parent8f103465128b788ba0672dfdbbe3d357f9377154 (diff)
downloadorg.eclipse.tracecompass.incubator-afa8d0397efb9c0fe4f9e5e55f0958729a1e3b0a.tar.gz
org.eclipse.tracecompass.incubator-afa8d0397efb9c0fe4f9e5e55f0958729a1e3b0a.tar.xz
org.eclipse.tracecompass.incubator-afa8d0397efb9c0fe4f9e5e55f0958729a1e3b0a.zip
uftrace: Allow uftrace to correlate with kernel traces
Add a hostid file where one can specify the host ID, also let the timestamp be offsettable, using the trace's timestamp creation method. Update the doc accordingly [Fixed] uftrace traces can be correlated with other traces Change-Id: I2295152ce584d1e4c22a9f638e7c7191f0ab892d Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/146923 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: CI Bot
-rw-r--r--doc/org.eclipse.tracecompass.incubator.uftrace.doc.user/doc/User-Guide.mediawiki14
-rw-r--r--tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/UfContext.java3
-rw-r--r--tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/Uftrace.java31
3 files changed, 43 insertions, 5 deletions
diff --git a/doc/org.eclipse.tracecompass.incubator.uftrace.doc.user/doc/User-Guide.mediawiki b/doc/org.eclipse.tracecompass.incubator.uftrace.doc.user/doc/User-Guide.mediawiki
index cb8979b7..d2c4b2f8 100644
--- a/doc/org.eclipse.tracecompass.incubator.uftrace.doc.user/doc/User-Guide.mediawiki
+++ b/doc/org.eclipse.tracecompass.incubator.uftrace.doc.user/doc/User-Guide.mediawiki
@@ -10,4 +10,16 @@ This extension supports UfTrace traces. It populates a call graph and therefore
of the views of the generic callstack analysis.
The parser handles native uftrace traces. In order to open one, select any file within a uftrace
-directory. \ No newline at end of file
+directory.
+
+== Correlate with other traces ==
+
+Uftrace data can be correlated with the data from other traces, such as kernel traces. To correlate
+traces, their host ID need to match, which means they were taken from the same machine. A file named
+'hostid' can be added to the uftrace.data directory containing the uftrace data. This file has only one
+line which is the host ID.
+
+When correlating with traces that come from [LTTng](http://lttng.org) for instance, the [time offset may
+also need to be adjusted](https://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/Time-offsetting.html#Time_offsetting),
+since the time reference is not the same. The offset to put can be found, along with the LTTng's host ID
+in the ``Properties`` view, when selecting the trace. \ No newline at end of file
diff --git a/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/UfContext.java b/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/UfContext.java
index b0fa4bd4..0b2ab480 100644
--- a/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/UfContext.java
+++ b/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/UfContext.java
@@ -16,7 +16,6 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
import org.eclipse.tracecompass.tmf.core.trace.location.TmfLongLocation;
@@ -67,7 +66,7 @@ public class UfContext extends TmfContext {
if (eventSource.hasNext()) {
fQueue.add(eventSource);
}
- TmfEvent tmfEvent = new TmfEvent(fTrace, getRank(), TmfTimestamp.fromNanos(event.getTime()),
+ TmfEvent tmfEvent = new TmfEvent(fTrace, getRank(), fTrace.createTimestamp(event.getTime()),
UfEventType.lookup(event.getType()),
new TmfEventField(ITmfEventField.ROOT_FIELD_ID, event, null));
TmfLongLocation location = getLocation();
diff --git a/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/Uftrace.java b/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/Uftrace.java
index 9f5d2715..2d77f193 100644
--- a/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/Uftrace.java
+++ b/tracetypes/org.eclipse.tracecompass.incubator.uftrace.core/src/org/eclipse/tracecompass/incubator/internal/uftrace/core/trace/Uftrace.java
@@ -11,6 +11,7 @@ package org.eclipse.tracecompass.incubator.internal.uftrace.core.trace;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -89,6 +90,7 @@ public class Uftrace extends TmfTrace implements ITmfPropertiesProvider,
private final @NonNull TidAspect fTidAspect = new TidAspect();
private final @NonNull PidAspect fPidAspect = new PidAspect();
private final @NonNull ExecAspect fExecAspect = new ExecAspect();
+ private @Nullable String fHostId = null;
@Override
public Iterable<ITmfEventAspect<?>> getEventAspects() {
@@ -107,8 +109,11 @@ public class Uftrace extends TmfTrace implements ITmfPropertiesProvider,
@Override
public @Nullable Integer resolve(ITmfEvent event) {
- DatEvent fieldValue = (DatEvent) event.getContent().getValue();
- return fieldValue.getDepth();
+ Object fieldValue = event.getContent().getValue();
+ if (fieldValue instanceof DatEvent) {
+ return ((DatEvent) fieldValue).getDepth();
+ }
+ return null;
}
}, new ITmfEventAspect<String>() {
@@ -220,6 +225,16 @@ public class Uftrace extends TmfTrace implements ITmfPropertiesProvider,
fTasks = new TaskParser(child);
} else if (name.equals("info")) { //$NON-NLS-1$
fInfo = InfoParser.parse(child);
+ } else if (name.equals("hostid")) { //$NON-NLS-1$
+ /*
+ * A 'hostid' file can be added which contains only one line
+ * with the host ID in it. This can be used to correlate
+ * with some other traces' data like an lttng kernel trace
+ */
+ List<String> fileLines = Files.readAllLines(child.toPath());
+ if (!fileLines.isEmpty()) {
+ fHostId = fileLines.get(0);
+ }
}
} catch (IOException e) {
throw new TmfTraceException(e.getMessage(), e);
@@ -301,6 +316,14 @@ public class Uftrace extends TmfTrace implements ITmfPropertiesProvider,
return (int) (fCurrentLoc.getLocationInfo() / 1024);
}
+ @Override
+ public @NonNull String getHostId() {
+ if (fHostId != null) {
+ return fHostId;
+ }
+ return super.getHostId();
+ }
+
/**
* Get the symbol provider for this trace
*
@@ -398,6 +421,10 @@ public class Uftrace extends TmfTrace implements ITmfPropertiesProvider,
properties.put("endianness", String.valueOf(fInfo.getByteOrder())); //$NON-NLS-1$
properties.put("maximum depth", String.valueOf(fInfo.getMaxDepth())); //$NON-NLS-1$
properties.put("feature bit mask", Long.toBinaryString(fInfo.getFeatures())); //$NON-NLS-1$
+ String hostId = fHostId;
+ if (hostId != null) {
+ properties.put("host ID", hostId); //$NON-NLS-1$
+ }
properties.putAll(fInfo.getData());
return properties;
}

Back to the top