From 1a0ff02c88c5dcb9c51b9d43e930ae39bd0bde0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lo=C3=AFc=20Prieur-Drevon?= Date: Mon, 18 Apr 2016 08:10:33 -0400 Subject: [PATCH] tmf.ui: callstack - replaced multiple single SS queries by full query MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://git.eclipse.org/r/70854 Reviewed-by: Hudson CI Reviewed-by: Genevieve Bastien Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- .../tmf/ui/views/callstack/CallStackView.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java index 6acb9937cc..3e9bceedc0 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java @@ -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 startStates = null; + List 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) { -- 2.34.1