lttng: Fix Resource View for traces without sched_switch events
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 14 Nov 2014 15:54:43 +0000 (10:54 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 17 Nov 2014 22:31:32 +0000 (17:31 -0500)
The Resource View assumes that if the base quark of a resource is
present, the "Status" sub-attribute will always be there. This may
not be the case, for example if the trace does not have sched_switch
events enabled, but has shed_wakeup.

Change-Id: Iaf25cf3d8a5b8ee686281dc3064f241229c2c245
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/36492
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
org.eclipse.tracecompass.lttng2.kernel.ui/src/org/eclipse/tracecompass/internal/lttng2/kernel/ui/views/resources/ResourcesView.java

index 44dad6612eb137a14e1373a36afde7c66cba76d6..3013a8e6d4ee010579b2778a0119cb26afce59dd 100644 (file)
@@ -222,7 +222,16 @@ public class ResourcesView extends AbstractTimeGraphView {
 
         try {
             if (resourcesEntry.getType().equals(Type.CPU)) {
-                int statusQuark = ssq.getQuarkRelative(quark, Attributes.STATUS);
+                int statusQuark;
+                try {
+                    statusQuark = ssq.getQuarkRelative(quark, Attributes.STATUS);
+                } catch (AttributeNotFoundException e) {
+                    /*
+                     * The sub-attribute "status" is not available. May happen
+                     * if the trace does not have sched_switch events enabled.
+                     */
+                    return null;
+                }
                 List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ssq, statusQuark, realStart, realEnd - 1, resolution, monitor);
                 eventList = new ArrayList<>(statusIntervals.size());
                 long lastEndTime = -1;
This page took 0.026796 seconds and 5 git commands to generate.