From 2241331e075141aaa4079421a80997e8f286137b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Genevi=C3=A8ve=20Bastien?= Date: Fri, 19 Feb 2016 11:05:22 -0500 Subject: [PATCH] analysis.os: Make the CPU usage state provider use the increment method MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: If6fed23d4656a7cb233f002e1321ea4d7ac5852f Signed-off-by: Geneviève Bastien Reviewed-on: https://git.eclipse.org/r/66945 Reviewed-by: Matthew Khouzam Reviewed-by: Hudson CI --- .../core/cpuusage/KernelCpuUsageStateProvider.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageStateProvider.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageStateProvider.java index e5c8f97d3c..ca08607bd3 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageStateProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageStateProvider.java @@ -23,9 +23,8 @@ import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout; import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; +import org.eclipse.tracecompass.statesystem.core.StateSystemBuilderUtils; import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; -import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; -import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue; import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; import org.eclipse.tracecompass.tmf.core.event.ITmfEventField; import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect; @@ -125,22 +124,13 @@ public class KernelCpuUsageStateProvider extends AbstractTmfStateProvider { startTime = fTraceStart; } - /* - * We add the time from startTime until now to the cumulative - * time of the thread - */ - 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); + StateSystemBuilderUtils.incrementAttributeLong(ss, ts, cumulativeTimeQuark, ts - startTime); - value = TmfStateValue.newValueLong(newCumulativeTime); - ss.modifyAttribute(ts, value, cumulativeTimeQuark); fLastStartTimes.put(cpu, ts); } catch (AttributeNotFoundException e) { -- 2.34.1