tmf: Bug 494197: Empty event list for CallStackEntry when no process
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 17 May 2016 13:10:23 +0000 (09:10 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Fri, 20 May 2016 21:51:01 +0000 (17:51 -0400)
The three-level deep loop to populate the event list from the build
thread did not reach the third level if a trace did not have processes
or threads. The loops are replaced with a recursive consumer.

Change-Id: Ie7eebb57f562bad0c6620ae08fcde8b585c52ca9
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/72916
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java

index 43286766e5b02bdacc8a284634c571c6d6b60b02..8e915d84a86f8926d582a220450181bafe6e18e7 100644 (file)
@@ -693,16 +693,21 @@ public class CallStackView extends AbstractTimeGraphView {
                 refresh();
             }
 
-            for (ITimeGraphEntry processEntry : traceEntry.getChildren()) {
-                for (ITimeGraphEntry threadEntry : processEntry.getChildren()) {
-                    for (ITimeGraphEntry callStackEntry : threadEntry.getChildren()) {
-                        if (monitor.isCanceled()) {
-                            return;
-                        }
-                        buildStatusEvents(parentTrace, (CallStackEntry) callStackEntry, monitor, ss.getStartTime(), end);
+            Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() {
+                @Override
+                public void accept(TimeGraphEntry entry) {
+                    if (monitor.isCanceled()) {
+                        return;
                     }
+                    if (entry instanceof CallStackEntry) {
+                        buildStatusEvents(parentTrace, (CallStackEntry) entry, monitor, ss.getStartTime(), end);
+                        return;
+                    }
+                    entry.getChildren().forEach(this);
                 }
-            }
+            };
+            traceEntry.getChildren().forEach(consumer);
+
             start = end;
         }
     }
This page took 0.024926 seconds and 5 git commands to generate.