Remove unneed null checks
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 1 May 2015 22:02:23 +0000 (18:02 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 6 May 2015 23:16:13 +0000 (19:16 -0400)
A recent JDT update seems to have extended the null flow analysis
to consider the case where assigning an Integer from an int makes
it effectively non-null.

This points out that we were doing some redundant null checks.

Change-Id: Ie222b519f02e45584ae4f47381025fd28a8f6423
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/46967
Reviewed-by: Hudson CI
org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageStateProvider.java
org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/module/VirtualMachineStateProvider.java

index 2935214f012515209dc85c011f8a63a7c2bfd5a6..3de733949d3c139e8ab48eb4d28eb298d628e9ee 100644 (file)
@@ -130,21 +130,20 @@ public class KernelCpuUsageStateProvider extends AbstractTmfStateProvider {
                  * We add the time from startTime until now to the cumulative
                  * time of the thread
                  */
-                if (startTime != null) {
-                    ITmfStateValue value = ss.queryOngoingState(cumulativeTimeQuark);
-
-                    /*
-                     * Modify cumulative time for this CPU/TID combo: The total
-                     * time changes when the process is scheduled out. Nothing
-                     * happens when the process is scheduled in.
-                     */
-                    long prevCumulativeTime = Math.max(0, value.unboxLong());
-                    long newCumulativeTime = prevCumulativeTime + (ts - startTime);
-
-                    value = TmfStateValue.newValueLong(newCumulativeTime);
-                    ss.modifyAttribute(ts, value, cumulativeTimeQuark);
-                    fLastStartTimes.put(cpu, ts);
-                }
+                ITmfStateValue value = ss.queryOngoingState(cumulativeTimeQuark);
+
+                /*
+                 * Modify cumulative time for this CPU/TID combo: The total time
+                 * changes when the process is scheduled out. Nothing happens
+                 * when the process is scheduled in.
+                 */
+                long prevCumulativeTime = Math.max(0, value.unboxLong());
+                long newCumulativeTime = prevCumulativeTime + (ts - startTime);
+
+                value = TmfStateValue.newValueLong(newCumulativeTime);
+                ss.modifyAttribute(ts, value, cumulativeTimeQuark);
+                fLastStartTimes.put(cpu, ts);
+
             } catch (AttributeNotFoundException e) {
                 Activator.getDefault().logError("Attribute not found in LttngKernelCpuStateProvider", e); //$NON-NLS-1$
             }
index 0fc3c44d7d3824ed5c4d1d045d9b85f30b46e925..a39b71ca9b5d48c45ef44fa2d2615dd08b047c18 100644 (file)
@@ -210,12 +210,8 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
              * prev_state, string next_comm, int32 next_tid, int32 next_prio
              */
             {
-                Integer prevTid = ((Long) content.getField(fLayouts.get(event.getTrace()).fieldPrevTid()).getValue()).intValue();
-                Integer nextTid = ((Long) content.getField(fLayouts.get(event.getTrace()).fieldNextTid()).getValue()).intValue();
-
-                if (prevTid == null || nextTid == null) {
-                    break;
-                }
+                int prevTid = ((Long) content.getField(fLayouts.get(event.getTrace()).fieldPrevTid()).getValue()).intValue();
+                int nextTid = ((Long) content.getField(fLayouts.get(event.getTrace()).fieldNextTid()).getValue()).intValue();
 
                 if (host.isGuest()) {
                     /* Get the event's CPU */
This page took 0.028657 seconds and 5 git commands to generate.