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
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.kernel
.handlers
;
15 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
16 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystemBuilder
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.AttributeNotFoundException
;
18 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.TmfStateValue
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
24 public class IrqExitHandler
extends KernelEventHandler
{
32 public IrqExitHandler(IKernelAnalysisEventLayout layout
) {
37 public void handleEvent(ITmfStateSystemBuilder ss
, ITmfEvent event
) throws AttributeNotFoundException
{
38 Integer cpu
= KernelEventHandlerUtils
.getCpu(event
);
42 int currentThreadNode
= KernelEventHandlerUtils
.getCurrentThreadNode(cpu
, ss
);
43 Integer irqId
= ((Long
) event
.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
44 /* Put this IRQ back to inactive in the resource tree */
45 int quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeIRQs(cpu
, ss
), irqId
.toString());
46 TmfStateValue value
= TmfStateValue
.nullValue();
47 long timestamp
= KernelEventHandlerUtils
.getTimestamp(event
);
48 ss
.modifyAttribute(timestamp
, value
, quark
);
50 /* Set the previous process back to running */
51 KernelEventHandlerUtils
.setProcessToRunning(timestamp
, currentThreadNode
, ss
);
53 /* Set the CPU status back to running or "idle" */
54 KernelEventHandlerUtils
.cpuExitInterrupt(timestamp
, cpu
, ss
);