Long due change that was previously withheld to not break the API.
This aligns the naming with the other internal packages, which
were already renamed.
Change-Id: I9a0b3354e7018fa67f5baf7eb8a8522e1553f881
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/68559
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
</tracetype>
</module>
<module
- analysis_module="org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule"
+ analysis_module="org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule"
automatic="false"
id="org.eclipse.tracecompass.analysis.os.linux.kernel"
name="Linux Kernel Test Analysis">
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.tracecompass.analysis.os.linux.core.contextswitch.KernelContextSwitchAnalysis;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.analysis.os.linux.core.tests.Activator;
import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.analysis.os.linux.core.cpuusage.KernelCpuUsageAnalysis;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.tests.Activator;
import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.TmfXmlKernelTraceStub;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2010, 2011 École Polytechnique de Montréal
+ * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
+ *
+ * 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.kernel;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
+import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
+import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for the {@link KernelStateProvider}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class KernelStateProviderTest {
+
+ private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
+
+ private IKernelTrace fTrace;
+ private ITmfStateProvider fInput;
+
+ /**
+ * Set-up.
+ */
+ @Before
+ public void initialize() {
+ IKernelTrace thetrace = KERNEL_TEST_CASE.getKernelTrace();
+ fTrace = thetrace;
+ fInput = new KernelStateProvider(thetrace, thetrace.getKernelEventLayout());
+ }
+
+ /**
+ * Class teardown
+ */
+ @After
+ public void classTeardown() {
+ if (fTrace != null) {
+ fTrace.dispose();
+ }
+ }
+
+ /**
+ * Test loading the state provider.
+ */
+ @Test
+ public void testOpening() {
+ long testStartTime;
+ testStartTime = fInput.getStartTime();
+ /* Expected start time of the trace */
+ assertEquals(testStartTime, 1L);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 É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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.tests.kernel;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
+import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+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.TmfTraceUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Test analysis-specific methods for the {@link KernelAnalysisModule} class.
+ *
+ * @author Geneviève Bastien
+ */
+public class KernelThreadInformationProviderTest {
+
+ private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
+
+ private ITmfTrace fTrace;
+ private KernelAnalysisModule fModule;
+
+ private static void deleteSuppFiles(ITmfTrace trace) {
+ /* Remove supplementary files */
+ File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
+ for (File file : suppDir.listFiles()) {
+ file.delete();
+ }
+ }
+
+ /**
+ * Setup the trace for the tests
+ */
+ @Before
+ public void setUp() {
+ ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
+ deleteSuppFiles(trace);
+ ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
+ IAnalysisModule module = null;
+ for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
+ module = mod;
+ }
+ assertNotNull(module);
+ module.schedule();
+ module.waitForCompletion();
+ fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
+ fTrace = trace;
+ }
+
+ /**
+ * Clean up
+ */
+ @After
+ public void tearDown() {
+ deleteSuppFiles(fTrace);
+ fTrace.dispose();
+ }
+
+ /**
+ * Test the
+ * {@link KernelThreadInformationProvider#getThreadIds(KernelAnalysisModule)}
+ * method
+ */
+ @Test
+ public void testGetThreadQuarks() {
+ KernelAnalysisModule module = checkNotNull(fModule);
+ Collection<Integer> threadIds = KernelThreadInformationProvider.getThreadIds(module);
+ assertEquals(ImmutableSet.<Integer>of(10,11,20,21,30,100), threadIds);
+ }
+
+ /**
+ * Test the
+ * {@link KernelThreadInformationProvider#getThreadOnCpu(KernelAnalysisModule, long, long)}
+ * method
+ */
+ @Test
+ public void testGetThreadOnCpu() {
+ KernelAnalysisModule module = checkNotNull(fModule);
+
+ /* Check with invalid timestamps */
+ Integer tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, -1);
+ assertNull(tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 80);
+ assertNull(tid);
+
+ /* Check with invalid cpus */
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 2, 20);
+ assertNull(tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, -1, 20);
+ assertNull(tid);
+
+ /* Check valid values */
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 4);
+ assertNull(tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 15);
+ assertNull(tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 15);
+ assertEquals(Integer.valueOf(11), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 29);
+ assertEquals(Integer.valueOf(20), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 30);
+ assertEquals(Integer.valueOf(21), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 59);
+ assertEquals(Integer.valueOf(11), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 59);
+ assertEquals(Integer.valueOf(30), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 60);
+ assertEquals(Integer.valueOf(11), tid);
+
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 60);
+ assertEquals(Integer.valueOf(21), tid);
+
+ }
+
+ /**
+ * Test the
+ * {@link KernelThreadInformationProvider#getParentPid(KernelAnalysisModule, Integer, long)}
+ * method
+ */
+ @Test
+ public void testGetPpid() {
+ KernelAnalysisModule module = checkNotNull(fModule);
+
+ /* Check with invalid timestamps */
+ Integer ppid = KernelThreadInformationProvider.getParentPid(module, 11, -1);
+ assertNull(ppid);
+
+ ppid = KernelThreadInformationProvider.getParentPid(module, 11, 80);
+ assertNull(ppid);
+
+ /* Check with invalid cpus */
+ ppid = KernelThreadInformationProvider.getParentPid(module, -4, 20);
+ assertNull(ppid);
+
+ ppid = KernelThreadInformationProvider.getParentPid(module, 12, 20);
+ assertNull(ppid);
+
+ /* Check values with no parent */
+ ppid = KernelThreadInformationProvider.getParentPid(module, 10, 20);
+ assertEquals(Integer.valueOf(0), ppid);
+
+ ppid = KernelThreadInformationProvider.getParentPid(module, 30, 60);
+ assertEquals(Integer.valueOf(0), ppid);
+
+ /* Check parent determined at statedump */
+ ppid = KernelThreadInformationProvider.getParentPid(module, 11, 4);
+ assertNull(ppid);
+
+ ppid = KernelThreadInformationProvider.getParentPid(module, 11, 5);
+ assertEquals(Integer.valueOf(10), ppid);
+
+ /* Check parent after process fork */
+ ppid = KernelThreadInformationProvider.getParentPid(module, 21, 25);
+ assertEquals(Integer.valueOf(20), ppid);
+
+ ppid = KernelThreadInformationProvider.getParentPid(module, 21, 70);
+ assertEquals(Integer.valueOf(20), ppid);
+
+ }
+
+ /**
+ * Test the {@link KernelThreadInformationProvider#getExecutableName(KernelAnalysisModule, Integer)} method
+ */
+ @Test
+ public void testGetExecutableName() {
+ KernelAnalysisModule module = checkNotNull(fModule);
+
+ /* Check with invalid threads */
+ String execName = KernelThreadInformationProvider.getExecutableName(module, 101);
+ assertNull(execName);
+
+ execName = KernelThreadInformationProvider.getExecutableName(module, -2);
+ assertNull(execName);
+
+ /* Check valid value */
+ execName = KernelThreadInformationProvider.getExecutableName(module, 20);
+ assertEquals("proc20", execName);
+
+ /* Check valid value with process name change in history */
+ execName = KernelThreadInformationProvider.getExecutableName(module, 21);
+ assertEquals("proc21", execName);
+
+ }
+
+ private static void testIntervals(String info, List<ITmfStateInterval> intervals, ITmfStateValue[] values) {
+ assertEquals(info + " interval count", values.length, intervals.size());
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(info + " interval " + i, values[i], intervals.get(i).getStateValue());
+ }
+ }
+
+ /**
+ * Test the
+ * {@link KernelThreadInformationProvider#getStatusIntervalsForThread(KernelAnalysisModule, Integer, long, long, long, IProgressMonitor)}
+ * method
+ */
+ @Test
+ public void testGetStatusIntervalsForThread() {
+ KernelAnalysisModule module = checkNotNull(fModule);
+
+ IProgressMonitor monitor = new NullProgressMonitor();
+ Integer process21 = 21;
+ Integer process20 = 20;
+
+ /* Check invalid time ranges */
+ List<ITmfStateInterval> intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, -15, -5, 3, monitor);
+ assertTrue(intervals.isEmpty());
+
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 80, 1500000000L, 50, monitor);
+ assertTrue(intervals.isEmpty());
+
+ /* Check invalid quarks */
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, -1, 0, 70L, 3, monitor);
+ assertTrue(intervals.isEmpty());
+
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, 0, 0, 70L, 3, monitor);
+ assertTrue(intervals.isEmpty());
+
+ /* Check different time ranges and resolutions */
+ ITmfStateValue[] values = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
+ StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
+ StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 0, 70L, 3, monitor);
+ testIntervals("tid 21 [0,70,3]", intervals, values);
+
+ ITmfStateValue[] values2 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE,
+ StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 1, 70L, 30, monitor);
+ testIntervals("tid 21 [0,70,30]", intervals, values2);
+
+ ITmfStateValue[] values3 = { StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
+ StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 25, 50L, 3, monitor);
+ testIntervals("tid 21 [25,50,3]", intervals, values3);
+
+ ITmfStateValue[] values4 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE,
+ StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 0, 70L, 3, monitor);
+ testIntervals("tid 20 [0,70,3]", intervals, values4);
+
+ ITmfStateValue[] values5 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 1, 70L, 30, monitor);
+ testIntervals("tid 20 [0,70,30]", intervals, values5);
+
+ ITmfStateValue[] values6 = { StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE,
+ StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 25, 50L, 3, monitor);
+ testIntervals("tid 20 [25,50,3]", intervals, values6);
+
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 É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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.tests.kernel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelTidAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
+import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+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.TmfTraceUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the {@link KernelTidAspect} class
+ *
+ * @author Geneviève Bastien
+ */
+public class KernelTidAspectTest {
+
+ private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
+
+ // ------------------------------------------------------------------------
+ // Test trace class definition
+ // ------------------------------------------------------------------------
+
+ private ITmfTrace fTrace;
+
+ private static void deleteSuppFiles(ITmfTrace trace) {
+ /* Remove supplementary files */
+ File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
+ for (File file : suppDir.listFiles()) {
+ file.delete();
+ }
+ }
+
+ /**
+ * Test setup
+ */
+ @Before
+ public void setUp() {
+ ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
+ deleteSuppFiles(trace);
+ /* Make sure the Kernel analysis has run */
+ ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
+ IAnalysisModule module = null;
+ for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
+ module = mod;
+ }
+ assertNotNull(module);
+ module.schedule();
+ module.waitForCompletion();
+ fTrace = trace;
+ }
+
+ /**
+ * Test clean up
+ */
+ @After
+ public void tearDown() {
+ fTrace.dispose();
+ }
+
+ private void resolveNextEvent(ITmfContext context, Integer tid) {
+ ITmfTrace trace = fTrace;
+ ITmfEvent event = trace.getNext(context);
+ assertNotNull(event);
+
+ Object tidObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(trace, KernelTidAspect.class, event);
+ if (tid == null) {
+ assertNull(tidObj);
+ } else {
+ assertNotNull(tidObj);
+ assertEquals(tid, tidObj);
+ }
+ }
+
+ /**
+ * Test the {@link KernelTidAspect#resolve(ITmfEvent)} method method
+ */
+ @Test
+ public void testResolveTidAspect() {
+
+ ITmfContext context = fTrace.seekEvent(0L);
+ resolveNextEvent(context, null);
+ resolveNextEvent(context, null);
+ resolveNextEvent(context, null);
+ resolveNextEvent(context, 11);
+ resolveNextEvent(context, null);
+ resolveNextEvent(context, null);
+ resolveNextEvent(context, 20);
+ resolveNextEvent(context, 20);
+ resolveNextEvent(context, 21);
+ resolveNextEvent(context, 11);
+ resolveNextEvent(context, 30);
+ resolveNextEvent(context, 21);
+ resolveNextEvent(context, 20);
+ }
+
+}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- * Copyright (c) 2010, 2011 École Polytechnique de Montréal
- * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
- *
- * 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.kernelanalysis;
-
-import static org.junit.Assert.assertEquals;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
-import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
-import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for the {@link KernelStateProvider}
- *
- * @author Alexandre Montplaisir
- */
-public class KernelStateProviderTest {
-
- private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
-
- private IKernelTrace fTrace;
- private ITmfStateProvider fInput;
-
- /**
- * Set-up.
- */
- @Before
- public void initialize() {
- IKernelTrace thetrace = KERNEL_TEST_CASE.getKernelTrace();
- fTrace = thetrace;
- fInput = new KernelStateProvider(thetrace, thetrace.getKernelEventLayout());
- }
-
- /**
- * Class teardown
- */
- @After
- public void classTeardown() {
- if (fTrace != null) {
- fTrace.dispose();
- }
- }
-
- /**
- * Test loading the state provider.
- */
- @Test
- public void testOpening() {
- long testStartTime;
- testStartTime = fInput.getStartTime();
- /* Expected start time of the trace */
- assertEquals(testStartTime, 1L);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 É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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.tests.kernelanalysis;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
-import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
-import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
-import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
-import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-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.TmfTraceUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Test analysis-specific methods for the {@link KernelAnalysisModule} class.
- *
- * @author Geneviève Bastien
- */
-public class KernelThreadInformationProviderTest {
-
- private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
-
- private ITmfTrace fTrace;
- private KernelAnalysisModule fModule;
-
- private static void deleteSuppFiles(ITmfTrace trace) {
- /* Remove supplementary files */
- File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
- for (File file : suppDir.listFiles()) {
- file.delete();
- }
- }
-
- /**
- * Setup the trace for the tests
- */
- @Before
- public void setUp() {
- ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
- deleteSuppFiles(trace);
- ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
- IAnalysisModule module = null;
- for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
- module = mod;
- }
- assertNotNull(module);
- module.schedule();
- module.waitForCompletion();
- fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
- fTrace = trace;
- }
-
- /**
- * Clean up
- */
- @After
- public void tearDown() {
- deleteSuppFiles(fTrace);
- fTrace.dispose();
- }
-
- /**
- * Test the
- * {@link KernelThreadInformationProvider#getThreadIds(KernelAnalysisModule)}
- * method
- */
- @Test
- public void testGetThreadQuarks() {
- KernelAnalysisModule module = checkNotNull(fModule);
- Collection<Integer> threadIds = KernelThreadInformationProvider.getThreadIds(module);
- assertEquals(ImmutableSet.<Integer>of(10,11,20,21,30,100), threadIds);
- }
-
- /**
- * Test the
- * {@link KernelThreadInformationProvider#getThreadOnCpu(KernelAnalysisModule, long, long)}
- * method
- */
- @Test
- public void testGetThreadOnCpu() {
- KernelAnalysisModule module = checkNotNull(fModule);
-
- /* Check with invalid timestamps */
- Integer tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, -1);
- assertNull(tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 80);
- assertNull(tid);
-
- /* Check with invalid cpus */
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 2, 20);
- assertNull(tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, -1, 20);
- assertNull(tid);
-
- /* Check valid values */
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 4);
- assertNull(tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 15);
- assertNull(tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 15);
- assertEquals(Integer.valueOf(11), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 29);
- assertEquals(Integer.valueOf(20), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 30);
- assertEquals(Integer.valueOf(21), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 59);
- assertEquals(Integer.valueOf(11), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 59);
- assertEquals(Integer.valueOf(30), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 60);
- assertEquals(Integer.valueOf(11), tid);
-
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 1, 60);
- assertEquals(Integer.valueOf(21), tid);
-
- }
-
- /**
- * Test the
- * {@link KernelThreadInformationProvider#getParentPid(KernelAnalysisModule, Integer, long)}
- * method
- */
- @Test
- public void testGetPpid() {
- KernelAnalysisModule module = checkNotNull(fModule);
-
- /* Check with invalid timestamps */
- Integer ppid = KernelThreadInformationProvider.getParentPid(module, 11, -1);
- assertNull(ppid);
-
- ppid = KernelThreadInformationProvider.getParentPid(module, 11, 80);
- assertNull(ppid);
-
- /* Check with invalid cpus */
- ppid = KernelThreadInformationProvider.getParentPid(module, -4, 20);
- assertNull(ppid);
-
- ppid = KernelThreadInformationProvider.getParentPid(module, 12, 20);
- assertNull(ppid);
-
- /* Check values with no parent */
- ppid = KernelThreadInformationProvider.getParentPid(module, 10, 20);
- assertEquals(Integer.valueOf(0), ppid);
-
- ppid = KernelThreadInformationProvider.getParentPid(module, 30, 60);
- assertEquals(Integer.valueOf(0), ppid);
-
- /* Check parent determined at statedump */
- ppid = KernelThreadInformationProvider.getParentPid(module, 11, 4);
- assertNull(ppid);
-
- ppid = KernelThreadInformationProvider.getParentPid(module, 11, 5);
- assertEquals(Integer.valueOf(10), ppid);
-
- /* Check parent after process fork */
- ppid = KernelThreadInformationProvider.getParentPid(module, 21, 25);
- assertEquals(Integer.valueOf(20), ppid);
-
- ppid = KernelThreadInformationProvider.getParentPid(module, 21, 70);
- assertEquals(Integer.valueOf(20), ppid);
-
- }
-
- /**
- * Test the {@link KernelThreadInformationProvider#getExecutableName(KernelAnalysisModule, Integer)} method
- */
- @Test
- public void testGetExecutableName() {
- KernelAnalysisModule module = checkNotNull(fModule);
-
- /* Check with invalid threads */
- String execName = KernelThreadInformationProvider.getExecutableName(module, 101);
- assertNull(execName);
-
- execName = KernelThreadInformationProvider.getExecutableName(module, -2);
- assertNull(execName);
-
- /* Check valid value */
- execName = KernelThreadInformationProvider.getExecutableName(module, 20);
- assertEquals("proc20", execName);
-
- /* Check valid value with process name change in history */
- execName = KernelThreadInformationProvider.getExecutableName(module, 21);
- assertEquals("proc21", execName);
-
- }
-
- private static void testIntervals(String info, List<ITmfStateInterval> intervals, ITmfStateValue[] values) {
- assertEquals(info + " interval count", values.length, intervals.size());
- for (int i = 0; i < values.length; i++) {
- assertEquals(info + " interval " + i, values[i], intervals.get(i).getStateValue());
- }
- }
-
- /**
- * Test the
- * {@link KernelThreadInformationProvider#getStatusIntervalsForThread(KernelAnalysisModule, Integer, long, long, long, IProgressMonitor)}
- * method
- */
- @Test
- public void testGetStatusIntervalsForThread() {
- KernelAnalysisModule module = checkNotNull(fModule);
-
- IProgressMonitor monitor = new NullProgressMonitor();
- Integer process21 = 21;
- Integer process20 = 20;
-
- /* Check invalid time ranges */
- List<ITmfStateInterval> intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, -15, -5, 3, monitor);
- assertTrue(intervals.isEmpty());
-
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 80, 1500000000L, 50, monitor);
- assertTrue(intervals.isEmpty());
-
- /* Check invalid quarks */
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, -1, 0, 70L, 3, monitor);
- assertTrue(intervals.isEmpty());
-
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, 0, 0, 70L, 3, monitor);
- assertTrue(intervals.isEmpty());
-
- /* Check different time ranges and resolutions */
- ITmfStateValue[] values = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
- StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
- StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 0, 70L, 3, monitor);
- testIntervals("tid 21 [0,70,3]", intervals, values);
-
- ITmfStateValue[] values2 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE,
- StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 1, 70L, 30, monitor);
- testIntervals("tid 21 [0,70,30]", intervals, values2);
-
- ITmfStateValue[] values3 = { StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
- StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 25, 50L, 3, monitor);
- testIntervals("tid 21 [25,50,3]", intervals, values3);
-
- ITmfStateValue[] values4 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE,
- StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 0, 70L, 3, monitor);
- testIntervals("tid 20 [0,70,3]", intervals, values4);
-
- ITmfStateValue[] values5 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 1, 70L, 30, monitor);
- testIntervals("tid 20 [0,70,30]", intervals, values5);
-
- ITmfStateValue[] values6 = { StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE,
- StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 25, 50L, 3, monitor);
- testIntervals("tid 20 [25,50,3]", intervals, values6);
-
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 É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
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.tests.kernelanalysis;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelTidAspect;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
-import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
-import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-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.TmfTraceUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test the {@link KernelTidAspect} class
- *
- * @author Geneviève Bastien
- */
-public class KernelTidAspectTest {
-
- private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
-
- // ------------------------------------------------------------------------
- // Test trace class definition
- // ------------------------------------------------------------------------
-
- private ITmfTrace fTrace;
-
- private static void deleteSuppFiles(ITmfTrace trace) {
- /* Remove supplementary files */
- File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
- for (File file : suppDir.listFiles()) {
- file.delete();
- }
- }
-
- /**
- * Test setup
- */
- @Before
- public void setUp() {
- ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace();
- deleteSuppFiles(trace);
- /* Make sure the Kernel analysis has run */
- ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
- IAnalysisModule module = null;
- for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) {
- module = mod;
- }
- assertNotNull(module);
- module.schedule();
- module.waitForCompletion();
- fTrace = trace;
- }
-
- /**
- * Test clean up
- */
- @After
- public void tearDown() {
- fTrace.dispose();
- }
-
- private void resolveNextEvent(ITmfContext context, Integer tid) {
- ITmfTrace trace = fTrace;
- ITmfEvent event = trace.getNext(context);
- assertNotNull(event);
-
- Object tidObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(trace, KernelTidAspect.class, event);
- if (tid == null) {
- assertNull(tidObj);
- } else {
- assertNotNull(tidObj);
- assertEquals(tid, tidObj);
- }
- }
-
- /**
- * Test the {@link KernelTidAspect#resolve(ITmfEvent)} method method
- */
- @Test
- public void testResolveTidAspect() {
-
- ITmfContext context = fTrace.seekEvent(0L);
- resolveNextEvent(context, null);
- resolveNextEvent(context, null);
- resolveNextEvent(context, null);
- resolveNextEvent(context, 11);
- resolveNextEvent(context, null);
- resolveNextEvent(context, null);
- resolveNextEvent(context, 20);
- resolveNextEvent(context, 20);
- resolveNextEvent(context, 21);
- resolveNextEvent(context, 11);
- resolveNextEvent(context, 30);
- resolveNextEvent(context, 21);
- resolveNextEvent(context, 20);
- }
-
-}
package org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelTidAspect;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.ThreadPriorityAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelTidAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.ThreadPriorityAspect;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
Export-Package: org.eclipse.tracecompass.analysis.os.linux.core.contextswitch,
org.eclipse.tracecompass.analysis.os.linux.core.cpuusage,
org.eclipse.tracecompass.analysis.os.linux.core.event.aspect,
- org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis,
+ org.eclipse.tracecompass.analysis.os.linux.core.kernel,
org.eclipse.tracecompass.analysis.os.linux.core.latency,
org.eclipse.tracecompass.analysis.os.linux.core.model,
org.eclipse.tracecompass.analysis.os.linux.core.signals,
<extension
point="org.eclipse.linuxtools.tmf.core.analysis">
<module
- analysis_module="org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule"
+ analysis_module="org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule"
automatic="true"
id="org.eclipse.tracecompass.analysis.os.linux.kernel"
name="%analysis.linuxkernel">
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import java.util.Map;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 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.kernel;
+
+/**
+ * This file defines all the attribute names used in the handler. Both the
+ * construction and query steps should use them.
+ *
+ * These should not be externalized! The values here are used as-is in the
+ * history file on disk, so they should be kept the same to keep the file format
+ * compatible. If a view shows attribute names directly, the localization should
+ * be done on the viewer side.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+@SuppressWarnings({"nls", "javadoc"})
+public interface Attributes {
+
+ /* First-level attributes */
+ String CPUS = "CPUs";
+ String THREADS = "Threads";
+
+ /* Sub-attributes of the CPU nodes */
+ String CURRENT_THREAD = "Current_thread";
+ String STATUS = "Status";
+ String SOFT_IRQS = "Soft_IRQs";
+ String IRQS = "IRQs";
+
+ /* Sub-attributes of the Thread nodes */
+ String PPID = "PPID";
+ //static final String STATUS = "Status"
+ String EXEC_NAME = "Exec_name";
+
+ /** @since 1.0 */
+ String PRIO = "Prio";
+ String SYSTEM_CALL = "System_call";
+
+ /* Misc stuff */
+ String UNKNOWN = "Unknown";
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 É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:
+ * Geneviève Bastien - Initial API and implementation
+ * Mathieu Rail - Provide the requirements of the analysis
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Collections;
+import java.util.Set;
+
+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.common.core.NonNullUtils;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
+import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
+import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
+import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * State System Module for lttng kernel traces
+ *
+ * @author Geneviève Bastien
+ * @since 2.0
+ */
+public class KernelAnalysisModule extends TmfStateSystemAnalysisModule {
+
+ /**
+ * The file name of the History Tree
+ */
+ public static final String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
+
+ /** The ID of this analysis module */
+ public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
+
+ /*
+ * TODO: Decide which events should be mandatory for the analysis, once the
+ * appropriate error messages and session setup are in place.
+ */
+// private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
+//
+// private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
+ // FIXME These cannot be declared statically anymore, they depend on
+ // the OriginTracer of the kernel trace.
+ // LttngStrings.EXIT_SYSCALL,
+ // LttngStrings.IRQ_HANDLER_ENTRY,
+ // LttngStrings.IRQ_HANDLER_EXIT,
+ // LttngStrings.SOFTIRQ_ENTRY,
+ // LttngStrings.SOFTIRQ_EXIT,
+ // LttngStrings.SOFTIRQ_RAISE,
+ // LttngStrings.SCHED_PROCESS_FORK,
+ // LttngStrings.SCHED_PROCESS_EXIT,
+ // LttngStrings.SCHED_PROCESS_FREE,
+ // LttngStrings.SCHED_SWITCH,
+ // LttngStrings.STATEDUMP_PROCESS_STATE,
+ // LttngStrings.SCHED_WAKEUP,
+ // LttngStrings.SCHED_WAKEUP_NEW,
+ //
+ // /* FIXME Add the prefix for syscalls */
+ // LttngStrings.SYSCALL_PREFIX
+ // );
+
+ /** The requirements as an immutable set */
+ private static final Set<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);
+//
+// TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
+// eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
+//
+// REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
+ REQUIREMENTS = Collections.EMPTY_SET;
+ }
+
+ @Override
+ protected @NonNull ITmfStateProvider createStateProvider() {
+ ITmfTrace trace = checkNotNull(getTrace());
+ IKernelAnalysisEventLayout layout;
+
+ if (trace instanceof IKernelTrace) {
+ layout = ((IKernelTrace) trace).getKernelEventLayout();
+ } else {
+ /* Fall-back to the base LttngEventLayout */
+ layout = IKernelAnalysisEventLayout.DEFAULT_LAYOUT;
+ }
+
+ return new KernelStateProvider(trace, layout);
+ }
+
+ @Override
+ @NonNull
+ protected String getSsFileName() {
+ return HISTORY_TREE_FILE_NAME;
+ }
+
+ @Override
+ protected String getFullHelpText() {
+ return NonNullUtils.nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
+ }
+
+ @Override
+ public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
+ return REQUIREMENTS;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 É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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
+import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
+
+/**
+ * Information provider utility class that retrieves thread-related information
+ * from a Linux Kernel Analysis
+ *
+ * @author Geneviève Bastien
+ * @since 2.0
+ */
+public final class KernelThreadInformationProvider {
+
+ private KernelThreadInformationProvider() {
+ }
+
+ /**
+ * Get the ID of the thread running on the CPU at time ts
+ *
+ * TODO: This method may later be replaced by an aspect, when the aspect can
+ * resolve to something that is not an event
+ *
+ * @param module
+ * The lttng kernel analysis instance to run this method on
+ * @param cpuId
+ * The CPU number the process is running on
+ * @param ts
+ * The timestamp at which we want the running process
+ * @return The TID of the thread running on CPU cpuId at time ts or
+ * {@code null} if either no thread is running or we do not know.
+ */
+ public static @Nullable Integer getThreadOnCpu(KernelAnalysisModule module, long cpuId, long ts) {
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return null;
+ }
+ try {
+ int cpuQuark = ss.getQuarkAbsolute(Attributes.CPUS, Long.toString(cpuId), Attributes.CURRENT_THREAD);
+ ITmfStateInterval interval = ss.querySingleState(ts, cpuQuark);
+ ITmfStateValue val = interval.getStateValue();
+ switch (val.getType()) {
+ case INTEGER:
+ return val.unboxInt();
+ case LONG:
+ case DOUBLE:
+ case NULL:
+ case STRING:
+ default:
+ break;
+ }
+ } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ }
+ return null;
+ }
+
+ /**
+ * Get the TIDs of the threads from an analysis
+ *
+ * @param module
+ * The lttng kernel analysis instance to run this method on
+ * @return The set of TIDs corresponding to the threads
+ */
+ public static Collection<Integer> getThreadIds(KernelAnalysisModule module) {
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return Collections.EMPTY_SET;
+ }
+ int threadQuark;
+ try {
+ threadQuark = ss.getQuarkAbsolute(Attributes.THREADS);
+ Set<@NonNull Integer> tids = new TreeSet<>();
+ for (Integer quark : ss.getSubAttributes(threadQuark, false)) {
+ tids.add(Integer.parseInt(ss.getAttributeName(quark)));
+ }
+ return tids;
+ } catch (AttributeNotFoundException e) {
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * Get the parent process ID of a thread
+ *
+ * @param module
+ * The lttng kernel analysis instance to run this method on
+ * @param threadId
+ * The thread ID of the process for which to get the parent
+ * @param ts
+ * The timestamp at which to get the parent
+ * @return The parent PID or {@code null} if the PPID is not found.
+ */
+ public static @Nullable Integer getParentPid(KernelAnalysisModule module, Integer threadId, long ts) {
+ Integer ppid = null;
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return ppid;
+ }
+ Integer ppidNode;
+ try {
+ ppidNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.PPID);
+ ITmfStateInterval ppidInterval = ss.querySingleState(ts, ppidNode);
+ ITmfStateValue ppidValue = ppidInterval.getStateValue();
+
+ switch (ppidValue.getType()) {
+ case INTEGER:
+ ppid = NonNullUtils.checkNotNull(Integer.valueOf(ppidValue.unboxInt()));
+ break;
+ case DOUBLE:
+ case LONG:
+ case NULL:
+ case STRING:
+ default:
+ break;
+ }
+ } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ }
+ return ppid;
+ }
+
+ /**
+ * Get the executable name of the thread ID. If the thread ID was used
+ * multiple time or the name changed in between, it will return the last
+ * name the thread has taken, or {@code null} if no name is found
+ *
+ * @param module
+ * The lttng kernel analysis instance to run this method on
+ * @param threadId
+ * The thread ID of the process for which to get the name
+ * @return The last executable name of this process, or {@code null} if not
+ * found
+ */
+ public static @Nullable String getExecutableName(KernelAnalysisModule module, Integer threadId) {
+ String execName = null;
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return execName;
+ }
+ Integer execNameNode;
+ try {
+ execNameNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.EXEC_NAME);
+ List<ITmfStateInterval> execNameIntervals = StateSystemUtils.queryHistoryRange(ss, execNameNode, ss.getStartTime(), ss.getCurrentEndTime());
+
+ ITmfStateValue execNameValue;
+ for (ITmfStateInterval interval : execNameIntervals) {
+ execNameValue = interval.getStateValue();
+ switch (execNameValue.getType()) {
+ case STRING:
+ execName = execNameValue.unboxStr();
+ break;
+ case DOUBLE:
+ case LONG:
+ case NULL:
+ case INTEGER:
+ default:
+ break;
+ }
+ }
+ } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ }
+ return execName;
+ }
+
+ /**
+ * Get the priority of a thread running at a time ts.
+ *
+ * @param module
+ * The kernel analysis instance to run this method on
+ * @param threadId
+ * The thread ID of the target thread
+ * @param ts
+ * The timestamp at which to get the priority
+ * @return The priority of this thread, or {@code null} if not found
+ */
+ public static @Nullable Integer getThreadPrio(KernelAnalysisModule module, Integer threadId, long ts) {
+ Integer execPrio = null;
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return execPrio;
+ }
+ try {
+ int execPrioQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.PRIO);
+ ITmfStateInterval interval = ss.querySingleState(ts, execPrioQuark);
+ ITmfStateValue prioValue = interval.getStateValue();
+ /* We know the prio must be an Integer */
+ execPrio = prioValue.unboxInt();
+ } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ }
+ return execPrio;
+ }
+
+ /**
+ * Get the status intervals for a given thread with a resolution
+ *
+ * @param module
+ * The lttng kernel analysis instance to run this method on
+ * @param threadId
+ * The ID of the thread to get the intervals for
+ * @param start
+ * The start time of the requested range
+ * @param end
+ * The end time of the requested range
+ * @param resolution
+ * The resolution or the minimal time between the requested
+ * intervals. If interval times are smaller than resolution, only
+ * the first interval is returned, the others are ignored.
+ * @param monitor
+ * A progress monitor for this task
+ * @return The list of status intervals for this thread, an empty list is
+ * returned if either the state system is {@code null} or the quark
+ * is not found
+ */
+ public static List<ITmfStateInterval> getStatusIntervalsForThread(KernelAnalysisModule module, Integer threadId, long start, long end, long resolution, IProgressMonitor monitor) {
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return Collections.EMPTY_LIST;
+ }
+
+ try {
+ int threadQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString());
+ int statusQuark = ss.getQuarkRelative(threadQuark, Attributes.STATUS);
+ List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ss, statusQuark, Math.max(start, ss.getStartTime()), Math.min(end - 1, ss.getCurrentEndTime()), resolution, monitor);
+ return statusIntervals;
+ } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 É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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.analysis.os.linux.core.event.aspect.LinuxTidAspect;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+
+/**
+ * This aspect finds the ID of the thread running from this event using the
+ * {@link KernelAnalysisModule}.
+ *
+ * @author Geneviève Bastien
+ * @since 2.0
+ */
+public final class KernelTidAspect extends LinuxTidAspect {
+
+ /** The singleton instance */
+ public static final KernelTidAspect INSTANCE = new KernelTidAspect();
+
+ private KernelTidAspect() {
+ }
+
+ @Override
+ public @Nullable Integer resolve(ITmfEvent event) {
+ /* Find the CPU this event is run on */
+ Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(),
+ TmfCpuAspect.class, event);
+ if (cpu == null) {
+ return null;
+ }
+
+ /* Find the analysis module for the trace */
+ KernelAnalysisModule analysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(),
+ KernelAnalysisModule.class, KernelAnalysisModule.ID);
+ if (analysis == null) {
+ return null;
+ }
+ Integer tid = KernelThreadInformationProvider.getThreadOnCpu(
+ analysis, cpu, event.getTimestamp().getValue());
+ if (tid != null) {
+ return tid;
+ }
+ return null;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
+ *
+ * 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.kernel;
+
+/**
+ * Definitions of values used in the Linux kernel code.
+ *
+ * Instead of using "magic numbers" in state providers, the definitions should
+ * be added here first.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public interface LinuxValues {
+
+ /**
+ * Process states found in scheduler events.
+ *
+ * From include/linux/sched.h
+ *
+ * <pre>
+ * #define TASK_RUNNING 0
+ * #define TASK_INTERRUPTIBLE 1
+ * #define TASK_UNINTERRUPTIBLE 2
+ * #define __TASK_STOPPED 4
+ * #define __TASK_TRACED 8
+ * #define EXIT_DEAD 16
+ * #define EXIT_ZOMBIE 32
+ * #define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
+ * #define TASK_DEAD 64
+ * #define TASK_WAKEKILL 128
+ * #define TASK_WAKING 256
+ * #define TASK_PARKED 512
+ * #define TASK_STATE_MAX 1024
+ * </pre>
+ */
+ /**
+ * The task is running normally, can be interrupted, in a syscall or user
+ * mode.
+ */
+ int TASK_STATE_RUNNING = 0;
+
+ /**
+ * The process is in an interruptible sleep, (waiting for an event to
+ * complete)
+ */
+ int TASK_INTERRUPTIBLE = 1;
+
+ /**
+ * The process is in an uninteruptible sleep, (usually waiting on IO)
+ */
+ int TASK_UNINTERRUPTIBLE = 2;
+
+ /**
+ * The process is stopped, it is waiting for a SIGCONT
+ */
+ int TASK_STOPPED__ = 4;
+
+ /**
+ * The process is being monitored by other processes like a debugger
+ */
+ int TASK_TRACED__ = 8;
+
+ /**
+ * The task is terminated. It is lingering waiting for a parent to reap it.
+ */
+ int EXIT_ZOMBIE = 16;
+
+ /**
+ * The final state, the process reaches this state when being reaped. This
+ * state should not be seen.
+ */
+ int EXIT_DEAD = 32;
+
+ /**
+ * The task is dead, that means the PID can be re-used.
+ */
+ int TASK_DEAD = 64;
+
+ /**
+ * The task will wake up only on kill signals
+ */
+ int TASK_WAKEKILL = 128;
+
+ /**
+ * A task is being woken up, should not appear in sched switch, but if we
+ * poll.
+ */
+ int TASK_WAKING = 256;
+
+ /**
+ * A very deep sleep that can only be woken by an unpark wakeup
+ */
+ int TASK_PARK = 512;
+
+ /**
+ * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX
+ * - 1 is useful to mask the task state.
+ */
+ int TASK_STATE_MAX = 1024;
+
+ /**
+ * Process statuses, used in LTTng statedump events.
+ *
+ * This is LTTng-specific, but the statedump are handled at this level, so
+ * it makes sense to add those definitions here.
+ *
+ * Taken from lttng-module's lttng-statedump-impl.c:
+ *
+ * <pre>
+ * enum lttng_process_status {
+ * LTTNG_UNNAMED = 0,
+ * LTTNG_WAIT_FORK = 1,
+ * LTTNG_WAIT_CPU = 2,
+ * LTTNG_EXIT = 3,
+ * LTTNG_ZOMBIE = 4,
+ * LTTNG_WAIT = 5,
+ * LTTNG_RUN = 6,
+ * LTTNG_DEAD = 7,
+ * };
+ * </pre>
+ */
+
+ /** Task is initially preempted */
+ int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2;
+
+ /** Task is initially blocked */
+ int STATEDUMP_PROCESS_STATUS_WAIT = 5;
+
+ /**
+ * SoftIRQ definitions
+ *
+ * From linux/interrupt.h
+ *
+ * <pre>
+ * enum
+ * {
+ * HI_SOFTIRQ=0,
+ * TIMER_SOFTIRQ,
+ * NET_TX_SOFTIRQ,
+ * NET_RX_SOFTIRQ,
+ * BLOCK_SOFTIRQ,
+ * BLOCK_IOPOLL_SOFTIRQ,
+ * TASKLET_SOFTIRQ,
+ * SCHED_SOFTIRQ,
+ * HRTIMER_SOFTIRQ,
+ * RCU_SOFTIRQ,
+ * NR_SOFTIRQS // not used as this is the NUMBER of softirqs
+ * };
+ * </pre>
+ */
+
+ /** High-priority tasklet */
+ int SOFTIRQ_HI = 0;
+
+ /** Interrupted because of timer */
+ int SOFTIRQ_TIMER = 1;
+
+ /** Interrupted because of network transmission */
+ int SOFTIRQ_NET_TX = 2;
+
+ /** Interrupted because of network reception */
+ int SOFTIRQ_NET_RX = 3;
+
+ /** Interrupted because of block operation */
+ int SOFTIRQ_BLOCK = 4;
+
+ /** Interrupted because of block IO */
+ int SOFTIRQ_BLOCK_IOPOLL = 5;
+
+ /** Tasklet (differed device interrupt) */
+ int SOFTIRQ_TASKLET = 6;
+
+ /** Interrupted because of the scheduler */
+ int SOFTIRQ_SCHED = 7;
+
+ /** Interrupted because of HR timer */
+ int SOFTIRQ_HRTIMER = 8;
+
+ /** Interrupted because of RCU */
+ int SOFTIRQ_RCU = 9;
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 É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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Externalized message strings from the LTTng Kernel Analysis
+ *
+ * @author Geneviève Bastien
+ * @since 2.0
+ */
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.tracecompass.analysis.os.linux.core.kernel.messages"; //$NON-NLS-1$
+
+ public static @Nullable String AspectName_Prio;
+
+ public static @Nullable String AspectHelpText_Prio;
+
+ public static @Nullable String LttngKernelAnalysisModule_Help;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
+import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
+
+/**
+ * State values that are used in the kernel event handler. It's much better to
+ * use integer values whenever possible, since those take much less space in the
+ * history file.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+@SuppressWarnings("javadoc")
+public interface StateValues {
+
+ /* Process status */
+ int PROCESS_STATUS_UNKNOWN = 0;
+ int PROCESS_STATUS_WAIT_BLOCKED = 1;
+ int PROCESS_STATUS_RUN_USERMODE = 2;
+ int PROCESS_STATUS_RUN_SYSCALL = 3;
+ int PROCESS_STATUS_INTERRUPTED = 4;
+ int PROCESS_STATUS_WAIT_FOR_CPU = 5;
+ int PROCESS_STATUS_WAIT_UNKNOWN = 6;
+
+ ITmfStateValue PROCESS_STATUS_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_UNKNOWN);
+ ITmfStateValue PROCESS_STATUS_WAIT_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_UNKNOWN);
+ ITmfStateValue PROCESS_STATUS_WAIT_BLOCKED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_BLOCKED);
+ ITmfStateValue PROCESS_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_USERMODE);
+ ITmfStateValue PROCESS_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_SYSCALL);
+ ITmfStateValue PROCESS_STATUS_INTERRUPTED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_INTERRUPTED);
+ ITmfStateValue PROCESS_STATUS_WAIT_FOR_CPU_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_FOR_CPU);
+
+ /* CPU Status */
+ int CPU_STATUS_IDLE = 0;
+ /**
+ * Soft IRQ raised, could happen in the CPU attribute but should not since
+ * this means that the CPU went idle when a softirq was raised.
+ */
+ int CPU_STATUS_SOFT_IRQ_RAISED = (1 << 0);
+ int CPU_STATUS_RUN_USERMODE = (1 << 1);
+ int CPU_STATUS_RUN_SYSCALL = (1 << 2);
+ int CPU_STATUS_SOFTIRQ = (1 << 3);
+ int CPU_STATUS_IRQ = (1 << 4);
+
+ ITmfStateValue CPU_STATUS_IDLE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IDLE);
+ ITmfStateValue CPU_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_USERMODE);
+ ITmfStateValue CPU_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_SYSCALL);
+ ITmfStateValue CPU_STATUS_IRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IRQ);
+ ITmfStateValue CPU_STATUS_SOFTIRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFTIRQ);
+
+ /** Soft IRQ is raised, CPU is in user mode */
+ ITmfStateValue SOFT_IRQ_RAISED_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED);
+
+ /** If the softirq is running and another is raised at the same time. */
+ ITmfStateValue SOFT_IRQ_RAISED_RUNNING_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED | CPU_STATUS_SOFTIRQ);
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Keba AG
+ *
+ * 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:
+ * Christian Mansky - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+
+/**
+ * This aspect finds the priority of the thread running from this event using
+ * the {@link KernelAnalysisModule}.
+ *
+ * @author Christian Mansky
+ * @since 2.0
+ */
+public final class ThreadPriorityAspect implements ITmfEventAspect {
+
+ /** The singleton instance */
+ public static final ThreadPriorityAspect INSTANCE = new ThreadPriorityAspect();
+
+ private ThreadPriorityAspect() {
+ }
+
+ @Override
+ public final String getName() {
+ return NonNullUtils.nullToEmptyString(Messages.AspectName_Prio);
+ }
+
+ @Override
+ public final String getHelpText() {
+ return NonNullUtils.nullToEmptyString(Messages.AspectHelpText_Prio);
+ }
+
+ @Override
+ public @Nullable Integer resolve(ITmfEvent event) {
+ KernelAnalysisModule kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(), KernelAnalysisModule.class, KernelAnalysisModule.ID);
+ if (kernelAnalysis == null) {
+ return null;
+ }
+
+ Integer tid = KernelTidAspect.INSTANCE.resolve(event);
+ if (tid == null) {
+ return null;
+ }
+
+ Integer prio = KernelThreadInformationProvider.getThreadPrio(kernelAnalysis, tid, event.getTimestamp().getValue());
+ return prio;
+ }
+
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2014, 2015 É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:
+# Geneviève Bastien - Initial API and implementation
+###############################################################################
+
+AspectName_Prio=Prio
+AspectHelpText_Prio=The priority of the thread this event belongs to
+LttngKernelAnalysisModule_Help=Builds the LTTng2 kernel state system to populate the Control Flow view and the Resources View
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 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:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+
+@org.eclipse.jdt.annotation.NonNullByDefault
+package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-/**
- * This file defines all the attribute names used in the handler. Both the
- * construction and query steps should use them.
- *
- * These should not be externalized! The values here are used as-is in the
- * history file on disk, so they should be kept the same to keep the file format
- * compatible. If a view shows attribute names directly, the localization should
- * be done on the viewer side.
- *
- * @author alexmont
- *
- */
-@SuppressWarnings({"nls", "javadoc"})
-public interface Attributes {
-
- /* First-level attributes */
- String CPUS = "CPUs";
- String THREADS = "Threads";
-
- /* Sub-attributes of the CPU nodes */
- String CURRENT_THREAD = "Current_thread";
- String STATUS = "Status";
- String SOFT_IRQS = "Soft_IRQs";
- String IRQS = "IRQs";
-
- /* Sub-attributes of the Thread nodes */
- String PPID = "PPID";
- //static final String STATUS = "Status"
- String EXEC_NAME = "Exec_name";
-
- /** @since 1.0 */
- String PRIO = "Prio";
- String SYSTEM_CALL = "System_call";
-
- /* Misc stuff */
- String UNKNOWN = "Unknown";
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 É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:
- * Geneviève Bastien - Initial API and implementation
- * Mathieu Rail - Provide the requirements of the analysis
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.Collections;
-import java.util.Set;
-
-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.common.core.NonNullUtils;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
-import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
-import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-
-/**
- * State System Module for lttng kernel traces
- *
- * @author Geneviève Bastien
- * @since 1.0
- */
-public class KernelAnalysisModule extends TmfStateSystemAnalysisModule {
-
- /**
- * The file name of the History Tree
- */
- public static final String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
-
- /** The ID of this analysis module */
- public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
-
- /*
- * TODO: Decide which events should be mandatory for the analysis, once the
- * appropriate error messages and session setup are in place.
- */
-// private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
-//
-// private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
- // FIXME These cannot be declared statically anymore, they depend on
- // the OriginTracer of the kernel trace.
- // LttngStrings.EXIT_SYSCALL,
- // LttngStrings.IRQ_HANDLER_ENTRY,
- // LttngStrings.IRQ_HANDLER_EXIT,
- // LttngStrings.SOFTIRQ_ENTRY,
- // LttngStrings.SOFTIRQ_EXIT,
- // LttngStrings.SOFTIRQ_RAISE,
- // LttngStrings.SCHED_PROCESS_FORK,
- // LttngStrings.SCHED_PROCESS_EXIT,
- // LttngStrings.SCHED_PROCESS_FREE,
- // LttngStrings.SCHED_SWITCH,
- // LttngStrings.STATEDUMP_PROCESS_STATE,
- // LttngStrings.SCHED_WAKEUP,
- // LttngStrings.SCHED_WAKEUP_NEW,
- //
- // /* FIXME Add the prefix for syscalls */
- // LttngStrings.SYSCALL_PREFIX
- // );
-
- /** The requirements as an immutable set */
- private static final Set<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);
-//
-// TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
-// eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
-//
-// REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
- REQUIREMENTS = Collections.EMPTY_SET;
- }
-
- @Override
- protected @NonNull ITmfStateProvider createStateProvider() {
- ITmfTrace trace = checkNotNull(getTrace());
- IKernelAnalysisEventLayout layout;
-
- if (trace instanceof IKernelTrace) {
- layout = ((IKernelTrace) trace).getKernelEventLayout();
- } else {
- /* Fall-back to the base LttngEventLayout */
- layout = IKernelAnalysisEventLayout.DEFAULT_LAYOUT;
- }
-
- return new KernelStateProvider(trace, layout);
- }
-
- @Override
- @NonNull
- protected String getSsFileName() {
- return HISTORY_TREE_FILE_NAME;
- }
-
- @Override
- protected String getFullHelpText() {
- return NonNullUtils.nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
- }
-
- @Override
- public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
- return REQUIREMENTS;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 É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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
-import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
-import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
-import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
-import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
-
-/**
- * Information provider utility class that retrieves thread-related information
- * from a Linux Kernel Analysis
- *
- * @author Geneviève Bastien
- */
-public final class KernelThreadInformationProvider {
-
- private KernelThreadInformationProvider() {
- }
-
- /**
- * Get the ID of the thread running on the CPU at time ts
- *
- * TODO: This method may later be replaced by an aspect, when the aspect can
- * resolve to something that is not an event
- *
- * @param module
- * The lttng kernel analysis instance to run this method on
- * @param cpuId
- * The CPU number the process is running on
- * @param ts
- * The timestamp at which we want the running process
- * @return The TID of the thread running on CPU cpuId at time ts or
- * {@code null} if either no thread is running or we do not know.
- * @since 1.0
- */
- public static @Nullable Integer getThreadOnCpu(KernelAnalysisModule module, long cpuId, long ts) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return null;
- }
- try {
- int cpuQuark = ss.getQuarkAbsolute(Attributes.CPUS, Long.toString(cpuId), Attributes.CURRENT_THREAD);
- ITmfStateInterval interval = ss.querySingleState(ts, cpuQuark);
- ITmfStateValue val = interval.getStateValue();
- switch (val.getType()) {
- case INTEGER:
- return val.unboxInt();
- case LONG:
- case DOUBLE:
- case NULL:
- case STRING:
- default:
- break;
- }
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return null;
- }
-
- /**
- * Get the TIDs of the threads from an analysis
- *
- * @param module
- * The lttng kernel analysis instance to run this method on
- * @return The set of TIDs corresponding to the threads
- * @since 1.0
- */
- public static Collection<Integer> getThreadIds(KernelAnalysisModule module) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return Collections.EMPTY_SET;
- }
- int threadQuark;
- try {
- threadQuark = ss.getQuarkAbsolute(Attributes.THREADS);
- Set<@NonNull Integer> tids = new TreeSet<>();
- for (Integer quark : ss.getSubAttributes(threadQuark, false)) {
- tids.add(Integer.parseInt(ss.getAttributeName(quark)));
- }
- return tids;
- } catch (AttributeNotFoundException e) {
- }
- return Collections.EMPTY_SET;
- }
-
- /**
- * Get the parent process ID of a thread
- *
- * @param module
- * The lttng kernel analysis instance to run this method on
- * @param threadId
- * The thread ID of the process for which to get the parent
- * @param ts
- * The timestamp at which to get the parent
- * @return The parent PID or {@code null} if the PPID is not found.
- * @since 1.0
- */
- public static @Nullable Integer getParentPid(KernelAnalysisModule module, Integer threadId, long ts) {
- Integer ppid = null;
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return ppid;
- }
- Integer ppidNode;
- try {
- ppidNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.PPID);
- ITmfStateInterval ppidInterval = ss.querySingleState(ts, ppidNode);
- ITmfStateValue ppidValue = ppidInterval.getStateValue();
-
- switch (ppidValue.getType()) {
- case INTEGER:
- ppid = NonNullUtils.checkNotNull(Integer.valueOf(ppidValue.unboxInt()));
- break;
- case DOUBLE:
- case LONG:
- case NULL:
- case STRING:
- default:
- break;
- }
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return ppid;
- }
-
- /**
- * Get the executable name of the thread ID. If the thread ID was used
- * multiple time or the name changed in between, it will return the last
- * name the thread has taken, or {@code null} if no name is found
- *
- * @param module
- * The lttng kernel analysis instance to run this method on
- * @param threadId
- * The thread ID of the process for which to get the name
- * @return The last executable name of this process, or {@code null} if not
- * found
- * @since 1.0
- */
- public static @Nullable String getExecutableName(KernelAnalysisModule module, Integer threadId) {
- String execName = null;
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return execName;
- }
- Integer execNameNode;
- try {
- execNameNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.EXEC_NAME);
- List<ITmfStateInterval> execNameIntervals = StateSystemUtils.queryHistoryRange(ss, execNameNode, ss.getStartTime(), ss.getCurrentEndTime());
-
- ITmfStateValue execNameValue;
- for (ITmfStateInterval interval : execNameIntervals) {
- execNameValue = interval.getStateValue();
- switch (execNameValue.getType()) {
- case STRING:
- execName = execNameValue.unboxStr();
- break;
- case DOUBLE:
- case LONG:
- case NULL:
- case INTEGER:
- default:
- break;
- }
- }
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return execName;
- }
-
- /**
- * Get the priority of a thread running at a time ts.
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param threadId
- * The thread ID of the target thread
- * @param ts
- * The timestamp at which to get the priority
- * @return The priority of this thread, or {@code null} if not found
- * @since 1.0
- */
- public static @Nullable Integer getThreadPrio(KernelAnalysisModule module, Integer threadId, long ts) {
- Integer execPrio = null;
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return execPrio;
- }
- try {
- int execPrioQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.PRIO);
- ITmfStateInterval interval = ss.querySingleState(ts, execPrioQuark);
- ITmfStateValue prioValue = interval.getStateValue();
- /* We know the prio must be an Integer */
- execPrio = prioValue.unboxInt();
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return execPrio;
- }
-
- /**
- * Get the status intervals for a given thread with a resolution
- *
- * @param module
- * The lttng kernel analysis instance to run this method on
- * @param threadId
- * The ID of the thread to get the intervals for
- * @param start
- * The start time of the requested range
- * @param end
- * The end time of the requested range
- * @param resolution
- * The resolution or the minimal time between the requested
- * intervals. If interval times are smaller than resolution, only
- * the first interval is returned, the others are ignored.
- * @param monitor
- * A progress monitor for this task
- * @return The list of status intervals for this thread, an empty list is
- * returned if either the state system is {@code null} or the quark
- * is not found
- * @since 1.0
- */
- public static List<ITmfStateInterval> getStatusIntervalsForThread(KernelAnalysisModule module, Integer threadId, long start, long end, long resolution, IProgressMonitor monitor) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return Collections.EMPTY_LIST;
- }
-
- try {
- int threadQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString());
- int statusQuark = ss.getQuarkRelative(threadQuark, Attributes.STATUS);
- List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ss, statusQuark, Math.max(start, ss.getStartTime()), Math.min(end - 1, ss.getCurrentEndTime()), resolution, monitor);
- return statusIntervals;
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return Collections.EMPTY_LIST;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 É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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.event.aspect.LinuxTidAspect;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-
-/**
- * This aspect finds the ID of the thread running from this event using the
- * {@link KernelAnalysisModule}.
- *
- * @author Geneviève Bastien
- * @since 1.0
- */
-public final class KernelTidAspect extends LinuxTidAspect {
-
- /** The singleton instance */
- public static final KernelTidAspect INSTANCE = new KernelTidAspect();
-
- private KernelTidAspect() {
- }
-
- @Override
- public @Nullable Integer resolve(ITmfEvent event) {
- /* Find the CPU this event is run on */
- Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(),
- TmfCpuAspect.class, event);
- if (cpu == null) {
- return null;
- }
-
- /* Find the analysis module for the trace */
- KernelAnalysisModule analysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(),
- KernelAnalysisModule.class, KernelAnalysisModule.ID);
- if (analysis == null) {
- return null;
- }
- Integer tid = KernelThreadInformationProvider.getThreadOnCpu(
- analysis, cpu, event.getTimestamp().getValue());
- if (tid != null) {
- return tid;
- }
- return null;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
- *
- * 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.kernelanalysis;
-
-/**
- * Definitions of values used in the Linux kernel code.
- *
- * Instead of using "magic numbers" in state providers, the definitions should
- * be added here first.
- *
- * @author Alexandre Montplaisir
- * @since 2.0
- */
-public interface LinuxValues {
-
- /**
- * Process states found in scheduler events.
- *
- * From include/linux/sched.h
- *
- * <pre>
- * #define TASK_RUNNING 0
- * #define TASK_INTERRUPTIBLE 1
- * #define TASK_UNINTERRUPTIBLE 2
- * #define __TASK_STOPPED 4
- * #define __TASK_TRACED 8
- * #define EXIT_DEAD 16
- * #define EXIT_ZOMBIE 32
- * #define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
- * #define TASK_DEAD 64
- * #define TASK_WAKEKILL 128
- * #define TASK_WAKING 256
- * #define TASK_PARKED 512
- * #define TASK_STATE_MAX 1024
- * </pre>
- */
- /**
- * The task is running normally, can be interrupted, in a syscall or user
- * mode.
- */
- int TASK_STATE_RUNNING = 0;
-
- /**
- * The process is in an interruptible sleep, (waiting for an event to
- * complete)
- */
- int TASK_INTERRUPTIBLE = 1;
-
- /**
- * The process is in an uninteruptible sleep, (usually waiting on IO)
- */
- int TASK_UNINTERRUPTIBLE = 2;
-
- /**
- * The process is stopped, it is waiting for a SIGCONT
- */
- int TASK_STOPPED__ = 4;
-
- /**
- * The process is being monitored by other processes like a debugger
- */
- int TASK_TRACED__ = 8;
-
- /**
- * The task is terminated. It is lingering waiting for a parent to reap it.
- */
- int EXIT_ZOMBIE = 16;
-
- /**
- * The final state, the process reaches this state when being reaped. This
- * state should not be seen.
- */
- int EXIT_DEAD = 32;
-
- /**
- * The task is dead, that means the PID can be re-used.
- */
- int TASK_DEAD = 64;
-
- /**
- * The task will wake up only on kill signals
- */
- int TASK_WAKEKILL = 128;
-
- /**
- * A task is being woken up, should not appear in sched switch, but if we
- * poll.
- */
- int TASK_WAKING = 256;
-
- /**
- * A very deep sleep that can only be woken by an unpark wakeup
- */
- int TASK_PARK = 512;
-
- /**
- * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX
- * - 1 is useful to mask the task state.
- */
- int TASK_STATE_MAX = 1024;
-
- /**
- * Process statuses, used in LTTng statedump events.
- *
- * This is LTTng-specific, but the statedump are handled at this level, so
- * it makes sense to add those definitions here.
- *
- * Taken from lttng-module's lttng-statedump-impl.c:
- *
- * <pre>
- * enum lttng_process_status {
- * LTTNG_UNNAMED = 0,
- * LTTNG_WAIT_FORK = 1,
- * LTTNG_WAIT_CPU = 2,
- * LTTNG_EXIT = 3,
- * LTTNG_ZOMBIE = 4,
- * LTTNG_WAIT = 5,
- * LTTNG_RUN = 6,
- * LTTNG_DEAD = 7,
- * };
- * </pre>
- */
-
- /** Task is initially preempted */
- int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2;
-
- /** Task is initially blocked */
- int STATEDUMP_PROCESS_STATUS_WAIT = 5;
-
- /**
- * SoftIRQ definitions
- *
- * From linux/interrupt.h
- *
- * <pre>
- * enum
- * {
- * HI_SOFTIRQ=0,
- * TIMER_SOFTIRQ,
- * NET_TX_SOFTIRQ,
- * NET_RX_SOFTIRQ,
- * BLOCK_SOFTIRQ,
- * BLOCK_IOPOLL_SOFTIRQ,
- * TASKLET_SOFTIRQ,
- * SCHED_SOFTIRQ,
- * HRTIMER_SOFTIRQ,
- * RCU_SOFTIRQ,
- * NR_SOFTIRQS // not used as this is the NUMBER of softirqs
- * };
- * </pre>
- */
-
- /** High-priority tasklet */
- int SOFTIRQ_HI = 0;
-
- /** Interrupted because of timer */
- int SOFTIRQ_TIMER = 1;
-
- /** Interrupted because of network transmission */
- int SOFTIRQ_NET_TX = 2;
-
- /** Interrupted because of network reception */
- int SOFTIRQ_NET_RX = 3;
-
- /** Interrupted because of block operation */
- int SOFTIRQ_BLOCK = 4;
-
- /** Interrupted because of block IO */
- int SOFTIRQ_BLOCK_IOPOLL = 5;
-
- /** Tasklet (differed device interrupt) */
- int SOFTIRQ_TASKLET = 6;
-
- /** Interrupted because of the scheduler */
- int SOFTIRQ_SCHED = 7;
-
- /** Interrupted because of HR timer */
- int SOFTIRQ_HRTIMER = 8;
-
- /** Interrupted because of RCU */
- int SOFTIRQ_RCU = 9;
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 É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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalized message strings from the LTTng Kernel Analysis
- *
- * @author Geneviève Bastien
- */
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.messages"; //$NON-NLS-1$
-
- /**
- * @since 1.0
- */
- public static @Nullable String AspectName_Prio;
-
- /**
- * @since 1.0
- */
- public static @Nullable String AspectHelpText_Prio;
-
- public static @Nullable String LttngKernelAnalysisModule_Help;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
-import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
-
-/**
- * State values that are used in the kernel event handler. It's much better to
- * use integer values whenever possible, since those take much less space in the
- * history file.
- *
- * @author Alexandre Montplaisir
- */
-@SuppressWarnings("javadoc")
-public interface StateValues {
-
- /* Process status */
- int PROCESS_STATUS_UNKNOWN = 0;
- int PROCESS_STATUS_WAIT_BLOCKED = 1;
- int PROCESS_STATUS_RUN_USERMODE = 2;
- int PROCESS_STATUS_RUN_SYSCALL = 3;
- int PROCESS_STATUS_INTERRUPTED = 4;
- int PROCESS_STATUS_WAIT_FOR_CPU = 5;
- /**
- * @since 1.0
- */
- int PROCESS_STATUS_WAIT_UNKNOWN = 6;
-
- ITmfStateValue PROCESS_STATUS_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_UNKNOWN);
- /**
- * @since 1.0
- */
- ITmfStateValue PROCESS_STATUS_WAIT_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_UNKNOWN);
- ITmfStateValue PROCESS_STATUS_WAIT_BLOCKED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_BLOCKED);
- ITmfStateValue PROCESS_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_USERMODE);
- ITmfStateValue PROCESS_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_SYSCALL);
- ITmfStateValue PROCESS_STATUS_INTERRUPTED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_INTERRUPTED);
- ITmfStateValue PROCESS_STATUS_WAIT_FOR_CPU_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_FOR_CPU);
-
- /* CPU Status */
- int CPU_STATUS_IDLE = 0;
- /**
- * Soft IRQ raised, could happen in the CPU attribute but should not since
- * this means that the CPU went idle when a softirq was raised.
- *
- * @since 2.0
- */
- int CPU_STATUS_SOFT_IRQ_RAISED = (1 << 0);
- int CPU_STATUS_RUN_USERMODE = (1 << 1);
- int CPU_STATUS_RUN_SYSCALL = (1 << 2);
- int CPU_STATUS_SOFTIRQ = (1 << 3);
- int CPU_STATUS_IRQ = (1 << 4);
-
- ITmfStateValue CPU_STATUS_IDLE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IDLE);
- ITmfStateValue CPU_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_USERMODE);
- ITmfStateValue CPU_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_SYSCALL);
- ITmfStateValue CPU_STATUS_IRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IRQ);
- ITmfStateValue CPU_STATUS_SOFTIRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFTIRQ);
-
- /** Soft IRQ is raised, CPU is in user mode */
- ITmfStateValue SOFT_IRQ_RAISED_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED);
-
- /**
- * If the softirq is running and another is raised at the same time.
- *
- * @since 2.0
- */
- ITmfStateValue SOFT_IRQ_RAISED_RUNNING_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED | CPU_STATUS_SOFTIRQ);
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Keba AG
- *
- * 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:
- * Christian Mansky - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-
-/**
- * This aspect finds the priority of the thread running from this event using
- * the {@link KernelAnalysisModule}.
- *
- * @author Christian Mansky
- * @since 1.0
- */
-public final class ThreadPriorityAspect implements ITmfEventAspect {
-
- /** The singleton instance */
- public static final ThreadPriorityAspect INSTANCE = new ThreadPriorityAspect();
-
- private ThreadPriorityAspect() {
- }
-
- @Override
- public final String getName() {
- return NonNullUtils.nullToEmptyString(Messages.AspectName_Prio);
- }
-
- @Override
- public final String getHelpText() {
- return NonNullUtils.nullToEmptyString(Messages.AspectHelpText_Prio);
- }
-
- @Override
- public @Nullable Integer resolve(ITmfEvent event) {
- KernelAnalysisModule kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(), KernelAnalysisModule.class, KernelAnalysisModule.ID);
- if (kernelAnalysis == null) {
- return null;
- }
-
- Integer tid = KernelTidAspect.INSTANCE.resolve(event);
- if (tid == null) {
- return null;
- }
-
- Integer prio = KernelThreadInformationProvider.getThreadPrio(kernelAnalysis, tid, event.getTimestamp().getValue());
- return prio;
- }
-
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014, 2015 É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:
-# Geneviève Bastien - Initial API and implementation
-###############################################################################
-
-AspectName_Prio=Prio
-AspectHelpText_Prio=The priority of the thread this event belongs to
-LttngKernelAnalysisModule_Help=Builds the LTTng2 kernel state system to populate the Control Flow view and the Resources View
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 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:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelTidAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelTidAspect;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.AbstractSegmentStoreAnalysisEventBasedModule;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.LinuxValues;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.LinuxValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.LinuxValues;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.LinuxValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.analysis.os.linux.views.controlflow">
<analysisModuleClass
- class="org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule">
+ class="org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule">
</analysisModuleClass>
</output>
<output
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.analysis.os.linux.views.resources">
<analysisModuleClass
- class="org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule">
+ class="org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule">
</analysisModuleClass>
</output>
<output
package org.eclipse.tracecompass.analysis.os.linux.ui.views.controlflow;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Messages;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.analysis.os.linux.core.cpuusage.KernelCpuUsageAnalysis;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.analysis.os.linux.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Messages;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.test.performance.Dimension;
import org.eclipse.test.performance.Performance;
import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
package org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
/**
* This class is an extension of {@link KernelAnalysisModule} that uses a null
import java.util.List;
import java.util.Set;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.lttng2.control.core.session.SessionConfigStrings;
import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import java.util.List;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VcpuStateValues;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VmAttributes;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.module.VirtualMachineCpuAnalysis;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfVertex;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfVertex.EdgeDirection;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.LinuxValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.LinuxValues;
import org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.common.core.NonNullUtils;
package org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.graph.handlers;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.LinuxValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.LinuxValues;
import org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.Activator;
import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider;
import org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.model.IVirtualMachineModel;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.model.VirtualCPU;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VcpuStateValues;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VmAttributes;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import java.util.Map;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider;
import org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.Activator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelTidAspect;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.ThreadPriorityAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelTidAspect;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.ThreadPriorityAspect;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.Activator;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VcpuStateValues;
import org.eclipse.tracecompass.internal.lttng2.kernel.ui.views.vm.vcpuview.VirtualMachineCommon.Type;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelThreadInformationProvider;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.VmAttributes;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.vm.module.VirtualMachineCpuAnalysis;