os.linux: Make KernelCtfTraceStub public
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Fri, 2 Sep 2016 01:30:28 +0000 (21:30 -0400)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 1 Nov 2016 19:52:19 +0000 (15:52 -0400)
Other tests might want to make use of kernel traces without
depending on the lttng2.kernel plugins.

One limitation is that that stub uses the DefaultEventLayout,
which means only very early LTTng 2.x traces will work. More
recent event layouts are only defined in the lttng plugins
at the moment.

Change-Id: I0717cba18e696cabb4bbad53c90dbe471f836ffa
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/latency/KernelCtfTraceStub.java [deleted file]
analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/latency/SyscallAnalysisTest.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/latency/SyscallStatsAnalysisTest.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/stubs/org/eclipse/tracecompass/analysis/os/linux/core/tests/stubs/trace/KernelCtfTraceStub.java [new file with mode: 0644]

diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/latency/KernelCtfTraceStub.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/latency/KernelCtfTraceStub.java
deleted file mode 100644 (file)
index 05177c2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 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
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.tests.latency;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.KernelEventLayoutStub;
-import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
-import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
-import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-class KernelCtfTraceStub extends CtfTmfTrace implements IKernelTrace {
-    public KernelCtfTraceStub() {
-        super();
-    }
-
-    public static synchronized KernelCtfTraceStub getTrace(CtfTestTrace ctfTrace) {
-        String tracePath;
-        try {
-            tracePath = FileLocator.toFileURL(ctfTrace.getTraceURL()).getPath();
-        } catch (IOException e) {
-            throw new IllegalStateException();
-        }
-
-        KernelCtfTraceStub trace = new KernelCtfTraceStub();
-        try {
-            trace.initTrace(null, tracePath, CtfTmfEvent.class);
-        } catch (TmfTraceException e) {
-            /* Should not happen if tracesExist() passed */
-            throw new RuntimeException(e);
-        }
-        return trace;
-    }
-
-    @Override
-    public @NonNull IKernelAnalysisEventLayout getKernelEventLayout() {
-        return KernelEventLayoutStub.getInstance();
-    }
-}
\ No newline at end of file
index 8f55c3714e91b75b385ec248b5f4556572cad38d..8d389d51ed0b079ff2aa527d32593ec7071a0055 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.KernelCtfTraceStub;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
 import org.eclipse.tracecompass.segmentstore.core.ISegment;
 import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
index 235af47150fcfa5b424ba304a9c3e7f51dfa342d..0ef6ce14e131d41361a50c3b3eb293ef07c83dde 100644 (file)
@@ -12,6 +12,7 @@ package org.eclipse.tracecompass.analysis.os.linux.core.tests.latency;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.KernelCtfTraceStub;
 import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.SegmentStoreStatistics;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.statistics.SystemCallLatencyStatisticsAnalysisModule;
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/stubs/org/eclipse/tracecompass/analysis/os/linux/core/tests/stubs/trace/KernelCtfTraceStub.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/stubs/org/eclipse/tracecompass/analysis/os/linux/core/tests/stubs/trace/KernelCtfTraceStub.java
new file mode 100644 (file)
index 0000000..22b014a
--- /dev/null
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
+import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
+import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Stub for a generic CTF kernel trace.
+ *
+ * It's basically an LTTng (2.0/2.1) trace, but without depending on o.e.t.lttng2.kernel!
+ */
+public class KernelCtfTraceStub extends CtfTmfTrace implements IKernelTrace {
+
+    /**
+     * Constructor
+     */
+    public KernelCtfTraceStub() {
+        super();
+    }
+
+    /**
+     * Get a trace from a CTF test trace.
+     *
+     * @param ctfTrace
+     *            The CTF test trace
+     * @return The initialized trace
+     */
+    public static synchronized KernelCtfTraceStub getTrace(CtfTestTrace ctfTrace) {
+        String tracePath;
+        try {
+            tracePath = FileLocator.toFileURL(ctfTrace.getTraceURL()).getPath();
+        } catch (IOException e) {
+            throw new IllegalStateException();
+        }
+
+        KernelCtfTraceStub trace = new KernelCtfTraceStub();
+        try {
+            trace.initTrace(null, tracePath, CtfTmfEvent.class);
+        } catch (TmfTraceException e) {
+            /* Should not happen if tracesExist() passed */
+            throw new RuntimeException(e);
+        }
+        return trace;
+    }
+
+    @Override
+    public @NonNull IKernelAnalysisEventLayout getKernelEventLayout() {
+        return KernelEventLayoutStub.getInstance();
+    }
+}
\ No newline at end of file
This page took 0.026918 seconds and 5 git commands to generate.