os.linux: make SoftIrqs support being raised while executing.
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / kernel / handlers / SoftIrqRaiseHandler.java
index 6773c6491fe46a19cd40cf15741caacfb63ab4fb..3e955d8b9e9158da657ae967dbc2623cb07d2591 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
 
+import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
@@ -42,10 +43,20 @@ public class SoftIrqRaiseHandler extends KernelEventHandler {
             return;
         }
         /*
-         * Mark this SoftIRQ as *raised* in the resource tree. State value = -2
+         * Mark this SoftIRQ as *raised* in the resource tree.
          */
         int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString());
-        ITmfStateValue value = StateValues.SOFT_IRQ_RAISED_VALUE;
+
+        ITmfStateValue value = (isInSoftirq(ss.queryOngoingState(quark)) ?
+                StateValues.SOFT_IRQ_RAISED_RUNNING_VALUE :
+                StateValues.SOFT_IRQ_RAISED_VALUE);
         ss.modifyAttribute(KernelEventHandlerUtils.getTimestamp(event), value, quark);
+
+    }
+
+    private static boolean isInSoftirq(@Nullable ITmfStateValue state) {
+        return (state != null &&
+                !state.isNull() &&
+                (state.unboxInt() & StateValues.CPU_STATUS_SOFTIRQ) == StateValues.CPU_STATUS_SOFTIRQ);
     }
 }
This page took 0.025952 seconds and 5 git commands to generate.