aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilliano Molaire2014-04-23 13:00:03 (EDT)
committerGenevieve Bastien2014-05-02 20:21:34 (EDT)
commit3030a619839bc55c64f3ad3792de616fce0b6014 (patch)
tree65afc7c2f4734b531d4850cd03f515906958b081
parent51faca68142fa09ffb129dcb0571d8044a2fa302 (diff)
downloadorg.eclipse.linuxtools-3030a619839bc55c64f3ad3792de616fce0b6014.zip
org.eclipse.linuxtools-3030a619839bc55c64f3ad3792de616fce0b6014.tar.gz
org.eclipse.linuxtools-3030a619839bc55c64f3ad3792de616fce0b6014.tar.bz2
TMF: Implementation of LttngKernelAnalysis requirementsrefs/changes/23/23423/17
The events needed by the analysis are added as requirements. Change-Id: I4f8930815d8c3a088986ada4dfffb9b737d25af0 Signed-off-by: Guilliano Molaire <guilliamo-jaime.molaire@polymtl.ca> Signed-off-by: Mathieu Rail <contact@mathieurail.com> Reviewed-on: https://git.eclipse.org/r/23423 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/analysis/LttngKernelAnalysisTest.java79
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/analysis/LttngKernelAnalysisModule.java43
4 files changed, 117 insertions, 13 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
index 2a864a8..55ef24d 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,9 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.linuxtools.tmf.ctf.core.tests,
org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0",
org.eclipse.core.resources,
- org.eclipse.linuxtools.statesystem.core
+ org.eclipse.linuxtools.statesystem.core,
+ org.eclipse.linuxtools.lttng2.control.core
Export-Package: org.eclipse.linuxtools.lttng2.kernel.core.tests,
org.eclipse.linuxtools.lttng2.kernel.core.tests.event.matchandsync,
org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider
+Import-Package: com.google.common.collect
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/analysis/LttngKernelAnalysisTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/analysis/LttngKernelAnalysisTest.java
index 172e677..4e6e591 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/analysis/LttngKernelAnalysisTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/analysis/LttngKernelAnalysisTest.java
@@ -12,6 +12,7 @@
package org.eclipse.linuxtools.lttng2.kernel.core.tests.analysis;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -20,9 +21,13 @@ import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import java.util.List;
+import java.util.Set;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
+import org.eclipse.linuxtools.lttng2.control.core.session.SessionConfigStrings;
import org.eclipse.linuxtools.lttng2.kernel.core.analysis.LttngKernelAnalysisModule;
import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.linuxtools.tmf.core.tests.shared.TmfTestHelper;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
@@ -31,6 +36,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.ImmutableSet;
+
/**
* Test the {@link LttngKernelAnalysisModule} class
*
@@ -39,12 +46,14 @@ import org.junit.Test;
public class LttngKernelAnalysisTest {
private ITmfTrace fTrace;
+ private LttngKernelAnalysisModule fKernelAnalysisModule;
/**
* Set-up the test
*/
@Before
public void setUp() {
+ fKernelAnalysisModule = new LttngKernelAnalysisModule();
assumeTrue(CtfTmfTestTrace.KERNEL.exists());
fTrace = CtfTmfTestTrace.KERNEL.getTrace();
}
@@ -55,6 +64,7 @@ public class LttngKernelAnalysisTest {
@After
public void tearDown() {
fTrace.dispose();
+ fKernelAnalysisModule.dispose();
}
/**
@@ -62,23 +72,80 @@ public class LttngKernelAnalysisTest {
*/
@Test
public void testAnalysisExecution() {
- LttngKernelAnalysisModule module = new LttngKernelAnalysisModule();
- module.setId("test");
+ fKernelAnalysisModule.setId("test");
try {
- module.setTrace(fTrace);
+ fKernelAnalysisModule.setTrace(fTrace);
} catch (TmfAnalysisException e) {
fail(e.getMessage());
}
// Assert the state system has not been initialized yet
- ITmfStateSystem ss = module.getStateSystem();
+ ITmfStateSystem ss = fKernelAnalysisModule.getStateSystem();
assertNull(ss);
- assertTrue(TmfTestHelper.executeAnalysis(module));
+ assertTrue(TmfTestHelper.executeAnalysis(fKernelAnalysisModule));
- ss = module.getStateSystem();
+ ss = fKernelAnalysisModule.getStateSystem();
assertNotNull(ss);
List<Integer> quarks = ss.getQuarks("*");
assertFalse(quarks.isEmpty());
}
+
+ /**
+ * Test for {@link LttngKernelAnalysisModule#getAnalysisRequirements()}
+ */
+ @Test
+ public void testGetAnalysisRequirements() {
+ Iterable<TmfAnalysisRequirement> requirements = fKernelAnalysisModule.getAnalysisRequirements();
+ assertNotNull(requirements);
+
+ /* There should be the event and domain type */
+ TmfAnalysisRequirement eventReq = null;
+ TmfAnalysisRequirement domainReq = null;
+ int numberOfRequirement = 0;
+ for (TmfAnalysisRequirement requirement : requirements) {
+ ++numberOfRequirement;
+ if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) {
+ eventReq = requirement;
+ } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) {
+ domainReq = requirement;
+ }
+ }
+ assertNotNull(eventReq);
+ assertNotNull(domainReq);
+
+ /* There should be two requirements */
+ assertEquals(2, numberOfRequirement);
+
+ /* Verify the content of the requirements themselves */
+ /* Domain should be kernel */
+ assertEquals(1, domainReq.getValues().size());
+ for (String domain : domainReq.getValues()) {
+ assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, domain);
+ }
+
+ /* Events */
+ Set<String> expectedEvents = ImmutableSet.of(
+ LttngStrings.EXIT_SYSCALL,
+ LttngStrings.IRQ_HANDLER_ENTRY,
+ LttngStrings.IRQ_HANDLER_EXIT,
+ LttngStrings.SOFTIRQ_ENTRY,
+ LttngStrings.SOFTIRQ_EXIT,
+ LttngStrings.SOFTIRQ_RAISE,
+ LttngStrings.SCHED_SWITCH,
+ LttngStrings.SCHED_PROCESS_FORK,
+ LttngStrings.SCHED_PROCESS_EXIT,
+ LttngStrings.SCHED_PROCESS_FREE,
+ LttngStrings.STATEDUMP_PROCESS_STATE,
+ LttngStrings.SCHED_WAKEUP,
+ LttngStrings.SCHED_WAKEUP_NEW,
+ /* Add the prefix for syscalls */
+ LttngStrings.SYSCALL_PREFIX
+ );
+
+ assertEquals(14, eventReq.getValues().size());
+ for (String event : eventReq.getValues()) {
+ assertTrue("Unexpected event " + event, expectedEvents.contains(event));
+ }
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
index 818d604..b510893 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
@@ -12,10 +12,12 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.tmf.ctf.core
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.lttng2.control.core
Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
org.eclipse.linuxtools.lttng2.kernel.core.analysis,
org.eclipse.linuxtools.lttng2.kernel.core.cpuusage,
org.eclipse.linuxtools.lttng2.kernel.core.event.matching,
org.eclipse.linuxtools.lttng2.kernel.core.trace
+Import-Package: com.google.common.collect
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/analysis/LttngKernelAnalysisModule.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/analysis/LttngKernelAnalysisModule.java
index ba79b42..0e2beaf 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/analysis/LttngKernelAnalysisModule.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/analysis/LttngKernelAnalysisModule.java
@@ -8,15 +8,22 @@
*
* Contributors:
* Geneviève Bastien - Initial API and implementation
+ * Mathieu Rail - Provide the requirements of the analysis
*******************************************************************************/
package org.eclipse.linuxtools.lttng2.kernel.core.analysis;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
+import org.eclipse.linuxtools.lttng2.control.core.session.SessionConfigStrings;
+import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement;
+import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement.ValuePriorityLevel;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import com.google.common.collect.ImmutableSet;
+
/**
* State System Module for lttng kernel traces
*
@@ -34,11 +41,33 @@ public class LttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
/** The ID of this analysis module */
public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.analysis"; //$NON-NLS-1$
- /**
- * Constructor adding the views to the analysis
- */
- public LttngKernelAnalysisModule() {
- super();
+ private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of(
+ LttngStrings.EXIT_SYSCALL,
+ LttngStrings.IRQ_HANDLER_ENTRY,
+ LttngStrings.IRQ_HANDLER_EXIT,
+ LttngStrings.SOFTIRQ_ENTRY,
+ LttngStrings.SOFTIRQ_EXIT,
+ LttngStrings.SOFTIRQ_RAISE,
+ LttngStrings.SCHED_SWITCH,
+ LttngStrings.SCHED_PROCESS_FORK,
+ LttngStrings.SCHED_PROCESS_EXIT,
+ LttngStrings.SCHED_PROCESS_FREE,
+ LttngStrings.STATEDUMP_PROCESS_STATE,
+ LttngStrings.SCHED_WAKEUP,
+ LttngStrings.SCHED_WAKEUP_NEW,
+ /* Add the prefix for syscalls */
+ LttngStrings.SYSCALL_PREFIX
+ );
+
+ /** The requirements as an immutable set */
+ private static final ImmutableSet<TmfAnalysisRequirement> REQUIREMENTS;
+
+ static {
+ /* initialize the requirement: domain and events */
+ TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
+ domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, ValuePriorityLevel.MANDATORY);
+
+ REQUIREMENTS = ImmutableSet.of(domainReq, new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY));
}
@Override
@@ -58,4 +87,8 @@ public class LttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
return Messages.LttngKernelAnalysisModule_Help;
}
+ @Override
+ public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
+ return REQUIREMENTS;
+ }
}