From 0bacba1a1b0008b6822be67222da2690323a8a3f Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Tue, 3 Nov 2015 17:57:04 -0500 Subject: [PATCH] analysis: Fix IndexOutOfBoundsException in ResourcesView This can happen if a new IRQ or SoftIRQ attribute is created concurrently with a zoom thread that has already queried the state system for a full state that does not include the new attribute. The zoom thread can then provide the full state to the ResourcesView to get the event list of an IRQ or SoftIRQ entry that did not exist at the time that the full state was created. Change-Id: I1c5f8a8332f44b44f1954b01c3503a844dedc22e Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/59616 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- .../os/linux/ui/views/resources/ResourcesView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesView.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesView.java index e9ee4b0238..1801fcf5f1 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesView.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesView.java @@ -244,7 +244,7 @@ public class ResourcesView extends AbstractStateSystemTimeGraphView { return null; } if (statusQuark >= fullState.size()) { - /* No information on this cpu (yet?), skip it for now */ + /* No information on this CPU (yet?), skip it for now */ continue; } ITmfStateInterval statusInterval = fullState.get(statusQuark); @@ -267,7 +267,7 @@ public class ResourcesView extends AbstractStateSystemTimeGraphView { } } else if (resourcesEntry.getType().equals(Type.IRQ) || resourcesEntry.getType().equals(Type.SOFT_IRQ)) { eventList = new ArrayList<>(fullStates.size()); - ITmfStateInterval lastInterval = prevFullState == null ? null : prevFullState.get(quark); + ITmfStateInterval lastInterval = prevFullState == null || quark >= prevFullState.size() ? null : prevFullState.get(quark); long lastStartTime = lastInterval == null ? -1 : lastInterval.getStartTime(); long lastEndTime = lastInterval == null ? -1 : lastInterval.getEndTime() + 1; boolean lastIsNull = lastInterval == null ? false : lastInterval.getStateValue().isNull(); @@ -275,6 +275,10 @@ public class ResourcesView extends AbstractStateSystemTimeGraphView { if (monitor.isCanceled()) { return null; } + if (quark >= fullState.size()) { + /* No information on this IRQ (yet?), skip it for now */ + continue; + } ITmfStateInterval irqInterval = fullState.get(quark); long time = irqInterval.getStartTime(); long duration = irqInterval.getEndTime() - time + 1; -- 2.34.1