Commit | Line | Data |
---|---|---|
c8f45ad2 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers; | |
14 | ||
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; | |
20 | ||
21 | /** | |
22 | * Irq Exit handler | |
23 | */ | |
24 | public class IrqExitHandler extends KernelEventHandler { | |
25 | ||
26 | /** | |
27 | * Constructor | |
28 | * | |
29 | * @param layout | |
30 | * event layout | |
31 | */ | |
32 | public IrqExitHandler(IKernelAnalysisEventLayout layout) { | |
33 | super(layout); | |
34 | } | |
35 | ||
36 | @Override | |
37 | public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { | |
38 | Integer cpu = KernelEventHandlerUtils.getCpu(event); | |
19ed6598 | 39 | if (cpu == null) { |
c8f45ad2 MK |
40 | return; |
41 | } | |
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 */ | |
19ed6598 | 45 | int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString()); |
c8f45ad2 MK |
46 | TmfStateValue value = TmfStateValue.nullValue(); |
47 | long timestamp = KernelEventHandlerUtils.getTimestamp(event); | |
48 | ss.modifyAttribute(timestamp, value, quark); | |
49 | ||
50 | /* Set the previous process back to running */ | |
51 | KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss); | |
52 | ||
53 | /* Set the CPU status back to running or "idle" */ | |
54 | KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss); | |
55 | } | |
56 | } |