List<Integer> list = ssb.getQuarks("*", "1577", Attributes.EXEC_NAME);
assertEquals(1, list.size());
- assertEquals(Integer.valueOf(398), list.get(0));
}
@Test
public void testGetQuarks_middle() {
List<Integer> list = ssb.getQuarks(Attributes.THREADS, "*", Attributes.EXEC_NAME);
- assertEquals(Integer.valueOf(18), list.get(4));
- assertEquals(Integer.valueOf(54), list.get(10));
- assertEquals(Integer.valueOf(64), list.get(12));
+ /* Number of different kernel threads in the trace */
+ assertEquals(168, list.size());
}
@Test
public void testGetQuarks_end() {
List<Integer> list = ssb.getQuarks(Attributes.THREADS, "1577", "*");
- assertEquals(3, list.size());
- assertEquals(Integer.valueOf(398), list.get(1));
+ /* There should be 4 sub-attributes for each Thread node */
+ assertEquals(4, list.size());
}
}
/* Update the currentThreadNodes pointer */
Integer newCurrentThreadNode = ss.getQuarkAbsoluteAndAdd(Attributes.THREADS, nextTid.toString());
+ initThreadNode(newCurrentThreadNode);
currentThreadNodes.set(eventCpu, newCurrentThreadNode);
/* Set the status of the new scheduled process */
- quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.STATUS);
+ quark = ss.getQuarkRelative(newCurrentThreadNode, Attributes.STATUS);
value = TmfStateValue.newValueInt(Attributes.STATUS_RUN);
ss.modifyAttribute(ts, value, quark);
/* Set the exec name of the new process */
- quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.EXEC_NAME);
+ quark = ss.getQuarkRelative(newCurrentThreadNode, Attributes.EXEC_NAME);
value = TmfStateValue.newValueString(nextProcessName);
ss.modifyAttribute(ts, value, quark);
Integer childTid = ((Long) content.getField(LttngStrings.CHILD_TID).getValue()).intValue();
tidNode = ss.getQuarkAbsoluteAndAdd(Attributes.THREADS, childTid.toString());
+ initThreadNode(tidNode);
/*
* Add the new process with its known TID, PPID, and initial
* Exec_name
*/
- quark = ss.getQuarkRelativeAndAdd(tidNode, Attributes.PPID);
+ quark = ss.getQuarkRelative(tidNode, Attributes.PPID);
value = TmfStateValue.newValueInt(parentTid);
ss.modifyAttribute(ts, value, quark);
/* Set the new process' exec_name */
- quark = ss.getQuarkRelativeAndAdd(tidNode, Attributes.EXEC_NAME);
+ quark = ss.getQuarkRelative(tidNode, Attributes.EXEC_NAME);
value = TmfStateValue.newValueString(childProcessName);
ss.modifyAttribute(ts, value, quark);
break;
*/
sve.printStackTrace();
}
+ }
+ /**
+ * Ensure we always have some sub-attributes available for every "TID" node.
+ */
+ private void initThreadNode(int currentThreadNode) {
+ ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.PPID);
+ ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.EXEC_NAME);
+ ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.EXEC_MODE_STACK);
+ ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
}
private static HashMap<String, Integer> fillEventNames() {