analysis: Fix IndexOutOfBoundsException in ResourcesView
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 3 Nov 2015 22:57:04 +0000 (17:57 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 10 Dec 2015 14:26:21 +0000 (09:26 -0500)
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 <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/59616
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesView.java

index e9ee4b02380c93799ea53e6c6ffa9144f994a609..1801fcf5f1f25ee7f7272752aa041dc01772d029 100644 (file)
@@ -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;
This page took 0.028525 seconds and 5 git commands to generate.