Merge entries with same TID in Control Flow view
authorPatrick Tasse <patrick.tasse@gmail.com>
Wed, 30 Jan 2013 21:31:40 +0000 (16:31 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 31 Jan 2013 21:58:04 +0000 (16:58 -0500)
Separate entries are no longer created when a thread changes its exec
name over time. A single entry is used, and its name is set to the last
exec name of the thread. If the thread is terminated and reused, a
separate entry will be created with a different name and birth time.

Change-Id: I97d06adf8c68f9f56594059bc51a38fa78e36842
Reviewed-on: https://git.eclipse.org/r/10049
Tested-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java

index 3e1fe97e443e243a265c2ea533bc0889caf01e03..01ac0ab169d5d5581d1b0149533bea2ea9101a84 100644 (file)
@@ -29,10 +29,9 @@ public class ControlFlowEntry implements ITimeGraphEntry {
     private final CtfKernelTrace fTrace;
     private ControlFlowEntry fParent = null;
     private final ArrayList<ControlFlowEntry> fChildren = new ArrayList<ControlFlowEntry>();
-    private final String fName;
+    private String fName;
     private final int fThreadId;
     private final int fParentThreadId;
-    private long fBirthTime = -1;
     private long fStartTime = -1;
     private long fEndTime = -1;
     private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();
@@ -51,21 +50,17 @@ public class ControlFlowEntry implements ITimeGraphEntry {
      *            The TID of the thread
      * @param parentThreadId
      *            the Parent_TID of this thread
-     * @param birthTime
-     *            The birth time of this entry (this allows separating different
-     *            process that could have the same TID)
      * @param startTime
      *            The start time of this process's lifetime
      * @param endTime
      *            The end time of this process
      */
-    public ControlFlowEntry(int threadQuark, CtfKernelTrace trace, String execName, int threadId, int parentThreadId, long birthTime, long startTime, long endTime) {
+    public ControlFlowEntry(int threadQuark, CtfKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) {
         fThreadQuark = threadQuark;
         fTrace = trace;
         fName = execName;
         fThreadId = threadId;
         fParentThreadId = parentThreadId;
-        fBirthTime = birthTime;
         fStartTime = startTime;
         fEndTime = endTime;
     }
@@ -90,6 +85,14 @@ public class ControlFlowEntry implements ITimeGraphEntry {
         return fName;
     }
 
+    /**
+     * Update the entry name
+     * @param execName the updated entry name
+     */
+    public void setName(String execName) {
+        fName = execName;
+    }
+
     @Override
     public long getStartTime() {
         return fStartTime;
@@ -151,15 +154,6 @@ public class ControlFlowEntry implements ITimeGraphEntry {
         return fParentThreadId;
     }
 
-    /**
-     * Get the birth time of this entry/process
-     *
-     * @return The birth time
-     */
-    public long getBirthTime() {
-        return fBirthTime;
-    }
-
     /**
      * Add an event to this process's timeline
      *
index f9678a44947bb4834cd39c606c19b014c98a9c20..0974aa56ba040c682bac3d11cce4665de8ee6557 100644 (file)
@@ -232,7 +232,7 @@ public class ControlFlowView extends TmfView {
                     return Integer.toString(entry.getParentThreadId());
                 }
             } else if (columnIndex == 3) {
-                return Utils.formatTime(entry.getBirthTime(), TimeFormat.CALENDAR, Resolution.NANOSEC);
+                return Utils.formatTime(entry.getStartTime(), TimeFormat.CALENDAR, Resolution.NANOSEC);
             } else if (columnIndex == 4) {
                 return entry.getTrace().getName();
             }
@@ -660,7 +660,7 @@ public class ControlFlowView extends TmfView {
                         if (monitor.isCanceled()) {
                             return;
                         }
-                        long birthTime = -1;
+                        ControlFlowEntry entry = null;
                         for (ITmfStateInterval execNameInterval : execNameIntervals) {
                             if (monitor.isCanceled()) {
                                 return;
@@ -669,19 +669,21 @@ public class ControlFlowView extends TmfView {
                                 String execName = execNameInterval.getStateValue().unboxStr();
                                 long startTime = execNameInterval.getStartTime();
                                 long endTime = execNameInterval.getEndTime() + 1;
-                                if (birthTime == -1) {
-                                    birthTime = startTime;
-                                }
                                 int ppid = -1;
                                 if (ppidQuark != -1) {
                                     ITmfStateInterval ppidInterval = ssq.querySingleState(startTime, ppidQuark);
                                     ppid = ppidInterval.getStateValue().unboxInt();
                                 }
-                                ControlFlowEntry entry = new ControlFlowEntry(threadQuark, ctfKernelTrace, execName, threadId, ppid, birthTime, startTime, endTime);
-                                entryList.add(entry);
+                                if (entry == null) {
+                                    entry = new ControlFlowEntry(threadQuark, ctfKernelTrace, execName, threadId, ppid, startTime, endTime);
+                                    entryList.add(entry);
+                                } else {
+                                    // update the name of the entry to the latest execName
+                                    entry.setName(execName);
+                                }
                                 entry.addEvent(new TimeEvent(entry, startTime, endTime - startTime));
                             } else {
-                                birthTime = -1;
+                                entry = null;
                             }
                         }
                     } catch (AttributeNotFoundException e) {
This page took 0.040078 seconds and 5 git commands to generate.