From: Loïc Prieur-Drevon Date: Mon, 18 Apr 2016 15:28:23 +0000 (-0400) Subject: lttng.ust: Replace multiple single queries by one full query X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=ccf0e1a644dea63dcf91e2848c2626bb2d1d2448;p=deliverable%2Ftracecompass.git lttng.ust: Replace multiple single queries by one full query To update data in MemoryUsageViewer, the State System would be queried once per thread. This patch replaces multiple single queries by a single full state query and reads to the result. Change-Id: I5fbb6d80a498898342db34f8278a85f02e1c6736 Signed-off-by: Loïc Prieur-Drevon Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/70875 Reviewed-by: Hudson CI Reviewed-by: Marc-Andre Laperle Tested-by: Marc-Andre Laperle --- diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/views/memusage/MemoryUsageViewer.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/views/memusage/MemoryUsageViewer.java index f358010c82..80eee6a91c 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/views/memusage/MemoryUsageViewer.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui/src/org/eclipse/tracecompass/internal/lttng2/ust/ui/views/memusage/MemoryUsageViewer.java @@ -31,6 +31,7 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundExc import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; +import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; @@ -113,6 +114,7 @@ public class MemoryUsageViewer extends TmfCommonXLineChartViewer { long offset = this.getTimeOffset(); /* Initialize quarks and series names */ + List fullState = ss.queryFullState(start); for (int quark : tidQuarks) { fYValues.put(quark, new double[xvalues.length]); fMemoryQuarks.put(quark, ss.getQuarkRelative(quark, UstMemoryStrings.UST_MEMORY_MEMORY_ATTRIBUTE)); @@ -120,7 +122,7 @@ public class MemoryUsageViewer extends TmfCommonXLineChartViewer { String oldSeriesName = fSeriesName.get(quark); String seriesName = null; try { - ITmfStateValue procnameValue = ss.querySingleState(start, procNameQuark).getStateValue(); + ITmfStateValue procnameValue = fullState.get(procNameQuark).getStateValue(); String procname = ""; //$NON-NLS-1$ if (!procnameValue.isNull()) { procname = procnameValue.unboxStr(); @@ -153,14 +155,18 @@ public class MemoryUsageViewer extends TmfCommonXLineChartViewer { // long conversion time = time < traceStart ? traceStart : time; time = time > traceEnd ? traceEnd : time; + try { + fullState = ss.queryFullState(time); + for (int quark : tidQuarks) { + double[] values = checkNotNull(fYValues.get(quark)); - for (int quark : tidQuarks) { - double[] values = checkNotNull(fYValues.get(quark)); - try { Integer memQuark = checkNotNull(fMemoryQuarks.get(quark)); - yvalue = ss.querySingleState(time, memQuark.intValue()).getStateValue().unboxLong(); + yvalue = fullState.get(memQuark.intValue()).getStateValue().unboxLong(); values[i] = yvalue; - } catch (TimeRangeException e) { + } + } catch (TimeRangeException e) { + for (int quark : tidQuarks) { + double[] values = checkNotNull(fYValues.get(quark)); values[i] = 0; } }