Again along the lines of perfecting the display of processes states from kernel 
traces, I have another small suggestion. The code needed to convert event data 
to "state" information is simple and well localized. It is therefore fairly 
easy to leverage the infrastructure put in place by the TMF team to refine the 
control flow view display. As an example, my suggested improvement makes a 
noticeable change yet the patch is a one liner! If you have suggestions and 
ideas, we will be most interested in discussing possible further improvements.

I am tracing a shell script which does among other things "sleep 1; myprog". In 
the control flow view, we see the new process, for example 10192, called sh 
waiting for 1 second and then, on another line, a process named sleep with the 
same pid (10192) which comes out of waiting and terminates (lasting only a few 
miliseconds). This is rather counter-intuitive as sleep is not doing the sleep 
part. This is explained by the fact that the command name is taken from the 
sched_switch event. TMF thus only sees the new name long after the execve, when 
coming back from waiting; it then starts a new line for that process with the 
same pid but a new name.

One possibility is to change the name at the execve. However, the execve event 
contains the file name but not the (sometimes different) command name. My 
proposed change is to update the name at each sched_switch, thus in practice 
retaining the last command name seen for the process. Update means change the 
value for the whole interval, instead of Modify which keeps the old value up to 
now and changes for the new value after now. This one line change is provided 
at the message end.

Another possibility is to "modify" the name at each execve, using the "file 
name" which may differ from the command name, and to "update" with the correct 
command name at later sched_switch events. This would put on a separate line in 
the control flow view each different program executed, even if they are the 
same process.

diff --git 
a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
 
b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
index 2d48bbb..4e1d422 100644
--- 
a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
+++ 
b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
@@ -242,7 +247,7 @@ public class CtfKernelStateInput extends 
AbstractStateChangeInput {
                 /* Set the exec name of the new process */
                 quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, 
Attributes.EXEC_NAME);
                 value = TmfStateValue.newValueString(nextProcessName);
-                ss.modifyAttribute(ts, value, quark);
+                ss.updateOngoingState(value, quark);
 
                 /*
                  * Check if we need to set the syscall state and the PPID of
_______________________________________________
linuxtools-dev mailing list
linuxtools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/linuxtools-dev

Reply via email to