Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class KernelStateProvider extends AbstractTmfStateProvider {
* Version number of this state provider. Please bump this if you modify the
* contents of the generated state history in some way.
*/
private static final int VERSION = 30;
private static final int VERSION = 31;

// ------------------------------------------------------------------------
// Fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
return;
}
Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();

String name = event.getContent().getField(getLayout().fieldName()).getValue().toString();
/*
* Mark this IRQ as active in the resource tree. The state value = the
* CPU on which this IRQ is sitting
*/
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString() + "/" + name); //$NON-NLS-1$

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

/* Update the aggregate IRQ entry to set it to this CPU */
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString());
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString() + "/" + name); //$NON-NLS-1$
ss.modifyAttribute(timestamp, cpu, aggregateQuark);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@

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

import java.util.List;

import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
Expand Down Expand Up @@ -43,8 +46,18 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
}
int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
List<Integer> subAttrs = ss.getSubAttributes(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), false);
String irqPrefix = irqId.toString() + "/"; //$NON-NLS-1$
List<Integer> quarks = subAttrs.stream().filter(iquark -> ss.getAttributeName(iquark).startsWith(irqPrefix)).toList();
int quark = ITmfStateSystem.INVALID_ATTRIBUTE;
for (int quarkCandidate : quarks) {
if (ss.queryOngoing(quarkCandidate) != null) {
quark = quarkCandidate;
break;
}
}
String name = ss.getAttributeName(quark);
/* Put this IRQ back to inactive in the resource tree */
int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
long timestamp = KernelEventHandlerUtils.getTimestamp(event);
ss.modifyAttribute(timestamp, (Object) null, quark);

Expand All @@ -55,7 +68,7 @@ public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws Attri
KernelEventHandlerUtils.updateCpuStatus(timestamp, cpu, ss);

/* Update the aggregate IRQ entry to set it to this CPU */
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, irqId.toString());
int aggregateQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS, name);
/* Update the aggregate IRQ entry to set it to a running CPU */
Integer prevCpu = KernelEventHandlerUtils.getCpuForIrq(ss, irqId);
ss.modifyAttribute(timestamp, prevCpu, aggregateQuark);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,12 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
ResourcesEntryModel cpuEntry, List<Integer> irqQuarks, Type type, List<ResourcesEntryModel> builder) {
for (Integer irqQuark : irqQuarks) {
String resourceName = ssq.getAttributeName(irqQuark);
int resourceId = Integer.parseInt(resourceName);
String[] resourceNames = resourceName.split("/"); //$NON-NLS-1$
int resourceId = Integer.parseInt(resourceNames[0]);
long irqId = getId(irqQuark);

builder.add(new ResourcesEntryModel(irqId, cpuEntry.getId(),
computeEntryName(type, resourceId), startTime, endTime, resourceId, type));
computeEntryName(type, resourceName), startTime, endTime, resourceId, type));

fEntryModelTypes.put(irqQuark, type);

Expand All @@ -337,7 +338,7 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
long aggregateId = getId(aggregateQuark);
if (!Iterables.any(builder, entry -> entry.getId() == aggregateId)) {
builder.add(new ResourcesEntryModel(aggregateId, cpuEntry.getParentId(),
computeEntryName(type, resourceId),
computeEntryName(type, resourceName),
startTime, endTime, resourceId, type));
}
fEntryModelTypes.put(aggregateQuark, type);
Expand All @@ -354,9 +355,9 @@ private void createInterrupt(final ITmfStateSystem ssq, long startTime, long end
}
}

private static @NonNull List<@NonNull String> computeEntryName(Type type, int id) {
private static @NonNull List<@NonNull String> computeEntryName(Type type, Object id) {
if (type == Type.SOFT_IRQ) {
return Collections.singletonList(type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(id));
return Collections.singletonList(type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(Integer.parseInt((String) id)));
} else if (type == Type.CURRENT_THREAD) {
String threadEntryName = NLS.bind(Messages.ThreadEntry, id);
if (threadEntryName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void testRangeQuery2() {
assertNotNull(ss);

try {
int quark = ss.getQuarkAbsolute(Attributes.CPUS, Integer.toString(0), Attributes.IRQS, "1");
int quark = ss.getQuarkAbsolute(Attributes.CPUS, Integer.toString(0), Attributes.IRQS, "1/i8042");
long ts1 = ss.getStartTime(); /* start of the trace */
long ts2 = startTime + 20L * NANOSECS_PER_SEC; /* invalid, but ignored */

Expand All @@ -176,7 +176,7 @@ public void testRangeQuery2() {
assertEquals(65, intervals.size());

} catch (AttributeNotFoundException | StateSystemDisposedException e) {
fail();
fail(e.toString());
}
}

Expand Down
Loading