aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Dagenais2013-01-08 11:53:35 (EST)
committerAlexandre Montplaisir2013-01-16 11:53:50 (EST)
commite4066ac82c2634f4bb027ea51e45e68d38292e0b (patch)
treeadfe7f8555239fd6e09594b8b63e3a4f228850d2
parentda8cfaca0f55420bfdabac0c94d4295bb32abc2c (diff)
downloadorg.eclipse.linuxtools-e4066ac82c2634f4bb027ea51e45e68d38292e0b.zip
org.eclipse.linuxtools-e4066ac82c2634f4bb027ea51e45e68d38292e0b.tar.gz
org.eclipse.linuxtools-e4066ac82c2634f4bb027ea51e45e68d38292e0b.tar.bz2
lttng: State of processes from LTTng kernel tracesrefs/changes/40/9540/3
Separate WAIT_FOR_CPU and WAIT_BLOCKED states, and display them in different colors in the Control Flow View. Change-Id: I327c868841a45b411537d7e4d9e525d30d40ceab Reviewed-on: https://git.eclipse.org/r/9540 Tested-by: Hudson CI IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/StateValues.java3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java18
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java48
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java4
4 files changed, 41 insertions, 32 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/StateValues.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/StateValues.java
index c63d346..9f297a2 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/StateValues.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/StateValues.java
@@ -32,10 +32,11 @@ public class StateValues {
/* Process status */
public static final int PROCESS_STATUS_UNKNOWN = 0;
- public static final int PROCESS_STATUS_WAIT = 1;
+ public static final int PROCESS_STATUS_WAIT_BLOCKED = 1;
public static final int PROCESS_STATUS_RUN_USERMODE = 2;
public static final int PROCESS_STATUS_RUN_SYSCALL = 3;
public static final int PROCESS_STATUS_INTERRUPTED = 4;
+ public static final int PROCESS_STATUS_WAIT_FOR_CPU = 5;
/* SoftIRQ-specific stuff. -1: null/disabled, >= 0: running on that CPU */
public static final int SOFT_IRQ_RAISED = -2;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
index 2d48bbb..2dd8659 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelStateInput.java
@@ -224,7 +224,7 @@ public class CtfKernelStateInput extends AbstractStateChangeInput {
*/
{
Integer prevTid = ((Long) content.getField(LttngStrings.PREV_TID).getValue()).intValue();
- //Long prevState = (Long) content.getField(LttngStrings.PREV_STATE).getValue();
+ Long prevState = (Long) content.getField(LttngStrings.PREV_STATE).getValue();
String nextProcessName = (String) content.getField(LttngStrings.NEXT_COMM).getValue();
Integer nextTid = ((Long) content.getField(LttngStrings.NEXT_TID).getValue()).intValue();
@@ -233,7 +233,11 @@ public class CtfKernelStateInput extends AbstractStateChangeInput {
/* Set the status of the process that got scheduled out. */
quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.STATUS);
- value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT);
+ if (prevState != 0) {
+ value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
+ } else {
+ value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+ }
ss.modifyAttribute(ts, value, quark);
/* Set the status of the new scheduled process */
@@ -307,7 +311,7 @@ public class CtfKernelStateInput extends AbstractStateChangeInput {
/* Set the new process' status */
quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.STATUS);
- value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT);
+ value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
ss.modifyAttribute(ts, value, quark);
/* Set the process' syscall name, to be the same as the parent's */
@@ -374,9 +378,11 @@ public class CtfKernelStateInput extends AbstractStateChangeInput {
/* Set the process' status */
quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.STATUS);
if (ss.queryOngoingState(quark).isNull()) {
- /*"5" here means "LTTNG_WAIT" in the LTTng kernel tracer */
- if (status == 5) {
- value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT);
+ /* "2" here means "WAIT_FOR_CPU", and "5" "WAIT_BLOCKED" in the LTTng kernel. */
+ if (status == 2) {
+ value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_FOR_CPU);
+ } else if (status == 5) {
+ value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_WAIT_BLOCKED);
} else {
value = TmfStateValue.newValueInt(StateValues.PROCESS_STATUS_UNKNOWN);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
index 0023e78..b1e0d99 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
@@ -42,11 +42,12 @@ import org.eclipse.swt.graphics.Rectangle;
public class ControlFlowPresentationProvider extends TimeGraphPresentationProvider {
private enum State {
- UNKNOWN (new RGB(100, 100, 100)),
- WAIT (new RGB(200, 200, 0)),
- USERMODE (new RGB(0, 200, 0)),
- SYSCALL (new RGB(0, 0, 200)),
- INTERRUPTED (new RGB(200, 100, 100));
+ UNKNOWN (new RGB(100, 100, 100)),
+ WAIT_BLOCKED (new RGB(200, 200, 0)),
+ WAIT_FOR_CPU (new RGB(200, 100, 0)),
+ USERMODE (new RGB( 0, 200, 0)),
+ SYSCALL (new RGB( 0, 0, 200)),
+ INTERRUPTED (new RGB(200, 0, 100));
public final RGB rgb;
@@ -74,15 +75,7 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
public int getStateTableIndex(ITimeEvent event) {
if (event instanceof ControlFlowEvent) {
int status = ((ControlFlowEvent) event).getStatus();
- if (status == StateValues.PROCESS_STATUS_WAIT) {
- return State.WAIT.ordinal();
- } else if (status == StateValues.PROCESS_STATUS_RUN_USERMODE) {
- return State.USERMODE.ordinal();
- } else if (status == StateValues.PROCESS_STATUS_RUN_SYSCALL) {
- return State.SYSCALL.ordinal();
- } else if (status == StateValues.PROCESS_STATUS_INTERRUPTED) {
- return State.INTERRUPTED.ordinal();
- }
+ return getMatchingState(status).ordinal();
}
return State.UNKNOWN.ordinal();
}
@@ -91,19 +84,28 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
public String getEventName(ITimeEvent event) {
if (event instanceof ControlFlowEvent) {
int status = ((ControlFlowEvent) event).getStatus();
- if (status == StateValues.PROCESS_STATUS_WAIT) {
- return State.WAIT.toString();
- } else if (status == StateValues.PROCESS_STATUS_RUN_USERMODE) {
- return State.USERMODE.toString();
- } else if (status == StateValues.PROCESS_STATUS_RUN_SYSCALL) {
- return State.SYSCALL.toString();
- } else if (status == StateValues.PROCESS_STATUS_INTERRUPTED) {
- return State.INTERRUPTED.toString();
- }
+ return getMatchingState(status).toString();
}
return State.UNKNOWN.toString();
}
+ private static State getMatchingState(int status) {
+ switch (status) {
+ case StateValues.PROCESS_STATUS_WAIT_BLOCKED:
+ return State.WAIT_BLOCKED;
+ case StateValues.PROCESS_STATUS_WAIT_FOR_CPU:
+ return State.WAIT_FOR_CPU;
+ case StateValues.PROCESS_STATUS_RUN_USERMODE:
+ return State.USERMODE;
+ case StateValues.PROCESS_STATUS_RUN_SYSCALL:
+ return State.SYSCALL;
+ case StateValues.PROCESS_STATUS_INTERRUPTED:
+ return State.INTERRUPTED;
+ default:
+ return State.UNKNOWN;
+ }
+ }
+
@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {
Map<String, String> retMap = new LinkedHashMap<String, String>();
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java
index 189ab2f..4182a68 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java
@@ -57,9 +57,9 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider
IDLE (new RGB(200, 200, 200)),
USERMODE (new RGB(0, 200, 0)),
SYSCALL (new RGB(0, 0, 200)),
- IRQ (new RGB(200, 100, 100)),
+ IRQ (new RGB(200, 0, 100)),
SOFT_IRQ (new RGB(200, 150, 100)),
- IRQ_ACTIVE (new RGB(200, 100, 100)),
+ IRQ_ACTIVE (new RGB(200, 0, 100)),
SOFT_IRQ_RAISED (new RGB(200, 200, 0)),
SOFT_IRQ_ACTIVE (new RGB(200, 150, 100));