*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.model.trange;
-import org.eclipse.linuxtools.lttng.state.StateStrings;
-import org.eclipse.linuxtools.lttng.state.model.LttngIRQState;
-import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
+
+import org.eclipse.linuxtools.lttng.core.state.StateStrings;
+import org.eclipse.linuxtools.lttng.core.state.model.LTTngCPUState;
+import org.eclipse.linuxtools.lttng.core.state.model.LttngIRQState;
+import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.lttng.core.state.model.LttngTrapState;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource.ResourceTypes;
/**
public String getStateMode(LttngTraceState traceSt) {
LttngIRQState irqState = traceSt.getIrq_states().get(
getResourceId());
- String statemode = "";
+ String statemode = ""; //$NON-NLS-1$
if (irqState != null) {
statemode = irqState.peekFromIrqStack().getInName();
}
@Override
public String getStateMode(LttngTraceState traceSt) {
// Determine the trap state.
- long trapState = traceSt.getTrap_states().get(getResourceId())
- .getRunning().longValue();
- String trapStateMode = "";
- if (trapState == 0) {
- trapStateMode = StateStrings.TrapMode.LTTV_TRAP_IDLE
- .getInName();
- } else {
- trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY
- .getInName();
+ String trapStateMode = ""; //$NON-NLS-1$
+ LttngTrapState ts = traceSt.getTrap_states().get(getResourceId());
+
+ // *** Note :
+ // Ts might not have been created yet.
+ // This is because the state system will be updated next to this before hook
+ // It should be correct to create it here as Busy
+ // (traps are created with running++ so it wont be idle)
+ if ( ts != null ) {
+ Long trapState = ts.getRunning();
+
+ if (trapState == 0) {
+ trapStateMode = StateStrings.TrapMode.LTTV_TRAP_IDLE.getInName();
+ } else {
+ trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
+ }
}
-
+ else {
+ trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY.getInName();
+ }
+
return trapStateMode;
}
};
@Override
public String getStateMode(LttngTraceState traceSt) {
// Get the resource state mode
- String cpuStateMode = traceSt.getCpu_states().get(
- getResourceId())
- .peekFromCpuStack().getInName();
+ LTTngCPUState cpuState = traceSt.getCpu_states().get(
+ getResourceId());
+
+ String cpuStateMode = ""; //$NON-NLS-1$
+ if (cpuState != null) {
+ cpuStateMode = traceSt.getCpu_states().get(
+ getResourceId())
+ .peekFromCpuStack().getInName();
+ }
return cpuStateMode;
}