lttng: Rename CtfKernelTrace to LttngKernelTrace
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 29 Apr 2013 20:18:22 +0000 (16:18 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 30 Apr 2013 14:53:00 +0000 (10:53 -0400)
Change-Id: I8375a32844988e3a1667e3197e112f1ded17a248
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/12369
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
22 files changed:
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/headless/BasicStateSystemExample.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/headless/GenerateTestValues.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CtfKernelStateProviderTest.java [deleted file]
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/LttngKernelStateProviderTest.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/PartialStateSystemTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemInMemoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/TestAll.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateProvider.java [deleted file]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/LttngKernelStateProvider.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java [deleted file]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngKernelTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Messages.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/messages.properties
org.eclipse.linuxtools.lttng2.kernel.ui/plugin.properties
org.eclipse.linuxtools.lttng2.kernel.ui/plugin.xml
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java

index f2a51772eb0a93bb39ba522baf96da923990938c..9c4d5713138b01534fc4373f3a43505c121bd8fe 100644 (file)
@@ -16,7 +16,7 @@ import java.io.File;
 import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
@@ -43,7 +43,7 @@ public class BasicStateSystemExample {
         /* Read a trace and build the state system */
         try {
             File newStateFile = new File("/tmp/helloworldctf.ht");
-            ITmfStateProvider input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(1));
+            ITmfStateProvider input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(1));
             ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(newStateFile, input, true);
 
             requestExample(ss);
index 059dfc7bd6d7e8ce3660d81bf2ffa1e20d3d178e..9617a94fe1927801d6325b017e1152c7c180c879 100644 (file)
@@ -17,7 +17,7 @@ import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.util.List;
 
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
@@ -61,7 +61,7 @@ public class GenerateTestValues {
         PrintWriter writer = new PrintWriter(new FileWriter(logFile), true);
 
         /* Build and query the state system */
-        ITmfStateProvider input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        ITmfStateProvider input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
         ITmfStateSystem ssq = TmfStateSystemFactory.newFullHistory(stateFile, input, true);
         List<ITmfStateInterval> fullState = ssq.queryFullState(targetTimestamp);
 
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CtfKernelStateProviderTest.java b/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CtfKernelStateProviderTest.java
deleted file mode 100644 (file)
index fc0d63d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.linuxtools.lttng2.kernel.core.tests.stateprovider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests for the {@link CtfKernelStateProvider}
- *
- * @author Alexandre Montplaisir
- */
-public class CtfKernelStateProviderTest {
-
-    private final static int TRACE_INDEX = 1;
-
-    private static ITmfStateProvider input;
-
-    /**
-     * Set-up.
-     */
-    @BeforeClass
-    public static void initialize() {
-        assumeTrue(CtfTmfTestTraces.tracesExist());
-        input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
-
-    }
-
-    /**
-     * Test loading the state provider.
-     */
-    @Test
-    public void testOpening() {
-        long testStartTime;
-        testStartTime = input.getStartTime();
-        assertEquals(testStartTime, StateSystemTest.startTime);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/LttngKernelStateProviderTest.java b/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/LttngKernelStateProviderTest.java
new file mode 100644 (file)
index 0000000..c8dcbab
--- /dev/null
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.linuxtools.lttng2.kernel.core.tests.stateprovider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests for the {@link LttngKernelStateProvider}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class LttngKernelStateProviderTest {
+
+    private final static int TRACE_INDEX = 1;
+
+    private static ITmfStateProvider input;
+
+    /**
+     * Set-up.
+     */
+    @BeforeClass
+    public static void initialize() {
+        assumeTrue(CtfTmfTestTraces.tracesExist());
+        input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+
+    }
+
+    /**
+     * Test loading the state provider.
+     */
+    @Test
+    public void testOpening() {
+        long testStartTime;
+        testStartTime = input.getStartTime();
+        assertEquals(testStartTime, StateSystemTest.startTime);
+    }
+
+}
index 6eb4882c9ccd402e3680003057ff0e785ec92b0e..dda24333aea57f2efabba4c45b41ac110f42f630 100644 (file)
@@ -16,7 +16,7 @@ import static org.junit.Assume.assumeTrue;
 import java.io.File;
 import java.io.IOException;
 
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
@@ -42,7 +42,7 @@ public class PartialStateSystemTest extends StateSystemTest {
             stateFile = File.createTempFile("test-partial", ".ht");
             stateFile.deleteOnExit();
 
-            input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
             ssq = TmfStateSystemFactory.newPartialHistory(stateFile, input, true);
         } catch (IOException e) {
             e.printStackTrace();
index d86df0d4e5e97ca7dc9923796387b7eb503bcf4e..f50f733b90a8fcecd93ae472a0c5b902abfed303 100644 (file)
@@ -20,7 +20,7 @@ import static org.junit.Assume.assumeTrue;
 import java.io.File;
 import java.io.IOException;
 
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
@@ -50,7 +50,7 @@ public class StateSystemFullHistoryTest extends StateSystemTest {
             stateFile = File.createTempFile("test", ".ht");
             stateFileBenchmark = File.createTempFile("test", ".ht.benchmark");
 
-            input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
             ssq = TmfStateSystemFactory.newFullHistory(stateFile, input, true);
         } catch (IOException e) {
             e.printStackTrace();
@@ -73,7 +73,7 @@ public class StateSystemFullHistoryTest extends StateSystemTest {
     @Test
     public void testBuild() {
         try {
-            ITmfStateProvider input2 = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+            ITmfStateProvider input2 = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
             ITmfStateSystem ssb2 = TmfStateSystemFactory.newFullHistory(stateFileBenchmark, input2, true);
 
             assertEquals(startTime, ssb2.getStartTime());
index a661f36ebcaee1560e7ac0b438181bda966ea277..f76c5c2015b8d40cd6d05b0cb9429431c231786b 100644 (file)
@@ -14,7 +14,7 @@ package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider;
 
 import static org.junit.Assume.assumeTrue;
 
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
 import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTraces;
 import org.junit.BeforeClass;
@@ -32,7 +32,7 @@ public class StateSystemInMemoryTest extends StateSystemTest {
     @BeforeClass
     public static void initialize() {
         assumeTrue(CtfTmfTestTraces.tracesExist());
-        input = new CtfKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
+        input = new LttngKernelStateProvider(CtfTmfTestTraces.getTestTrace(TRACE_INDEX));
         ssq = TmfStateSystemFactory.newInMemHistory(input, true);
     }
 }
index 4cbffa917eaa6b399a019188d7268ebc38f0549d..a6c1d589263996514abb48df4b2d8ba55383b6e6 100644 (file)
@@ -20,7 +20,7 @@ import org.junit.runners.Suite;
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-    CtfKernelStateProviderTest.class,
+    LttngKernelStateProviderTest.class,
     PartialStateSystemTest.class,
     StateSystemFullHistoryTest.class,
     StateSystemInMemoryTest.class
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateProvider.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateProvider.java
deleted file mode 100644 (file)
index 77c8065..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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.linuxtools.internal.lttng2.kernel.core.stateprovider;
-
-import java.util.HashMap;
-
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
-import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
-import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
-import org.eclipse.linuxtools.tmf.core.statesystem.AbstractTmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
-import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
-import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
-
-/**
- * This is the state change input plugin for TMF's state system which handles
- * the LTTng 2.0 kernel traces in CTF format.
- *
- * It uses the reference handler defined in CTFKernelHandler.java.
- *
- * @author alexmont
- *
- */
-public class CtfKernelStateProvider extends AbstractTmfStateProvider {
-
-    /**
-     * Version number of this state provider. Please bump this if you modify the
-     * contents of the generated state history in some way.
-     */
-    private static final int VERSION = 2;
-
-    /* Event names HashMap. TODO: This can be discarded once we move to Java 7 */
-    private final HashMap<String, Integer> knownEventNames;
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    /**
-     * Instantiate a new state provider plugin.
-     *
-     * @param trace
-     *            The LTTng 2.0 kernel trace directory
-     */
-    public CtfKernelStateProvider(CtfTmfTrace trace) {
-        super(trace, CtfTmfEvent.class, "LTTng Kernel"); //$NON-NLS-1$
-        knownEventNames = fillEventNames();
-    }
-
-    // ------------------------------------------------------------------------
-    // IStateChangeInput
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int getVersion() {
-        return VERSION;
-    }
-
-    @Override
-    public void assignTargetStateSystem(ITmfStateSystemBuilder ssb) {
-        /* We can only set up the locations once the state system is assigned */
-        super.assignTargetStateSystem(ssb);
-    }
-
-    @Override
-    public CtfKernelStateProvider getNewInstance() {
-        return new CtfKernelStateProvider((CtfTmfTrace) this.getTrace());
-    }
-
-    @Override
-    protected void eventHandle(ITmfEvent ev) {
-        /*
-         * AbstractStateChangeInput should have already checked for the correct
-         * class type
-         */
-        CtfTmfEvent event = (CtfTmfEvent) ev;
-
-        int quark;
-        ITmfStateValue value;
-
-        final ITmfEventField content = event.getContent();
-        final String eventName = event.getEventName();
-        final long ts = event.getTimestamp().getValue();
-
-        try {
-            /* Shortcut for the "current CPU" attribute node */
-            final Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(), String.valueOf(event.getCPU()));
-
-            /*
-             * Shortcut for the "current thread" attribute node. It requires
-             * querying the current CPU's current thread.
-             */
-            quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
-            value = ss.queryOngoingState(quark);
-            int thread = value.unboxInt();
-            final Integer currentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(thread));
-
-            /*
-             * Feed event to the history system if it's known to cause a state
-             * transition.
-             */
-            switch (getEventIndex(eventName)) {
-
-            case 1: // "exit_syscall":
-            /* Fields: int64 ret */
-            {
-                /* Clear the current system call on the process */
-                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
-                value = TmfStateValue.nullValue();
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Put the process' status back to user mode */
-                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_USERMODE);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Put the CPU's status back to user mode */
-                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 2: // "irq_handler_entry":
-            /* Fields: int32 irq, string name */
-            {
-                Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
-
-                /* Mark this IRQ as active in the resource tree.
-                 * The state value = the CPU on which this IRQ is sitting */
-                quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
-                value = TmfStateValue.newValueInt(event.getCPU());
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Change the status of the running process to interrupted */
-                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_INTERRUPTED);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Change the status of the CPU to interrupted */
-                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IRQ);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 3: // "irq_handler_exit":
-            /* Fields: int32 irq, int32 ret */
-            {
-                Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
-
-                /* Put this IRQ back to inactive in the resource tree */
-                quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
-                value = TmfStateValue.nullValue();
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the previous process back to running */
-                setProcessToRunning(ts, currentThreadNode);
-
-                /* Set the CPU status back to running or "idle" */
-                cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
-            }
-                break;
-
-            case 4: // "softirq_entry":
-            /* Fields: int32 vec */
-            {
-                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
-
-                /* Mark this SoftIRQ as active in the resource tree.
-                 * The state value = the CPU on which this SoftIRQ is processed */
-                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
-                value = TmfStateValue.newValueInt(event.getCPU());
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Change the status of the running process to interrupted */
-                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_INTERRUPTED);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Change the status of the CPU to interrupted */
-                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_SOFTIRQ);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 5: // "softirq_exit":
-            /* Fields: int32 vec */
-            {
-                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
-
-                /* Put this SoftIRQ back to inactive (= -1) in the resource tree */
-                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
-                value = TmfStateValue.nullValue();
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the previous process back to running */
-                setProcessToRunning(ts, currentThreadNode);
-
-                /* Set the CPU status back to "busy" or "idle" */
-                cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
-            }
-                break;
-
-            case 6: // "softirq_raise":
-            /* Fields: int32 vec */
-            {
-                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
-
-                /* Mark this SoftIRQ as *raised* in the resource tree.
-                 * State value = -2 */
-                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
-                value = TmfStateValue.newValueInt(StateValues.SOFT_IRQ_RAISED);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 7: // "sched_switch":
-            /*
-             * Fields: string prev_comm, int32 prev_tid, int32 prev_prio, int64 prev_state,
-             *         string next_comm, int32 next_tid, int32 next_prio
-             */
-            {
-                Integer prevTid = ((Long) content.getField(LttngStrings.PREV_TID).getValue()).intValue();
-                Long prevState = (Long) content.getField(LttngStrings.PREV_STATE).getValue();
-                String nextProcessName = (String) content.getField(LttngStrings.NEXT_COMM).getValue();
-                Integer nextTid = ((Long) content.getField(LttngStrings.NEXT_TID).getValue()).intValue();
-
-                Integer formerThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), prevTid.toString());
-                Integer newCurrentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), nextTid.toString());
-
-                /* Set the status of the process that got scheduled out. */
-                quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
-                if (prevState != 0) {
-                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
-                } else {
-                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
-                }
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the status of the new scheduled process */
-                setProcessToRunning(ts, newCurrentThreadNode);
-
-                /* Set the exec name of the new process */
-                quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.EXEC_NAME);
-                value = TmfStateValue.newValueString(nextProcessName);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Make sure the PPID and system_call sub-attributes exist */
-                ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
-                ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.PPID);
-
-                /* Set the current scheduled process on the relevant CPU */
-                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
-                value = TmfStateValue.newValueInt(nextTid);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the status of the CPU itself */
-                if (nextTid > 0) {
-                    /* Check if the entering process is in kernel or user mode */
-                    quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
-                    if (ss.queryOngoingState(quark).isNull()) {
-                        value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
-                    } else {
-                        value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
-                    }
-                } else {
-                    value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IDLE);
-                }
-                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 8: // "sched_process_fork":
-            /* Fields: string parent_comm, int32 parent_tid,
-             *         string child_comm, int32 child_tid */
-            {
-                // String parentProcessName = (String) event.getFieldValue("parent_comm");
-                String childProcessName = (String) content.getField(LttngStrings.CHILD_COMM).getValue();
-                // assert ( parentProcessName.equals(childProcessName) );
-
-                Integer parentTid = ((Long) content.getField(LttngStrings.PARENT_TID).getValue()).intValue();
-                Integer childTid = ((Long) content.getField(LttngStrings.CHILD_TID).getValue()).intValue();
-
-                Integer parentTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), parentTid.toString());
-                Integer childTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), childTid.toString());
-
-                /* Assign the PPID to the new process */
-                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.PPID);
-                value = TmfStateValue.newValueInt(parentTid);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the new process' exec_name */
-                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.EXEC_NAME);
-                value = TmfStateValue.newValueString(childProcessName);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the new process' status */
-                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
-                ss.modifyAttribute(ts, value, quark);
-
-                /* Set the process' syscall name, to be the same as the parent's */
-                quark = ss.getQuarkRelativeAndAdd(parentTidNode, Attributes.SYSTEM_CALL);
-                value = ss.queryOngoingState(quark);
-                if (value.isNull()) {
-                    /*
-                     * Maybe we were missing info about the parent? At least we
-                     * will set the child right. Let's suppose "sys_clone".
-                     */
-                    value = TmfStateValue.newValueString(LttngStrings.SYS_CLONE);
-                }
-                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            case 9: // "sched_process_exit":
-            /* Fields: string comm, int32 tid, int32 prio */
-                break;
-
-            case 10: // "sched_process_free":
-            /* Fields: string comm, int32 tid, int32 prio */
-            /*
-             * A sched_process_free will always happen after the sched_switch
-             * that will remove the process from the cpu for the last time. So
-             * this is when we should delete everything wrt to the process.
-             */
-            {
-                Integer tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
-                /*
-                 * Remove the process and all its sub-attributes from the
-                 * current state
-                 */
-                quark = ss.getQuarkRelativeAndAdd(getNodeThreads(), tid.toString());
-                ss.removeAttribute(ts, quark);
-            }
-                break;
-
-            case 11: // "lttng_statedump_process_state":
-            /* Fields:
-             * int32 type, int32 mode, int32 pid, int32 submode, int32 vpid,
-             * int32 ppid, int32 tid, string name, int32 status, int32 vtid */
-            {
-                Integer tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
-                int ppid = ((Long) content.getField(LttngStrings.PPID).getValue()).intValue();
-                int status = ((Long) content.getField(LttngStrings.STATUS).getValue()).intValue();
-                String name = (String) content.getField(LttngStrings.NAME).getValue();
-                /*
-                 * "mode" could be interesting too, but it doesn't seem to be
-                 * populated with anything relevant for now.
-                 */
-
-                int curThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), tid.toString());
-
-                /* Set the process' name */
-                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.EXEC_NAME);
-                if (ss.queryOngoingState(quark).isNull()) {
-                    /* If the value didn't exist previously, set it */
-                    value = TmfStateValue.newValueString(name);
-                    ss.modifyAttribute(ts, value, quark);
-                }
-
-                /* Set the process' PPID */
-                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.PPID);
-                if (ss.queryOngoingState(quark).isNull()) {
-                    value = TmfStateValue.newValueInt(ppid);
-                    ss.modifyAttribute(ts, value, quark);
-                }
-
-                /* Set the process' status */
-                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.STATUS);
-                if (ss.queryOngoingState(quark).isNull()) {
-                     /* "2" here means "WAIT_FOR_CPU", and "5" "WAIT_BLOCKED" in the LTTng kernel. */
-                    if (status == 2) {
-                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
-                    } else if (status == 5) {
-                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
-                    } else {
-                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_UNKNOWN);
-                    }
-                    ss.modifyAttribute(ts, value, quark);
-                }
-            }
-                break;
-
-            case 12: // "sched_wakeup":
-            case 13: // "sched_wakeup_new":
-            /* Fields (same fields for both types):
-             * string comm, int32 pid, int32 prio, int32 success,
-             * int32 target_cpu */
-            {
-                final int tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
-                final int threadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(tid));
-
-                /*
-                 * The process indicated in the event's payload is now ready to
-                 * run. Assign it to the "wait for cpu" state.
-                 */
-                quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.STATUS);
-                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
-                ss.modifyAttribute(ts, value, quark);
-            }
-                break;
-
-            default:
-            /* Other event types not covered by the main switch */
-            {
-                if (eventName.startsWith(LttngStrings.SYSCALL_PREFIX)
-                        || eventName.startsWith(LttngStrings.COMPAT_SYSCALL_PREFIX)) {
-                    /*
-                     * This is a replacement for the old sys_enter event. Now
-                     * syscall names are listed into the event type
-                     */
-
-                    /* Assign the new system call to the process */
-                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
-                    value = TmfStateValue.newValueString(eventName);
-                    ss.modifyAttribute(ts, value, quark);
-
-                    /* Put the process in system call mode */
-                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
-                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_SYSCALL);
-                    ss.modifyAttribute(ts, value, quark);
-
-                    /* Put the CPU in system call (kernel) mode */
-                    quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
-                    value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
-                    ss.modifyAttribute(ts, value, quark);
-                }
-            }
-                break;
-            } // End of big switch
-
-        } catch (AttributeNotFoundException ae) {
-            /*
-             * This would indicate a problem with the logic of the manager here,
-             * so it shouldn't happen.
-             */
-            ae.printStackTrace();
-
-        } catch (TimeRangeException tre) {
-            /*
-             * This would happen if the events in the trace aren't ordered
-             * chronologically, which should never be the case ...
-             */
-            System.err.println("TimeRangeExcpetion caught in the state system's event manager."); //$NON-NLS-1$
-            System.err.println("Are the events in the trace correctly ordered?"); //$NON-NLS-1$
-            tre.printStackTrace();
-
-        } catch (StateValueTypeException sve) {
-            /*
-             * This would happen if we were trying to push/pop attributes not of
-             * type integer. Which, once again, should never happen.
-             */
-            sve.printStackTrace();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Convenience methods for commonly-used attribute tree locations
-    // ------------------------------------------------------------------------
-
-    private int getNodeCPUs() {
-        return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
-    }
-
-    private int getNodeThreads() {
-        return ss.getQuarkAbsoluteAndAdd(Attributes.THREADS);
-    }
-
-    private int getNodeIRQs() {
-        return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.IRQS);
-    }
-
-    private int getNodeSoftIRQs() {
-        return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.SOFT_IRQS);
-    }
-
-    // ------------------------------------------------------------------------
-    // Workaround for the lack of switch-on-strings in Java < 7
-    // ------------------------------------------------------------------------
-
-    private static HashMap<String, Integer> fillEventNames() {
-        /*
-         * TODO Replace with straight strings in the switch/case once we move to
-         * Java 7
-         */
-        HashMap<String, Integer> map = new HashMap<String, Integer>();
-
-        map.put(LttngStrings.EXIT_SYSCALL, 1);
-        map.put(LttngStrings.IRQ_HANDLER_ENTRY, 2);
-        map.put(LttngStrings.IRQ_HANDLER_EXIT, 3);
-        map.put(LttngStrings.SOFTIRQ_ENTRY, 4);
-        map.put(LttngStrings.SOFTIRQ_EXIT, 5);
-        map.put(LttngStrings.SOFTIRQ_RAISE, 6);
-        map.put(LttngStrings.SCHED_SWITCH, 7);
-        map.put(LttngStrings.SCHED_PROCESS_FORK, 8);
-        map.put(LttngStrings.SCHED_PROCESS_EXIT, 9);
-        map.put(LttngStrings.SCHED_PROCESS_FREE, 10);
-        map.put(LttngStrings.STATEDUMP_PROCESS_STATE, 11);
-        map.put(LttngStrings.SCHED_WAKEUP, 12);
-        map.put(LttngStrings.SCHED_WAKEUP_NEW, 13);
-
-        return map;
-    }
-
-    private int getEventIndex(String eventName) {
-        Integer ret = knownEventNames.get(eventName);
-        return (ret != null) ? ret : -1;
-    }
-
-    // ------------------------------------------------------------------------
-    // Advanced state-setting methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * When we want to set a process back to a "running" state, first check
-     * its current System_call attribute. If there is a system call active, we
-     * put the process back in the syscall state. If not, we put it back in
-     * user mode state.
-     */
-    private void setProcessToRunning(long ts, int currentThreadNode)
-            throws AttributeNotFoundException, TimeRangeException,
-            StateValueTypeException {
-        int quark;
-        ITmfStateValue value;
-
-        quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
-        if (ss.queryOngoingState(quark).isNull()) {
-            /* We were in user mode before the interruption */
-            value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_USERMODE);
-        } else {
-            /* We were previously in kernel mode */
-            value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_SYSCALL);
-        }
-        quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
-        ss.modifyAttribute(ts, value, quark);
-    }
-
-    /**
-     * Similar logic as above, but to set the CPU's status when it's coming out
-     * of an interruption.
-     */
-    private void cpuExitInterrupt(long ts, int currentCpuNode, int currentThreadNode)
-            throws StateValueTypeException, AttributeNotFoundException,
-            TimeRangeException {
-        int quark;
-        ITmfStateValue value;
-
-        quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.CURRENT_THREAD);
-        if (ss.queryOngoingState(quark).unboxInt() > 0) {
-            /* There was a process on the CPU */
-            quark = ss.getQuarkRelative(currentThreadNode, Attributes.SYSTEM_CALL);
-            if (ss.queryOngoingState(quark).isNull()) {
-                /* That process was in user mode */
-                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
-            } else {
-                /* That process was in a system call */
-                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
-            }
-        } else {
-            /* There was no real process scheduled, CPU was idle */
-            value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IDLE);
-        }
-        quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.STATUS);
-        ss.modifyAttribute(ts, value, quark);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/LttngKernelStateProvider.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/LttngKernelStateProvider.java
new file mode 100644 (file)
index 0000000..f818005
--- /dev/null
@@ -0,0 +1,588 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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.linuxtools.internal.lttng2.kernel.core.stateprovider;
+
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
+import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
+import org.eclipse.linuxtools.tmf.core.statesystem.AbstractTmfStateProvider;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
+import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
+import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
+
+/**
+ * This is the state change input plugin for TMF's state system which handles
+ * the LTTng 2.0 kernel traces in CTF format.
+ *
+ * It uses the reference handler defined in CTFKernelHandler.java.
+ *
+ * @author alexmont
+ *
+ */
+public class LttngKernelStateProvider extends AbstractTmfStateProvider {
+
+    /**
+     * Version number of this state provider. Please bump this if you modify the
+     * contents of the generated state history in some way.
+     */
+    private static final int VERSION = 2;
+
+    /* Event names HashMap. TODO: This can be discarded once we move to Java 7 */
+    private final HashMap<String, Integer> knownEventNames;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    /**
+     * Instantiate a new state provider plugin.
+     *
+     * @param trace
+     *            The LTTng 2.0 kernel trace directory
+     */
+    public LttngKernelStateProvider(CtfTmfTrace trace) {
+        super(trace, CtfTmfEvent.class, "LTTng Kernel"); //$NON-NLS-1$
+        knownEventNames = fillEventNames();
+    }
+
+    // ------------------------------------------------------------------------
+    // IStateChangeInput
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int getVersion() {
+        return VERSION;
+    }
+
+    @Override
+    public void assignTargetStateSystem(ITmfStateSystemBuilder ssb) {
+        /* We can only set up the locations once the state system is assigned */
+        super.assignTargetStateSystem(ssb);
+    }
+
+    @Override
+    public LttngKernelStateProvider getNewInstance() {
+        return new LttngKernelStateProvider((CtfTmfTrace) this.getTrace());
+    }
+
+    @Override
+    protected void eventHandle(ITmfEvent ev) {
+        /*
+         * AbstractStateChangeInput should have already checked for the correct
+         * class type
+         */
+        CtfTmfEvent event = (CtfTmfEvent) ev;
+
+        int quark;
+        ITmfStateValue value;
+
+        final ITmfEventField content = event.getContent();
+        final String eventName = event.getEventName();
+        final long ts = event.getTimestamp().getValue();
+
+        try {
+            /* Shortcut for the "current CPU" attribute node */
+            final Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(), String.valueOf(event.getCPU()));
+
+            /*
+             * Shortcut for the "current thread" attribute node. It requires
+             * querying the current CPU's current thread.
+             */
+            quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
+            value = ss.queryOngoingState(quark);
+            int thread = value.unboxInt();
+            final Integer currentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(thread));
+
+            /*
+             * Feed event to the history system if it's known to cause a state
+             * transition.
+             */
+            switch (getEventIndex(eventName)) {
+
+            case 1: // "exit_syscall":
+            /* Fields: int64 ret */
+            {
+                /* Clear the current system call on the process */
+                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
+                value = TmfStateValue.nullValue();
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Put the process' status back to user mode */
+                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_USERMODE);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Put the CPU's status back to user mode */
+                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 2: // "irq_handler_entry":
+            /* Fields: int32 irq, string name */
+            {
+                Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
+
+                /* Mark this IRQ as active in the resource tree.
+                 * The state value = the CPU on which this IRQ is sitting */
+                quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
+                value = TmfStateValue.newValueInt(event.getCPU());
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Change the status of the running process to interrupted */
+                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_INTERRUPTED);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Change the status of the CPU to interrupted */
+                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IRQ);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 3: // "irq_handler_exit":
+            /* Fields: int32 irq, int32 ret */
+            {
+                Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
+
+                /* Put this IRQ back to inactive in the resource tree */
+                quark = ss.getQuarkRelativeAndAdd(getNodeIRQs(), irqId.toString());
+                value = TmfStateValue.nullValue();
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the previous process back to running */
+                setProcessToRunning(ts, currentThreadNode);
+
+                /* Set the CPU status back to running or "idle" */
+                cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
+            }
+                break;
+
+            case 4: // "softirq_entry":
+            /* Fields: int32 vec */
+            {
+                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+                /* Mark this SoftIRQ as active in the resource tree.
+                 * The state value = the CPU on which this SoftIRQ is processed */
+                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
+                value = TmfStateValue.newValueInt(event.getCPU());
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Change the status of the running process to interrupted */
+                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_INTERRUPTED);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Change the status of the CPU to interrupted */
+                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_SOFTIRQ);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 5: // "softirq_exit":
+            /* Fields: int32 vec */
+            {
+                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+                /* Put this SoftIRQ back to inactive (= -1) in the resource tree */
+                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
+                value = TmfStateValue.nullValue();
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the previous process back to running */
+                setProcessToRunning(ts, currentThreadNode);
+
+                /* Set the CPU status back to "busy" or "idle" */
+                cpuExitInterrupt(ts, currentCPUNode, currentThreadNode);
+            }
+                break;
+
+            case 6: // "softirq_raise":
+            /* Fields: int32 vec */
+            {
+                Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+                /* Mark this SoftIRQ as *raised* in the resource tree.
+                 * State value = -2 */
+                quark = ss.getQuarkRelativeAndAdd(getNodeSoftIRQs(), softIrqId.toString());
+                value = TmfStateValue.newValueInt(StateValues.SOFT_IRQ_RAISED);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 7: // "sched_switch":
+            /*
+             * Fields: string prev_comm, int32 prev_tid, int32 prev_prio, int64 prev_state,
+             *         string next_comm, int32 next_tid, int32 next_prio
+             */
+            {
+                Integer prevTid = ((Long) content.getField(LttngStrings.PREV_TID).getValue()).intValue();
+                Long prevState = (Long) content.getField(LttngStrings.PREV_STATE).getValue();
+                String nextProcessName = (String) content.getField(LttngStrings.NEXT_COMM).getValue();
+                Integer nextTid = ((Long) content.getField(LttngStrings.NEXT_TID).getValue()).intValue();
+
+                Integer formerThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), prevTid.toString());
+                Integer newCurrentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), nextTid.toString());
+
+                /* Set the status of the process that got scheduled out. */
+                quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
+                if (prevState != 0) {
+                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
+                } else {
+                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+                }
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the status of the new scheduled process */
+                setProcessToRunning(ts, newCurrentThreadNode);
+
+                /* Set the exec name of the new process */
+                quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.EXEC_NAME);
+                value = TmfStateValue.newValueString(nextProcessName);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Make sure the PPID and system_call sub-attributes exist */
+                ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
+                ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.PPID);
+
+                /* Set the current scheduled process on the relevant CPU */
+                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
+                value = TmfStateValue.newValueInt(nextTid);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the status of the CPU itself */
+                if (nextTid > 0) {
+                    /* Check if the entering process is in kernel or user mode */
+                    quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
+                    if (ss.queryOngoingState(quark).isNull()) {
+                        value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
+                    } else {
+                        value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
+                    }
+                } else {
+                    value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IDLE);
+                }
+                quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 8: // "sched_process_fork":
+            /* Fields: string parent_comm, int32 parent_tid,
+             *         string child_comm, int32 child_tid */
+            {
+                // String parentProcessName = (String) event.getFieldValue("parent_comm");
+                String childProcessName = (String) content.getField(LttngStrings.CHILD_COMM).getValue();
+                // assert ( parentProcessName.equals(childProcessName) );
+
+                Integer parentTid = ((Long) content.getField(LttngStrings.PARENT_TID).getValue()).intValue();
+                Integer childTid = ((Long) content.getField(LttngStrings.CHILD_TID).getValue()).intValue();
+
+                Integer parentTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), parentTid.toString());
+                Integer childTidNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), childTid.toString());
+
+                /* Assign the PPID to the new process */
+                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.PPID);
+                value = TmfStateValue.newValueInt(parentTid);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the new process' exec_name */
+                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.EXEC_NAME);
+                value = TmfStateValue.newValueString(childProcessName);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the new process' status */
+                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+                ss.modifyAttribute(ts, value, quark);
+
+                /* Set the process' syscall name, to be the same as the parent's */
+                quark = ss.getQuarkRelativeAndAdd(parentTidNode, Attributes.SYSTEM_CALL);
+                value = ss.queryOngoingState(quark);
+                if (value.isNull()) {
+                    /*
+                     * Maybe we were missing info about the parent? At least we
+                     * will set the child right. Let's suppose "sys_clone".
+                     */
+                    value = TmfStateValue.newValueString(LttngStrings.SYS_CLONE);
+                }
+                quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            case 9: // "sched_process_exit":
+            /* Fields: string comm, int32 tid, int32 prio */
+                break;
+
+            case 10: // "sched_process_free":
+            /* Fields: string comm, int32 tid, int32 prio */
+            /*
+             * A sched_process_free will always happen after the sched_switch
+             * that will remove the process from the cpu for the last time. So
+             * this is when we should delete everything wrt to the process.
+             */
+            {
+                Integer tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
+                /*
+                 * Remove the process and all its sub-attributes from the
+                 * current state
+                 */
+                quark = ss.getQuarkRelativeAndAdd(getNodeThreads(), tid.toString());
+                ss.removeAttribute(ts, quark);
+            }
+                break;
+
+            case 11: // "lttng_statedump_process_state":
+            /* Fields:
+             * int32 type, int32 mode, int32 pid, int32 submode, int32 vpid,
+             * int32 ppid, int32 tid, string name, int32 status, int32 vtid */
+            {
+                Integer tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
+                int ppid = ((Long) content.getField(LttngStrings.PPID).getValue()).intValue();
+                int status = ((Long) content.getField(LttngStrings.STATUS).getValue()).intValue();
+                String name = (String) content.getField(LttngStrings.NAME).getValue();
+                /*
+                 * "mode" could be interesting too, but it doesn't seem to be
+                 * populated with anything relevant for now.
+                 */
+
+                int curThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), tid.toString());
+
+                /* Set the process' name */
+                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.EXEC_NAME);
+                if (ss.queryOngoingState(quark).isNull()) {
+                    /* If the value didn't exist previously, set it */
+                    value = TmfStateValue.newValueString(name);
+                    ss.modifyAttribute(ts, value, quark);
+                }
+
+                /* Set the process' PPID */
+                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.PPID);
+                if (ss.queryOngoingState(quark).isNull()) {
+                    value = TmfStateValue.newValueInt(ppid);
+                    ss.modifyAttribute(ts, value, quark);
+                }
+
+                /* Set the process' status */
+                quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.STATUS);
+                if (ss.queryOngoingState(quark).isNull()) {
+                     /* "2" here means "WAIT_FOR_CPU", and "5" "WAIT_BLOCKED" in the LTTng kernel. */
+                    if (status == 2) {
+                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+                    } else if (status == 5) {
+                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
+                    } else {
+                        value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_UNKNOWN);
+                    }
+                    ss.modifyAttribute(ts, value, quark);
+                }
+            }
+                break;
+
+            case 12: // "sched_wakeup":
+            case 13: // "sched_wakeup_new":
+            /* Fields (same fields for both types):
+             * string comm, int32 pid, int32 prio, int32 success,
+             * int32 target_cpu */
+            {
+                final int tid = ((Long) content.getField(LttngStrings.TID).getValue()).intValue();
+                final int threadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(), String.valueOf(tid));
+
+                /*
+                 * The process indicated in the event's payload is now ready to
+                 * run. Assign it to the "wait for cpu" state.
+                 */
+                quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.STATUS);
+                value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+                ss.modifyAttribute(ts, value, quark);
+            }
+                break;
+
+            default:
+            /* Other event types not covered by the main switch */
+            {
+                if (eventName.startsWith(LttngStrings.SYSCALL_PREFIX)
+                        || eventName.startsWith(LttngStrings.COMPAT_SYSCALL_PREFIX)) {
+                    /*
+                     * This is a replacement for the old sys_enter event. Now
+                     * syscall names are listed into the event type
+                     */
+
+                    /* Assign the new system call to the process */
+                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
+                    value = TmfStateValue.newValueString(eventName);
+                    ss.modifyAttribute(ts, value, quark);
+
+                    /* Put the process in system call mode */
+                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+                    value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_SYSCALL);
+                    ss.modifyAttribute(ts, value, quark);
+
+                    /* Put the CPU in system call (kernel) mode */
+                    quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.STATUS);
+                    value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
+                    ss.modifyAttribute(ts, value, quark);
+                }
+            }
+                break;
+            } // End of big switch
+
+        } catch (AttributeNotFoundException ae) {
+            /*
+             * This would indicate a problem with the logic of the manager here,
+             * so it shouldn't happen.
+             */
+            ae.printStackTrace();
+
+        } catch (TimeRangeException tre) {
+            /*
+             * This would happen if the events in the trace aren't ordered
+             * chronologically, which should never be the case ...
+             */
+            System.err.println("TimeRangeExcpetion caught in the state system's event manager."); //$NON-NLS-1$
+            System.err.println("Are the events in the trace correctly ordered?"); //$NON-NLS-1$
+            tre.printStackTrace();
+
+        } catch (StateValueTypeException sve) {
+            /*
+             * This would happen if we were trying to push/pop attributes not of
+             * type integer. Which, once again, should never happen.
+             */
+            sve.printStackTrace();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Convenience methods for commonly-used attribute tree locations
+    // ------------------------------------------------------------------------
+
+    private int getNodeCPUs() {
+        return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
+    }
+
+    private int getNodeThreads() {
+        return ss.getQuarkAbsoluteAndAdd(Attributes.THREADS);
+    }
+
+    private int getNodeIRQs() {
+        return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.IRQS);
+    }
+
+    private int getNodeSoftIRQs() {
+        return ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.SOFT_IRQS);
+    }
+
+    // ------------------------------------------------------------------------
+    // Workaround for the lack of switch-on-strings in Java < 7
+    // ------------------------------------------------------------------------
+
+    private static HashMap<String, Integer> fillEventNames() {
+        /*
+         * TODO Replace with straight strings in the switch/case once we move to
+         * Java 7
+         */
+        HashMap<String, Integer> map = new HashMap<String, Integer>();
+
+        map.put(LttngStrings.EXIT_SYSCALL, 1);
+        map.put(LttngStrings.IRQ_HANDLER_ENTRY, 2);
+        map.put(LttngStrings.IRQ_HANDLER_EXIT, 3);
+        map.put(LttngStrings.SOFTIRQ_ENTRY, 4);
+        map.put(LttngStrings.SOFTIRQ_EXIT, 5);
+        map.put(LttngStrings.SOFTIRQ_RAISE, 6);
+        map.put(LttngStrings.SCHED_SWITCH, 7);
+        map.put(LttngStrings.SCHED_PROCESS_FORK, 8);
+        map.put(LttngStrings.SCHED_PROCESS_EXIT, 9);
+        map.put(LttngStrings.SCHED_PROCESS_FREE, 10);
+        map.put(LttngStrings.STATEDUMP_PROCESS_STATE, 11);
+        map.put(LttngStrings.SCHED_WAKEUP, 12);
+        map.put(LttngStrings.SCHED_WAKEUP_NEW, 13);
+
+        return map;
+    }
+
+    private int getEventIndex(String eventName) {
+        Integer ret = knownEventNames.get(eventName);
+        return (ret != null) ? ret : -1;
+    }
+
+    // ------------------------------------------------------------------------
+    // Advanced state-setting methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * When we want to set a process back to a "running" state, first check
+     * its current System_call attribute. If there is a system call active, we
+     * put the process back in the syscall state. If not, we put it back in
+     * user mode state.
+     */
+    private void setProcessToRunning(long ts, int currentThreadNode)
+            throws AttributeNotFoundException, TimeRangeException,
+            StateValueTypeException {
+        int quark;
+        ITmfStateValue value;
+
+        quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
+        if (ss.queryOngoingState(quark).isNull()) {
+            /* We were in user mode before the interruption */
+            value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_USERMODE);
+        } else {
+            /* We were previously in kernel mode */
+            value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_RUN_SYSCALL);
+        }
+        quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+        ss.modifyAttribute(ts, value, quark);
+    }
+
+    /**
+     * Similar logic as above, but to set the CPU's status when it's coming out
+     * of an interruption.
+     */
+    private void cpuExitInterrupt(long ts, int currentCpuNode, int currentThreadNode)
+            throws StateValueTypeException, AttributeNotFoundException,
+            TimeRangeException {
+        int quark;
+        ITmfStateValue value;
+
+        quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.CURRENT_THREAD);
+        if (ss.queryOngoingState(quark).unboxInt() > 0) {
+            /* There was a process on the CPU */
+            quark = ss.getQuarkRelative(currentThreadNode, Attributes.SYSTEM_CALL);
+            if (ss.queryOngoingState(quark).isNull()) {
+                /* That process was in user mode */
+                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_USERMODE);
+            } else {
+                /* That process was in a system call */
+                value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_RUN_SYSCALL);
+            }
+        } else {
+            /* There was no real process scheduled, CPU was idle */
+            value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IDLE);
+        }
+        quark = ss.getQuarkRelativeAndAdd(currentCpuNode, Attributes.STATUS);
+        ss.modifyAttribute(ts, value, quark);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/CtfKernelTrace.java
deleted file mode 100644 (file)
index 925e59e..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 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
- *   Matthew Khouzam - Improved validation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.lttng2.kernel.core.trace;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-
-/**
- * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
- * traces. It uses the CtfKernelStateInput to generate the state history.
- *
- * @version 1.0
- * @author Alexandre Montplaisir
- */
-public class CtfKernelTrace extends CtfTmfTrace {
-
-    /**
-     * The file name of the History Tree
-     */
-    public final static String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
-
-    /**
-     * ID of the state system we will build
-     * @since 2.0
-     * */
-    public static final String STATE_ID = "org.eclipse.linuxtools.lttng2.kernel"; //$NON-NLS-1$
-
-    /**
-     * Default constructor
-     */
-    public CtfKernelTrace() {
-        super();
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public IStatus validate(final IProject project, final String path)  {
-        CTFTrace temp;
-        IStatus validStatus;
-        /*
-         * Make sure the trace is openable as a CTF trace. We do this here
-         * instead of calling super.validate() to keep the reference to "temp".
-         */
-        try {
-            temp = new CTFTrace(path);
-        } catch (CTFReaderException e) {
-            validStatus = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
-            return validStatus;
-        } catch (NullPointerException e){
-            validStatus = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
-            return validStatus;
-        }
-
-        /* Make sure the domain is "kernel" in the trace's env vars */
-        String dom = temp.getEnvironment().get("domain"); //$NON-NLS-1$
-        temp.dispose();
-        if (dom != null && dom.equals("\"kernel\"")) { //$NON-NLS-1$
-            return Status.OK_STATUS;
-        }
-        validStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfKernelTrace_DomainError);
-        return validStatus;
-    }
-
-    @Override
-    protected void buildStateSystem() throws TmfTraceException {
-        super.buildStateSystem();
-
-        /* Set up the path to the history tree file we'll use */
-        IResource resource = this.getResource();
-        String supplDirectory = null;
-
-        try {
-            // get the directory where the history file will be stored.
-            supplDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
-        } catch (CoreException e) {
-            throw new TmfTraceException(e.toString(), e);
-        }
-
-        final File htFile = new File(supplDirectory + File.separator + HISTORY_TREE_FILE_NAME);
-        final ITmfStateProvider htInput = new CtfKernelStateProvider(this);
-
-        ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
-        fStateSystems.put(STATE_ID, ss);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngKernelTrace.java b/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngKernelTrace.java
new file mode 100644 (file)
index 0000000..9c2d9ae
--- /dev/null
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 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
+ *   Matthew Khouzam - Improved validation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.core.trace;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
+import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
+
+/**
+ * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
+ * traces. It uses the CtfKernelStateInput to generate the state history.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public class LttngKernelTrace extends CtfTmfTrace {
+
+    /**
+     * The file name of the History Tree
+     */
+    public final static String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
+
+    /**
+     * ID of the state system we will build
+     * @since 2.0
+     * */
+    public static final String STATE_ID = "org.eclipse.linuxtools.lttng2.kernel"; //$NON-NLS-1$
+
+    /**
+     * Default constructor
+     */
+    public LttngKernelTrace() {
+        super();
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public IStatus validate(final IProject project, final String path)  {
+        CTFTrace temp;
+        IStatus validStatus;
+        /*
+         * Make sure the trace is openable as a CTF trace. We do this here
+         * instead of calling super.validate() to keep the reference to "temp".
+         */
+        try {
+            temp = new CTFTrace(path);
+        } catch (CTFReaderException e) {
+            validStatus = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
+            return validStatus;
+        } catch (NullPointerException e){
+            validStatus = new Status(IStatus.ERROR,  Activator.PLUGIN_ID, e.toString(), e);
+            return validStatus;
+        }
+
+        /* Make sure the domain is "kernel" in the trace's env vars */
+        String dom = temp.getEnvironment().get("domain"); //$NON-NLS-1$
+        temp.dispose();
+        if (dom != null && dom.equals("\"kernel\"")) { //$NON-NLS-1$
+            return Status.OK_STATUS;
+        }
+        validStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.LttngKernelTrace_DomainError);
+        return validStatus;
+    }
+
+    @Override
+    protected void buildStateSystem() throws TmfTraceException {
+        super.buildStateSystem();
+
+        /* Set up the path to the history tree file we'll use */
+        IResource resource = this.getResource();
+        String supplDirectory = null;
+
+        try {
+            // get the directory where the history file will be stored.
+            supplDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
+        } catch (CoreException e) {
+            throw new TmfTraceException(e.toString(), e);
+        }
+
+        final File htFile = new File(supplDirectory + File.separator + HISTORY_TREE_FILE_NAME);
+        final ITmfStateProvider htInput = new LttngKernelStateProvider(this);
+
+        ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
+        fStateSystems.put(STATE_ID, ss);
+    }
+
+}
index 4651ae04dd8d6ad596dd3251a664d53a0788c7ba..6b958f2b3e1baebde192cdca816d78333ee45852 100644 (file)
@@ -26,7 +26,7 @@ public class Messages extends NLS {
     /**
      * The domain is not "kernel"
      */
-    public static String CtfKernelTrace_DomainError;
+    public static String LttngKernelTrace_DomainError;
 
     static {
         // initialize resource bundle
index ddfe91c5f863ff9a5558c1e102b0f01f699e0a44..7ef639cf62a3fd5b0dcdf98d1749d427a4dc58df 100644 (file)
@@ -10,4 +10,4 @@
 #     Ericsson - Initial API and implementation
 ###############################################################################
 
-CtfKernelTrace_DomainError=Domain mismatch, make sure the environment is 'kernel'
+LttngKernelTrace_DomainError=Domain mismatch, the environment should be 'kernel'.
index 29d7df33545c645a2bc57982010d5ec8b92d2bfb..9172f4976ed16a59c977b55f969e6402d1a9c212 100644 (file)
@@ -19,5 +19,4 @@ kernel.perspective.name = LTTng Kernel
 controlflow.view.name = Control Flow
 resources.view.name = Resources
 
-tracetype.category.lttng = LTTng 2.0
-tracetype.type.kernel = Kernel Trace
+tracetype.type.kernel = LTTng Kernel Trace
index 640455654a63c523e213135742e062481409eab6..77341011466f423c828f6ef4041f0efa17060fee 100644 (file)
@@ -39,7 +39,7 @@
             icon="icons/obj16/garland16.png"
             id="org.eclipse.linuxtools.lttng2.kernel.tracetype"
             name="%tracetype.type.kernel"
-            trace_type="org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace">
+            trace_type="org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace">
          <eventsTableType
                class="org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events.LTTng2EventsTable">
          </eventsTableType>
index 69ee120fcf5f388d4a7ee44eaa3eead531ceec72..2cd832138d034e3ecdc22c068616713c85bf4685 100644 (file)
@@ -16,7 +16,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.EventIterator;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
@@ -26,7 +26,7 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
  */
 public class ControlFlowEntry implements ITimeGraphEntry {
     private final int fThreadQuark;
-    private final CtfKernelTrace fTrace;
+    private final LttngKernelTrace fTrace;
     private ControlFlowEntry fParent = null;
     private final ArrayList<ControlFlowEntry> fChildren = new ArrayList<ControlFlowEntry>();
     private String fName;
@@ -55,7 +55,7 @@ public class ControlFlowEntry implements ITimeGraphEntry {
      * @param endTime
      *            The end time of this process
      */
-    public ControlFlowEntry(int threadQuark, CtfKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) {
+    public ControlFlowEntry(int threadQuark, LttngKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) {
         fThreadQuark = threadQuark;
         fTrace = trace;
         fName = execName;
@@ -132,7 +132,7 @@ public class ControlFlowEntry implements ITimeGraphEntry {
      *
      * @return The trace
      */
-    public CtfKernelTrace getTrace() {
+    public LttngKernelTrace getTrace() {
         return fTrace;
     }
 
index f1b51d05f2e27e6a446f63cf639ea448cb7e5141..6ded4d72274121785b7aadd0c50ce03f475516cf 100644 (file)
@@ -19,7 +19,7 @@ import java.util.Map;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
@@ -111,7 +111,7 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
         Map<String, String> retMap = new LinkedHashMap<String, String>();
         if (event instanceof ControlFlowEvent) {
             ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
-            ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+            ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
             int tid = entry.getThreadId();
 
             try {
@@ -172,7 +172,7 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
             return;
         }
         ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
-        ITmfStateSystem ss = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+        ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
         int status = ((ControlFlowEvent) event).getStatus();
         if (status != StateValues.PROCESS_STATUS_RUN_SYSCALL) {
             return;
index 9b39ee6ab7922d81aafae0826e3ebb851784e774..5a5a2521606aae311fbb07a70055d93dac23336b 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
@@ -502,9 +502,9 @@ public class ControlFlowView extends TmfView {
             if (thread > 0) {
                 break;
             }
-            if (trace instanceof CtfKernelTrace) {
-                CtfKernelTrace ctfKernelTrace = (CtfKernelTrace) trace;
-                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(CtfKernelTrace.STATE_ID);
+            if (trace instanceof LttngKernelTrace) {
+                LttngKernelTrace ctfKernelTrace = (LttngKernelTrace) trace;
+                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
                 if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) {
                     List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD);  //$NON-NLS-1$
                     for (int currentThreadQuark : currentThreadQuarks) {
@@ -600,10 +600,10 @@ public class ControlFlowView extends TmfView {
             if (monitor.isCanceled()) {
                 return;
             }
-            if (aTrace instanceof CtfKernelTrace) {
+            if (aTrace instanceof LttngKernelTrace) {
                 ArrayList<ControlFlowEntry> entryList = new ArrayList<ControlFlowEntry>();
-                CtfKernelTrace ctfKernelTrace = (CtfKernelTrace) aTrace;
-                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(CtfKernelTrace.STATE_ID);
+                LttngKernelTrace ctfKernelTrace = (LttngKernelTrace) aTrace;
+                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
                 if (!ssq.waitUntilBuilt()) {
                     return;
                 }
@@ -715,7 +715,7 @@ public class ControlFlowView extends TmfView {
     }
 
     private void buildStatusEvents(ITmfTrace trace, ControlFlowEntry entry, IProgressMonitor monitor) {
-        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
         long start = ssq.getStartTime();
         long end = ssq.getCurrentEndTime() + 1;
         long resolution = Math.max(1, (end - start) / fDisplayWidth);
@@ -743,7 +743,7 @@ public class ControlFlowView extends TmfView {
         if (realEnd <= realStart) {
             return null;
         }
-        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
         List<ITimeEvent> eventList = null;
         try {
             int statusQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.STATUS);
index 2e9ebbb32c0d1f1b5386bd10f6fd2c1ae5183f6d..5b12b8661c0077fcc1ff0c1a5984d9e794821278 100644 (file)
@@ -16,7 +16,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.EventIterator;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
 import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
@@ -40,7 +40,7 @@ public class ResourcesEntry implements ITimeGraphEntry {
         SOFT_IRQ }
 
     private final int fQuark;
-    private final CtfKernelTrace fTrace;
+    private final LttngKernelTrace fTrace;
     private ITimeGraphEntry fParent = null;
     private final List<ITimeGraphEntry> children = null;
     private final String fName;
@@ -64,7 +64,7 @@ public class ResourcesEntry implements ITimeGraphEntry {
      * @param id
      *            The integer id associated with this entry or row
      */
-    public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {
+    public ResourcesEntry(int quark, LttngKernelTrace trace, Type type, int id) {
         fQuark = quark;
         fTrace = trace;
         fType = type;
@@ -142,7 +142,7 @@ public class ResourcesEntry implements ITimeGraphEntry {
      *
      * @return The LTTng 2 kernel trace
      */
-    public CtfKernelTrace getTrace() {
+    public LttngKernelTrace getTrace() {
         return fTrace;
     }
 
index 1aaf5ad87a5eda7cd5603e405ef319d3feebba2f..f604752bf70b91a8188e60822d0d73d2cf257542 100644 (file)
@@ -20,7 +20,7 @@ import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
@@ -183,7 +183,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider
                 if (status == StateValues.CPU_STATUS_IRQ) {
                     // In IRQ state get the IRQ that caused the interruption
                     ResourcesEntry entry = (ResourcesEntry) event.getEntry();
-                    ITmfStateSystem ss = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+                    ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
                     int cpu = entry.getId();
 
                     try {
@@ -212,7 +212,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider
                 } else if (status == StateValues.CPU_STATUS_SOFTIRQ) {
                     // In SOFT_IRQ state get the SOFT_IRQ that caused the interruption
                     ResourcesEntry entry = (ResourcesEntry) event.getEntry();
-                    ITmfStateSystem ss = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+                    ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
                     int cpu = entry.getId();
 
                     try {
@@ -241,7 +241,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider
                 } else if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL){
                     // In running state get the current tid
                     ResourcesEntry entry = (ResourcesEntry) event.getEntry();
-                    ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+                    ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
 
                     try {
                         retMap.put(Messages.ResourcesView_attributeHoverTime, Utils.formatTime(hoverTime, TimeFormat.CALENDAR, Resolution.NANOSEC));
@@ -300,7 +300,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider
             return;
         }
         ResourcesEntry entry = (ResourcesEntry) event.getEntry();
-        ITmfStateSystem ss = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+        ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
         long time = event.getTime();
         try {
             while (time < event.getTime() + event.getDuration()) {
index 2af610e1386738c5928f92877541ac4b84323a26..88d0abc661969464a7172e4d67b9b600b7a0a5ad 100644 (file)
@@ -27,7 +27,7 @@ import org.eclipse.jface.action.Separator;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
@@ -127,7 +127,7 @@ public class ResourcesView extends TmfView {
 
     private class TraceEntry implements ITimeGraphEntry {
         // The Trace
-        private final CtfKernelTrace fKernelTrace;
+        private final LttngKernelTrace fKernelTrace;
         // The start time
         private final long fTraceStartTime;
         // The end time
@@ -137,7 +137,7 @@ public class ResourcesView extends TmfView {
         // The name of entry
         private final String fName;
 
-        public TraceEntry(CtfKernelTrace trace, String name, long startTime, long endTime) {
+        public TraceEntry(LttngKernelTrace trace, String name, long startTime, long endTime) {
             fKernelTrace = trace;
             fChildren = new ArrayList<ResourcesEntry>();
             fName = name;
@@ -190,7 +190,7 @@ public class ResourcesView extends TmfView {
             return null;
         }
 
-        public CtfKernelTrace getTrace() {
+        public LttngKernelTrace getTrace() {
             return fKernelTrace;
         }
 
@@ -266,7 +266,7 @@ public class ResourcesView extends TmfView {
             }
             long resolution = Math.max(1, (fZoomEndTime - fZoomStartTime) / fDisplayWidth);
             for (TraceEntry traceEntry : fZoomEntryList) {
-                if (!traceEntry.fKernelTrace.getStateSystems().get(CtfKernelTrace.STATE_ID).waitUntilBuilt()) {
+                if (!traceEntry.fKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID).waitUntilBuilt()) {
                     return;
                 }
                 for (ITimeGraphEntry child : traceEntry.getChildren()) {
@@ -477,9 +477,9 @@ public class ResourcesView extends TmfView {
             if (monitor.isCanceled()) {
                 return;
             }
-            if (aTrace instanceof CtfKernelTrace) {
-                CtfKernelTrace ctfKernelTrace = (CtfKernelTrace) aTrace;
-                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(CtfKernelTrace.STATE_ID);
+            if (aTrace instanceof LttngKernelTrace) {
+                LttngKernelTrace ctfKernelTrace = (LttngKernelTrace) aTrace;
+                ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
                 if (!ssq.waitUntilBuilt()) {
                     return;
                 }
@@ -528,8 +528,8 @@ public class ResourcesView extends TmfView {
             if (monitor.isCanceled()) {
                 return;
             }
-            CtfKernelTrace ctfKernelTrace = traceEntry.getTrace();
-            ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(CtfKernelTrace.STATE_ID);
+            LttngKernelTrace ctfKernelTrace = traceEntry.getTrace();
+            ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
             long startTime = ssq.getStartTime();
             long endTime = ssq.getCurrentEndTime() + 1;
             long resolution = (endTime - startTime) / fDisplayWidth;
@@ -544,7 +544,7 @@ public class ResourcesView extends TmfView {
     private static List<ITimeEvent> getEventList(ResourcesEntry entry,
             long startTime, long endTime, long resolution, boolean includeNull,
             IProgressMonitor monitor) {
-        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(CtfKernelTrace.STATE_ID);
+        ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
         final long realStart = Math.max(startTime, ssq.getStartTime());
         final long realEnd = Math.min(endTime, ssq.getCurrentEndTime() + 1);
         if (realEnd <= realStart) {
This page took 0.051756 seconds and 5 git commands to generate.