import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.LinuxValues;
import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.StateValues;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
-import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernelanalysis.LinuxValues;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
* 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 = 9;
private static final int IRQ_HANDLER_ENTRY_INDEX = 1;
private static final int IRQ_HANDLER_EXIT_INDEX = 2;
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_DEAD) {
- value = TmfStateValue.nullValue();
- } else {
- value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
- }
- } else {
+ switch (prevState.intValue()) {
+ case LinuxValues.TASK_STATE_RUNNING:
value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
+ break;
+ case LinuxValues.TASK_INTERRUPTIBLE:
+ case LinuxValues.TASK_UNINTERRUPTIBLE:
+ value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
+ break;
+ case LinuxValues.TASK_DEAD:
+ value = TmfStateValue.nullValue();
+ break;
+ default:
+ value = StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE;
+ break;
}
+
+ quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
ss.modifyAttribute(ts, value, quark);
/* Set the status of the new scheduled process */