diff options
author | Alexandre Montplaisir | 2012-05-01 19:29:32 +0000 |
---|---|---|
committer | Alexandre Montplaisir | 2012-05-02 02:27:43 +0000 |
commit | f3013baf8738a0b9ec5732c5dea7385d35a1471c (patch) | |
tree | 42db6914cf872d37b3a4592d7516ef5ff6591bea /lttng/org.eclipse.linuxtools.lttng2.kernel.core | |
parent | 92a234be93fddbcc0393bfe80d88e2e69a120375 (diff) | |
download | org.eclipse.linuxtools-f3013baf8738a0b9ec5732c5dea7385d35a1471c.tar.gz org.eclipse.linuxtools-f3013baf8738a0b9ec5732c5dea7385d35a1471c.tar.xz org.eclipse.linuxtools-f3013baf8738a0b9ec5732c5dea7385d35a1471c.zip |
lttng: Always create the sub-attributes of TID nodes
This makes the history slightly bigger, but it avoids having
to catch all sort of exceptions in the views, for the cases
where the expected sub-attributes never get populated. Now
they will simply contain a "null" value for the whole duration.
Also relaxed the test cases a bit, changed it so we won't have
to update them every time we make a single change to the state
provider.
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Diffstat (limited to 'lttng/org.eclipse.linuxtools.lttng2.kernel.core')
-rw-r--r-- | lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java index 86a590bd60..d6072561d8 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java @@ -225,15 +225,16 @@ class CtfKernelHandler implements Runnable { /* 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); @@ -264,17 +265,18 @@ class CtfKernelHandler implements Runnable { 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; @@ -375,7 +377,16 @@ class CtfKernelHandler implements Runnable { */ 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() { |