1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Matthew Khouzam - Initial API and implementation
11 *******************************************************************************/
13 package org
.lttng
.scope
.lttng
.kernel
.core
.analysis
.os
.handlers
.internal
;
15 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
16 import org
.lttng
.scope
.lttng
.kernel
.core
.trace
.layout
.ILttngKernelEventLayout
;
18 import ca
.polymtl
.dorsal
.libdelorean
.ITmfStateSystemBuilder
;
19 import ca
.polymtl
.dorsal
.libdelorean
.exceptions
.AttributeNotFoundException
;
20 import ca
.polymtl
.dorsal
.libdelorean
.statevalue
.TmfStateValue
;
25 public class IrqExitHandler
extends KernelEventHandler
{
33 public IrqExitHandler(ILttngKernelEventLayout layout
) {
38 public void handleEvent(ITmfStateSystemBuilder ss
, ITmfEvent event
) throws AttributeNotFoundException
{
39 Integer cpu
= KernelEventHandlerUtils
.getCpu(event
);
43 int currentThreadNode
= KernelEventHandlerUtils
.getCurrentThreadNode(cpu
, ss
);
44 Integer irqId
= ((Long
) event
.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
45 /* Put this IRQ back to inactive in the resource tree */
46 int quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeIRQs(cpu
, ss
), irqId
.toString());
47 TmfStateValue value
= TmfStateValue
.nullValue();
48 long timestamp
= KernelEventHandlerUtils
.getTimestamp(event
);
49 ss
.modifyAttribute(timestamp
, value
, quark
);
51 /* Set the previous process back to running */
52 KernelEventHandlerUtils
.setProcessToRunning(timestamp
, currentThreadNode
, ss
);
54 /* Set the CPU status back to running or "idle" */
55 KernelEventHandlerUtils
.cpuExitInterrupt(timestamp
, cpu
, ss
);