analysis: Fix the state of processes in the LTTng Kernel Analysis Module
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 9 Oct 2014 21:11:45 +0000 (17:11 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 11 Sep 2015 17:20:42 +0000 (13:20 -0400)
A process with prev_state=1024 was shown as blocked, while it is actually
ready to be run on CPU, so that state must be ignored.

Change-Id: I0f2e7acd05e1592e5a91d898869a9a82ad66ead1
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/35492
Reviewed-by: Hudson CI
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/kernelanalysis/KernelStateProvider.java

index e9e4cd771a582283135f3877a920942c5582b4f3..4ea1cd338a909d787f8c096c301e16ee1b4c2cb7 100644 (file)
@@ -55,7 +55,7 @@ public class KernelStateProvider 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 = 7;
+    private static final int VERSION = 8;
 
     private static final int IRQ_HANDLER_ENTRY_INDEX = 1;
     private static final int IRQ_HANDLER_EXIT_INDEX = 2;
@@ -289,9 +289,17 @@ public class KernelStateProvider extends AbstractTmfStateProvider {
                 Integer formerThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(ss), prevTid.toString());
                 Integer newCurrentThreadNode = ss.getQuarkRelativeAndAdd(getNodeThreads(ss), nextTid.toString());
 
+                /*
+                 * Empirical observations and look into the linux code have
+                 * shown that the TASK_STATE_MAX flag is used internally and
+                 * |'ed with other states, most often the running state, so it
+                 * is ignored from the prevState value.
+                 */
+                prevState = prevState & ~(LinuxValues.TASK_STATE_MAX);
+
                 /* Set the status of the process that got scheduled out. */
                 quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
-                if (prevState != 0) {
+                if (prevState != LinuxValues.TASK_STATE_RUNNING) {
                     if (prevState == LinuxValues.TASK_STATE_DEAD) {
                         value = TmfStateValue.nullValue();
                     } else {
This page took 0.025781 seconds and 5 git commands to generate.