Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2012-05-01 22:05:50 +0000
committerAlexandre Montplaisir2012-05-02 03:33:28 +0000
commit3aa4f02695b52fc4e0bfe7254176171d77d11754 (patch)
treed501383c8317f949ae35d3efd54d9242e6eb932d /lttng/org.eclipse.linuxtools.lttng2.kernel.core
parent4a21942cca26aa457c8e4af5cabba48ea1331f7e (diff)
downloadorg.eclipse.linuxtools-3aa4f02695b52fc4e0bfe7254176171d77d11754.tar.gz
org.eclipse.linuxtools-3aa4f02695b52fc4e0bfe7254176171d77d11754.tar.xz
org.eclipse.linuxtools-3aa4f02695b52fc4e0bfe7254176171d77d11754.zip
lttng: Rework the IRQ event handler
Implement the softIrq handlers. Drop the IRQ_stack sub-tree, put the IRQ stuff under Resources/IRQs and Resources/Soft_IRQs. This matches more closely what is needed by the Resource view. Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Diffstat (limited to 'lttng/org.eclipse.linuxtools.lttng2.kernel.core')
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java90
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngStrings.java2
3 files changed, 67 insertions, 35 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java
index fb74982003..90b792b563 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/CtfKernelHandler.java
@@ -53,6 +53,8 @@ class CtfKernelHandler implements Runnable {
/* Common locations in the attribute tree */
private int cpusNode = -1;
private int threadsNode = -1;
+ private int irqsNode = -1;
+ private int softIrqsNode = -1;
CtfKernelHandler(BlockingQueue<CtfTmfEvent> eventsQueue) {
assert (eventsQueue != null);
@@ -136,8 +138,7 @@ class CtfKernelHandler implements Runnable {
try {
/*
* Feed event to the history system if it's known to cause a state
- * transition See:
- * https://projectwiki.dorsal.polymtl.ca/index.php/State_transitions
+ * transition.
*/
switch (getEventIndex(eventName)) {
@@ -164,14 +165,15 @@ class CtfKernelHandler implements Runnable {
{
Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
- /* Push the IRQ to the CPU's IRQ_stack */
- quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.IRQ_STACK);
- value = TmfStateValue.newValueInt(irqId);
- ss.pushAttribute(ts, value, quark);
+ /* Mark this IRQ as active in the resource tree.
+ * The state value = the CPU on which this IRQ is sitting */
+ quark = ss.getQuarkRelativeAndAdd(irqsNode, irqId.toString());
+ value = TmfStateValue.newValueInt(event.getCPU());
+ ss.modifyAttribute(ts, value, quark);
/* Change the status of the running process to interrupted */
quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
- value = TmfStateValue.newValueInt(Attributes.STATUS_WAIT_CPU);
+ value = TmfStateValue.newValueInt(Attributes.STATUS_INTERRUPTED);
ss.modifyAttribute(ts, value, quark);
}
break;
@@ -179,46 +181,66 @@ class CtfKernelHandler implements Runnable {
case 3: // "irq_handler_exit":
/* Fields: int32 irq, int32 ret */
{
- int stackDepth = 0;
+ Integer irqId = ((Long) content.getField(LttngStrings.IRQ).getValue()).intValue();
- /* Pop the IRQ from the CPU's IRQ_stack */
- quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.IRQ_STACK);
- try {
- ss.popAttribute(ts, quark);
- } catch (AttributeNotFoundException e1) {
- System.err.print(event.getTimestamp()
- + " Popping empty attribute: " + e1.getMessage()); //$NON-NLS-1$
- }
+ /* Put this IRQ back to inactive in the resource tree */
+ quark = ss.getQuarkRelativeAndAdd(irqsNode, irqId.toString());
+ value = TmfStateValue.nullValue();
+ ss.modifyAttribute(ts, value, quark);
- /*
- * If this was the last IRQ on the stack, set the process back
- * to running
- */
- /* 'quark' should still be valid */
- try {
- stackDepth = ss.queryOngoingState(quark).unboxInt();
- } catch (StateValueTypeException e) {
- /* IRQ_stack SHOULD be of int type, this shouldn't happen */
- e.printStackTrace();
- }
- if (stackDepth == 0) {
- quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
- value = TmfStateValue.newValueInt(Attributes.STATUS_RUN);
- ss.modifyAttribute(ts, value, quark);
- }
+ /* Set the previous process back to running */
+ quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+ value = TmfStateValue.newValueInt(Attributes.STATUS_RUN);
+ ss.modifyAttribute(ts, value, quark);
}
break;
case 4: // "softirq_entry":
/* Fields: int32 vec */
+ {
+ Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+ /* Mark this SoftIRQ as active in the resource tree.
+ * The state value = the CPU on which this SoftIRQ is processed */
+ quark = ss.getQuarkRelativeAndAdd(softIrqsNode, softIrqId.toString());
+ value = TmfStateValue.newValueInt(event.getCPU());
+ ss.modifyAttribute(ts, value, quark);
+
+ /* Change the status of the running process to interrupted */
+ quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+ value = TmfStateValue.newValueInt(Attributes.STATUS_INTERRUPTED);
+ ss.modifyAttribute(ts, value, quark);
+ }
break;
case 5: // "softirq_exit":
/* Fields: int32 vec */
+ {
+ Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+ /* Put this SoftIRQ back to inactive (= -1) in the resource tree */
+ quark = ss.getQuarkRelativeAndAdd(softIrqsNode, softIrqId.toString());
+ value = TmfStateValue.nullValue();
+ ss.modifyAttribute(ts, value, quark);
+
+ /* Set the previous process back to running */
+ quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.STATUS);
+ value = TmfStateValue.newValueInt(Attributes.STATUS_RUN);
+ ss.modifyAttribute(ts, value, quark);
+ }
break;
case 6: // "softirq_raise":
- /* Fields: int32 vec */
+ /* Fields: int32 vec */
+ {
+ Integer softIrqId = ((Long) content.getField(LttngStrings.VEC).getValue()).intValue();
+
+ /* Mark this SoftIRQ as *raised* in the resource tree.
+ * State value = -2 */
+ quark = ss.getQuarkRelativeAndAdd(softIrqsNode, softIrqId.toString());
+ value = TmfStateValue.newValueInt(-2);
+ ss.modifyAttribute(ts, value, quark);
+ }
break;
case 7: // "sched_switch":
@@ -405,6 +427,8 @@ class CtfKernelHandler implements Runnable {
private void setupCommonLocations() {
cpusNode = ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
threadsNode = ss.getQuarkAbsoluteAndAdd(Attributes.THREADS);
+ irqsNode = ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.IRQS);
+ softIrqsNode = ss.getQuarkAbsoluteAndAdd(Attributes.RESOURCES, Attributes.SOFT_IRQS);
}
private static HashMap<String, Integer> fillEventNames() {
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java
index 4b62fac841..5f01a74463 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/Attributes.java
@@ -30,9 +30,9 @@ public abstract class Attributes {
/* First-level attributes */
public static final String CPUS = "CPUs";
public static final String THREADS = "Threads";
+ public static final String RESOURCES = "Resources";
/* Sub-attributes of the CPU nodes */
- public static final String IRQ_STACK = "IRQ_stack";
public static final String CURRENT_THREAD = "Current_thread";
/* Sub-attributes of the Thread nodes */
@@ -41,6 +41,10 @@ public abstract class Attributes {
public static final String EXEC_NAME = "Exec_name";
public static final String EXEC_MODE_STACK = "Exec_mode_stack";
+ /* Attributes under "Resources" */
+ public static final String IRQS = "IRQs";
+ public static final String SOFT_IRQS = "Soft_IRQs";
+
/*
* Statistics sub-nodes
* (Written all out, because "Stats" is easy to confuse with "Status")
@@ -51,6 +55,10 @@ public abstract class Attributes {
/* Process status (note these are *values*, not attribute names */
public static final int STATUS_WAIT_CPU = 1;
public static final int STATUS_RUN = 2;
+ public static final int STATUS_INTERRUPTED = 3;
+
+ /* SoftIRQ-specific stuff. -1: null/disabled, >= 0: running on that CPU */
+ public static final int SOFT_IRQ_RAISED = -2;
/* Misc stuff */
public static final String UNKNOWN = "Unknown";
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngStrings.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngStrings.java
index 68afb8e234..1dd37d2229 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngStrings.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngStrings.java
@@ -41,11 +41,11 @@ public abstract class LttngStrings {
public static final String SYSCALL_PREFIX = "sys_";
public static final String COMPAT_SYSCALL_PREFIX = "compat_sys_";
-
/* Field names */
public static final String IRQ = "irq";
public static final String COMM = "comm";
public static final String TID = "tid";
+ public static final String VEC = "vec";
public static final String PREV_COMM = "prev_comm";
public static final String PREV_TID = "prev_tid";
public static final String PREV_STATE = "prev_state";

Back to the top