TMF: Add method to get traces with build thread in Time graph view
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Wed, 12 Feb 2014 14:15:24 +0000 (09:15 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Fri, 14 Feb 2014 22:09:38 +0000 (17:09 -0500)
This new method returns the traces for which a build thread will be started
in the abstract time graph view. This will allow a time graph view displaying
results from an experiment to override this method so that only one build
thread for the experiment starts.

Change-Id: I630424b3753f98924fc4c2dfc71a4902cddb0bee
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/21887
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java

index 1c5dc2d5be8208d63aa153c9412352bcbb8020c2..641ccc483e029c4a9054941f49c7bd65db4ef2ec 100644 (file)
@@ -17,6 +17,7 @@
 package org.eclipse.linuxtools.tmf.ui.views.timegraph;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -907,7 +908,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
     @TmfSignalHandler
     public void traceClosed(final TmfTraceClosedSignal signal) {
         synchronized (fBuildThreadMap) {
-            for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
+            for (ITmfTrace trace : getTracesToBuild(signal.getTrace())) {
                 BuildThread buildThread = fBuildThreadMap.remove(trace);
                 if (buildThread != null) {
                     buildThread.cancel();
@@ -1008,7 +1009,7 @@ public abstract class AbstractTimeGraphView extends TmfView {
                 setStartTime(Long.MAX_VALUE);
                 setEndTime(Long.MIN_VALUE);
                 synchronized (fBuildThreadMap) {
-                    for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
+                    for (ITmfTrace trace : getTracesToBuild(fTrace)) {
                         BuildThread buildThread = new BuildThread(trace, fTrace, getName());
                         fBuildThreadMap.put(trace, buildThread);
                         buildThread.start();
@@ -1033,6 +1034,23 @@ public abstract class AbstractTimeGraphView extends TmfView {
 
     }
 
+    /**
+     * Return the list of traces whose data or analysis results will be used to
+     * populate the view. By default, if the trace is an experiment, the traces
+     * under it will be returned, otherwise, the trace itself is returned.
+     *
+     * A build thread will be started for each trace returned by this method,
+     * some of which may receive events in live streaming mode.
+     *
+     * @param trace
+     *            The trace associated with this view
+     * @return List of traces with data to display
+     * @since 3.0
+     */
+    protected Iterable<ITmfTrace> getTracesToBuild(ITmfTrace trace) {
+        return Arrays.asList(TmfTraceManager.getTraceSet(trace));
+    }
+
     /**
      * Build the entries list to show in this time graph
      *
This page took 0.030776 seconds and 5 git commands to generate.