Integer tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, -1);
assertNull(tid);
- tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 80);
+ tid = KernelThreadInformationProvider.getThreadOnCpu(module, 0, 90);
assertNull(tid);
/* Check with invalid cpus */
Integer ppid = KernelThreadInformationProvider.getParentPid(module, 11, -1);
assertNull(ppid);
- ppid = KernelThreadInformationProvider.getParentPid(module, 11, 80);
+ ppid = KernelThreadInformationProvider.getParentPid(module, 11, 90);
assertNull(ppid);
/* Check with invalid cpus */
List<ITmfStateInterval> intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, -15, -5, 3, monitor);
assertTrue(intervals.isEmpty());
- intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 80, 1500000000L, 50, monitor);
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 90, 1500000000L, 50, monitor);
assertTrue(intervals.isEmpty());
/* Check invalid quarks */
intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 25, 50L, 3, monitor);
testIntervals("tid 20 [25,50,3]", intervals, values6);
+ ITmfStateValue[] values7 = { StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE };
+ intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process20, 80L, 85L, 3, monitor);
+ testIntervals("tid 20 [80,85,3]", intervals, values7);
+
}
}
<field name="next_tid" value="20" type="long" />
<field name="next_prio" value="20" type="long" />
</event>
+<event timestamp="80" name="sched_switch">
+<field name="cpu" value="1" type="int" />
+<field name="prev_comm" value="proc20" type="string" />
+<field name="prev_tid" value="20" type="long" />
+<field name="prev_prio" value="20" type="long" />
+<field name="prev_state" value="2048" type="long" />
+<field name="next_comm" value="proc21" type="string" />
+<field name="next_tid" value="21" type="long" />
+<field name="next_prio" value="20" type="long" />
+</event>
</trace>
\ No newline at end of file
* #define TASK_WAKEKILL 128
* #define TASK_WAKING 256
* #define TASK_PARKED 512
- * #define TASK_STATE_MAX 1024
+ * #define TASK_NOLOAD 1024
+ * #define TASK_STATE_MAX 2048
* </pre>
*/
/**
*/
int TASK_PARK = 512;
+ /**
+ * Task that do not contribute to load average (since Linux 4.1)
+ */
+ int TASK_NOLOAD = 1024;
+
/**
* This is the maximum value + 1 that the task state can be. TASK_STATE_MAX
* - 1 is useful to mask the task state.
*/
- int TASK_STATE_MAX = 1024;
+ int TASK_STATE_MAX = 2048;
/**
* Process statuses, used in LTTng statedump events.
* 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 = 13;
+ private static final int VERSION = 14;
// ------------------------------------------------------------------------
// Fields
private static void setOldProcessStatus(ITmfStateSystemBuilder ss, Long prevState, Integer formerThreadNode, long timestamp) throws AttributeNotFoundException {
ITmfStateValue value;
/*
- * 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.
+ * 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.
+ *
+ * Since Linux 4.1, the TASK_NOLOAD state was created and
+ * TASK_STATE_MAX is now 2048. We use TASK_NOLOAD as the new max
+ * because it does not modify the displayed state value.
*/
- int state = (int) (prevState & ~(LinuxValues.TASK_STATE_MAX));
+ int state = (int) (prevState & (LinuxValues.TASK_NOLOAD - 1));
if (isRunning(state)) {
value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;