tmf.ui: callstack - replaced multiple single SS queries by full query
authorLoïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Mon, 18 Apr 2016 12:10:33 +0000 (08:10 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Tue, 19 Apr 2016 20:18:45 +0000 (16:18 -0400)
CallStackView would do a single query for every thread,
at the start of the statesystem, or at the end of the
statesystem.
This patch replaces all single queries in buildEntryList
by two full queries and reads to the result of those queries

Change-Id: Id59b355fd84bfc0b8e30ef3f3f375f8ca0dbe634
Signed-off-by: Loïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Reviewed-on: https://git.eclipse.org/r/70854
Reviewed-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java

index 6acb9937cc0ec0d8ef444198fb13bb834482663e..3e9bceedc0ef989136985cd85c221786e3c418dd 100644 (file)
@@ -588,25 +588,32 @@ public class CallStackView extends AbstractTimeGraphView {
             } else {
                 traceEntry.updateEndTime(end);
             }
-            for (int i = 0; i < threadQuarks.size(); i++) {
-                if (monitor.isCanceled()) {
-                    return;
-                }
-                int threadQuark = threadQuarks.get(i);
-                try {
+
+            try {
+                /* Only query startStates if necessary (threadEntry == null)*/
+                List<ITmfStateInterval> startStates = null;
+                List<ITmfStateInterval> endStates = ss.queryFullState(ss.getCurrentEndTime());
+                for (int i = 0; i < threadQuarks.size(); i++) {
+                    if (monitor.isCanceled()) {
+                        return;
+                    }
+                    int threadQuark = threadQuarks.get(i);
                     String[] callStackPath = module.getCallStackPath();
                     int callStackQuark = ss.getQuarkRelative(threadQuark, callStackPath);
                     String threadName = ss.getAttributeName(threadQuark);
                     long threadEnd = end + 1;
-                    ITmfStateInterval endInterval = ss.querySingleState(ss.getCurrentEndTime(), callStackQuark);
+                    ITmfStateInterval endInterval = endStates.get(callStackQuark);
                     if (endInterval.getStateValue().isNull() && endInterval.getStartTime() != ss.getStartTime()) {
                         threadEnd = endInterval.getStartTime();
                     }
                     ThreadEntry threadEntry = threadEntryMap.get(threadQuark);
                     if (threadEntry == null) {
-                        long threadId = ss.querySingleState(ss.getCurrentEndTime(), threadQuark).getStateValue().unboxLong();
+                        if (startStates == null) {
+                            startStates = ss.queryFullState(ss.getStartTime());
+                        }
+                        long threadId = endInterval.getStateValue().unboxLong();
                         long threadStart = start;
-                        ITmfStateInterval startInterval = ss.querySingleState(start, callStackQuark);
+                        ITmfStateInterval startInterval = startStates.get(callStackQuark);
                         if (startInterval.getStateValue().isNull()) {
                             threadStart = Math.min(startInterval.getEndTime() + 1, end + 1);
                         }
@@ -624,11 +631,11 @@ public class CallStackView extends AbstractTimeGraphView {
                         }
                         level++;
                     }
-                } catch (AttributeNotFoundException e) {
-                    Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
-                } catch (StateSystemDisposedException e) {
-                    /* Ignored */
                 }
+            } catch (AttributeNotFoundException e) {
+                Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
+            } catch (StateSystemDisposedException e) {
+                /* Ignored */
             }
             if (parentTrace == getTrace()) {
                 synchronized (this) {
This page took 0.026617 seconds and 5 git commands to generate.