import java.util.Map;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.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;
final String eventName = event.getName();
if (eventName.equals(fLayout.eventSchedSwitch())) {
- Object cpuObj = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event);
- if (cpuObj == null) {
+ Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event);
+ if (cpu == null) {
/* We couldn't find any CPU information, ignore this event */
return;
}
- Integer cpu = (Integer) cpuObj;
/*
* Fields: string prev_comm, int32 prev_tid, int32 prev_prio, int64
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) {