lttng: Fix error in virtual machine analysis
authorCédric Biancheri <cdc.biancheri@gmail.com>
Fri, 25 Sep 2015 02:46:40 +0000 (22:46 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 29 Sep 2015 02:07:32 +0000 (22:07 -0400)
The analysis was not checking if the virtual cpu was idle
before setting the current state to preempted.
Now it is ignored in this situation.

Change-Id: Iddef5c2ec1c916ea0b591d0106b4e6473febb819
Signed-off-by: Cédric Biancheri <cdc.biancheri@gmail.com>
Reviewed-on: https://git.eclipse.org/r/56728
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/module/VirtualMachineStateProvider.java

index a39b71ca9b5d48c45ef44fa2d2615dd08b047c18..f032be987341b53569093b4cc4355b42091f704c 100644 (file)
@@ -217,7 +217,10 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
                     /* Get the event's CPU */
                     Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event);
                     if (cpuObj == null) {
-                        /* We couldn't find any CPU information, ignore this event */
+                        /*
+                         * We couldn't find any CPU information, ignore this
+                         * event
+                         */
                         break;
                     }
                     Integer cpu = (Integer) cpuObj;
@@ -253,9 +256,11 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
 
                     /* Add the preempted flag to the status */
                     value = ss.queryOngoingState(curStatusQuark);
-                    int newVal = Math.max(VcpuStateValues.VCPU_UNKNOWN, value.unboxInt());
-                    value = TmfStateValue.newValueInt(newVal | VcpuStateValues.VCPU_PREEMPT);
-                    ss.modifyAttribute(ts, value, curStatusQuark);
+                    if ((value.unboxInt() & VcpuStateValues.VCPU_IDLE) == 0) {
+                        int newVal = Math.max(VcpuStateValues.VCPU_UNKNOWN, value.unboxInt());
+                        value = TmfStateValue.newValueInt(newVal | VcpuStateValues.VCPU_PREEMPT);
+                        ss.modifyAttribute(ts, value, curStatusQuark);
+                    }
                 }
 
                 /* Verify if the next thread corresponds to a virtual CPU */
@@ -301,9 +306,11 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
                     int curStatusQuark = ss.getQuarkRelativeAndAdd(getNodeVirtualMachines(), vm.getHostId(),
                             Long.toString(virtualCpu.getCpuId()), VmAttributes.STATUS);
                     value = ss.queryOngoingState(curStatusQuark);
-                    int newVal = Math.max(VcpuStateValues.VCPU_UNKNOWN, value.unboxInt());
-                    value = TmfStateValue.newValueInt(newVal | VcpuStateValues.VCPU_VMM);
-                    ss.modifyAttribute(ts, value, curStatusQuark);
+                    if ((value.unboxInt() & VcpuStateValues.VCPU_IDLE) == 0) {
+                        int newVal = Math.max(VcpuStateValues.VCPU_UNKNOWN, value.unboxInt());
+                        value = TmfStateValue.newValueInt(newVal | VcpuStateValues.VCPU_VMM);
+                        ss.modifyAttribute(ts, value, curStatusQuark);
+                    }
                 }
 
                 /*
This page took 0.026103 seconds and 5 git commands to generate.