Skip to content

Commit 930247c

Browse files
linux.core: : Add IRQ handlers instead of generic IRQs
Currently, the Resources view only shows IRQs as a single entity. This makes it harder to distinguish which handler is actually running, especially in cases where multiple IRQ handlers are mapped to the same lane. This change updates the view to display IRQ handlers instead of just the IRQ, providing finer granularity and improving readability when a single lane contains multiple handlers. Benefits: * Clearer visualization of interrupt activity. * Easier to identify which handler is active at a given time. * Better distinction when multiple handlers share one IRQ lane. [Added] Add handlers to IRQs in resources views Change-Id: I131790ec6dad3b28328abea0c5d84b280a7b196e Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
1 parent df23f23 commit 930247c

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/kernel/handlers/IrqEntryHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
4545
return;
4646
}
4747
Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
48-
48+
String name = event.getContent().getField(getLayout().fieldName()).getValue().toString();
4949
/*
5050
* Mark this IRQ as active in the resource tree. The state value = the
5151
* CPU on which this IRQ is sitting
5252
*/
53-
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
53+
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString()+"/"+name);
5454

5555
long timestamp = KernelEventHandlerUtils.getTimestamp(event);
5656
ss.modifyAttribute(timestamp, cpu.intValue(), quark);
@@ -64,7 +64,7 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
6464
ss.modifyAttribute(timestamp, StateValues.CPU_STATUS_IRQ_VALUE.unboxValue(), quark);
6565

6666
/* Update the aggregate IRQ entry to set it to this CPU */
67-
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString());
67+
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString()+"/"+name);
6868
ss.modifyAttribute(timestamp, cpu, aggregateQuark);
6969
}
7070

analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/kernel/handlers/IrqExitHandler.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
1616

17+
import java.util.List;
18+
1719
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
1820
import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
1921
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
@@ -43,8 +45,18 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
4345
}
4446
int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
4547
Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
48+
List<Integer> subAttrs = ss.getSubAttributes(KernelEventHandlerUtils.getNodeIRQs(cpu, ss),false);
49+
String irqPrefix = irqId.toString()+"/"; //$NON-NLS-1$
50+
List<Integer> quarks = subAttrs.stream().filter(iquark -> ss.getAttributeName(iquark).startsWith(irqPrefix)).toList();
51+
int quark =-1;
52+
for (int quarkCandidate : quarks) {
53+
if (ss.queryOngoing(quarkCandidate) != null) {
54+
quark = quarkCandidate;
55+
break;
56+
}
57+
}
58+
String name = ss.getAttributeName(quark);
4659
/* Put this IRQ back to inactive in the resource tree */
47-
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
4860
long timestamp = KernelEventHandlerUtils.getTimestamp(event);
4961
ss.modifyAttribute(timestamp, (Object) null, quark);
5062

@@ -55,7 +67,7 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
5567
KernelEventHandlerUtils.updateCpuStatus(timestamp, cpu, ss);
5668

5769
/* Update the aggregate IRQ entry to set it to this CPU */
58-
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString());
70+
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, name);
5971
/* Update the aggregate IRQ entry to set it to a running CPU */
6072
Integer prevCpu = KernelEventHandlerUtils.getCpuForIrq(ss, irqId);
6173
ss.modifyAttribute(timestamp, prevCpu, aggregateQuark);

analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/resourcesstatus/ResourcesStatusDataProvider.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,12 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
313313
ResourcesEntryModel cpuEntry, List<Integer> irqQuarks, Type type, List<ResourcesEntryModel> builder) {
314314
for (Integer irqQuark : irqQuarks) {
315315
String resourceName = ssq.getAttributeName(irqQuark);
316-
int resourceId = Integer.parseInt(resourceName);
316+
String[] resourceNames = resourceName.split("/"); //$NON-NLS-1$
317+
int resourceId = Integer.parseInt(resourceNames[0]);
317318
long irqId = getId(irqQuark);
318319

319320
builder.add(new ResourcesEntryModel(irqId, cpuEntry.getId(),
320-
computeEntryName(type, resourceId), startTime, endTime, resourceId, type));
321+
computeEntryName(type, resourceName), startTime, endTime, resourceId, type));
321322

322323
fEntryModelTypes.put(irqQuark, type);
323324

@@ -333,7 +334,7 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
333334
long aggregateId = getId(aggregateQuark);
334335
if (!Iterables.any(builder, entry -> entry.getId() == aggregateId)) {
335336
builder.add(new ResourcesEntryModel(aggregateId, cpuEntry.getParentId(),
336-
computeEntryName(type, resourceId),
337+
computeEntryName(type, resourceName),
337338
startTime, endTime, resourceId, type));
338339
}
339340
fEntryModelTypes.put(aggregateQuark, type);
@@ -350,9 +351,9 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
350351
}
351352
}
352353

353-
private static @NonNull List<@NonNull String> computeEntryName(Type type, int id) {
354+
private static @NonNull List<@NonNull String> computeEntryName(Type type, Object id) {
354355
if (type == Type.SOFT_IRQ) {
355-
return Collections.singletonList(type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(id));
356+
return Collections.singletonList(type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(Integer.parseInt((String) id)));
356357
} else if (type == Type.CURRENT_THREAD) {
357358
String threadEntryName = NLS.bind(Messages.ThreadEntry, id);
358359
if (threadEntryName != null) {

0 commit comments

Comments
 (0)