X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng%2Forg.lttng.scope.lttng.kernel.core%2Fsrc%2Forg%2Flttng%2Fscope%2Flttng%2Fkernel%2Fcore%2Fanalysis%2Fos%2Fhandlers%2Finternal%2FIPIEntryHandler.java;fp=lttng%2Forg.lttng.scope.lttng.kernel.core%2Fsrc%2Forg%2Flttng%2Fscope%2Flttng%2Fkernel%2Fcore%2Fanalysis%2Fos%2Fhandlers%2Finternal%2FIPIEntryHandler.java;h=3e6506db1577fdf29ea6ba0f217fc7b59676c5d4;hb=451ba2f718a98a8e88f2591454b22e4da49837c5;hp=0000000000000000000000000000000000000000;hpb=4290d35808ef723be708b12aeda887a972c77c58;p=deliverable%2Ftracecompass.git diff --git a/lttng/org.lttng.scope.lttng.kernel.core/src/org/lttng/scope/lttng/kernel/core/analysis/os/handlers/internal/IPIEntryHandler.java b/lttng/org.lttng.scope.lttng.kernel.core/src/org/lttng/scope/lttng/kernel/core/analysis/os/handlers/internal/IPIEntryHandler.java new file mode 100644 index 0000000000..3e6506db15 --- /dev/null +++ b/lttng/org.lttng.scope.lttng.kernel.core/src/org/lttng/scope/lttng/kernel/core/analysis/os/handlers/internal/IPIEntryHandler.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2016 Ericsson + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ + +package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal; + +import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; +import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues; +import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout; + +import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder; +import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException; +import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue; +import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue; + +/** + * IPI Entry Handler + * + * @author Matthew Khouzam + */ +public class IPIEntryHandler extends KernelEventHandler { + + /** + * Constructor + * + * @param layout + * event layout + */ + public IPIEntryHandler(ILttngKernelEventLayout layout) { + super(layout); + } + + @Override + public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { + + Integer cpu = KernelEventHandlerUtils.getCpu(event); + if (cpu == null) { + return; + } + Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIPIVector()).getValue()).intValue(); + + /* + * 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()); + + ITmfStateValue value = TmfStateValue.newValueInt(cpu.intValue()); + long timestamp = KernelEventHandlerUtils.getTimestamp(event); + ss.modifyAttribute(timestamp, value, quark); + + /* Change the status of the running process to interrupted */ + quark = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss); + value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE; + ss.modifyAttribute(timestamp, value, quark); + + /* Change the status of the CPU to interrupted */ + quark = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss); + value = StateValues.CPU_STATUS_IRQ_VALUE; + ss.modifyAttribute(timestamp, value, quark); + } + +}