lttng: Change syscalls to a flat attribute instead of a stack
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 7 May 2012 21:58:01 +0000 (17:58 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 9 May 2012 21:57:23 +0000 (17:57 -0400)
This will not show nested syscalls correctly, but those were
very rare in the first place, and have been completely removed
in recent kernel versions.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java

index 2a69e57183c64210d2738c94c86fe9e92bf4be7d..7293b926ec3eb2d1f11905ceb634357944e14c6b 100644 (file)
@@ -127,7 +127,7 @@ public class StateSystemFullHistoryTest {
 
         List<ITmfStateInterval> list;
         ITmfStateInterval interval;
-        int quark, quark2, valueInt;
+        int quark, valueInt;
         String valueStr;
 
         list = ssb.loadStateAtTime(interestingTimestamp1);
@@ -142,12 +142,8 @@ public class StateSystemFullHistoryTest {
         valueStr = interval.getStateValue().unboxStr();
         assertEquals("gdbus", valueStr);
 
-        /* Query a stack attribute, has to be done in two passes */
-        quark = ssb.getQuarkAbsolute(Attributes.THREADS, "1432", Attributes.EXEC_MODE_STACK);
+        quark = ssb.getQuarkAbsolute(Attributes.THREADS, "1432", Attributes.SYSTEM_CALL);
         interval = list.get(quark);
-        valueInt = interval.getStateValue().unboxInt(); /* The stack depth */
-        quark2 = ssb.getQuarkRelative(quark, Integer.toString(valueInt));
-        interval = list.get(quark2);
         valueStr = interval.getStateValue().unboxStr();
         assertTrue(valueStr.equals("sys_poll"));
     }
index 90b792b563b0c9d4c2668e85d79b075cb54b9322..e6305b638db8aa10b780f93c3ffa1cb146583e5b 100644 (file)
@@ -145,18 +145,10 @@ class CtfKernelHandler implements Runnable {
             case 1: // "exit_syscall":
             /* Fields: int64 ret */
             {
-                /* Pop "syscall" from the Exec_mode_stack */
-                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.EXEC_MODE_STACK);
-                try {
-                    ss.popAttribute(ts, quark);
-                } catch (AttributeNotFoundException e1) {
-                    /*
-                     * meh, can happen if we're missing events, we'll just
-                     * silently ignore it.
-                     */
-                    System.err.println(event.getTimestamp()
-                            + " Popping empty attribute: " + e1.getMessage()); //$NON-NLS-1$
-                }
+                /* Clear the current system call on the process */
+                quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
+                value = TmfStateValue.nullValue();
+                ss.modifyAttribute(ts, value, quark);
             }
                 break;
 
@@ -358,13 +350,10 @@ class CtfKernelHandler implements Runnable {
                      * syscall names are listed into the event type
                      */
 
-                    /*
-                     * Push the syscall name on the Exec_mode_stack of the
-                     * relevant PID
-                     */
-                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.EXEC_MODE_STACK);
+                    /* Assign the new system call to the process */
+                    quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
                     value = TmfStateValue.newValueString(eventName);
-                    ss.pushAttribute(ts, value, quark);
+                    ss.modifyAttribute(ts, value, quark);
                 }
             }
                 break;
@@ -420,7 +409,7 @@ class CtfKernelHandler implements Runnable {
     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.SYSTEM_CALL);
         ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
     }
 
index 5f01a744638637d2a89e51efcbb53b85c526259c..2b0fd487ed828902dc9d92ee73022aca5beff730 100644 (file)
@@ -39,7 +39,7 @@ public abstract class Attributes {
     public static final String PPID = "PPID";
     public static final String STATUS = "Status";
     public static final String EXEC_NAME = "Exec_name";
-    public static final String EXEC_MODE_STACK = "Exec_mode_stack";
+    public static final String SYSTEM_CALL = "System_call";
 
     /* Attributes under "Resources" */
     public static final String IRQS = "IRQs";
This page took 0.028776 seconds and 5 git commands to generate.