linux.core: Support IPIs in kernel analysis (Bug 498215)
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / kernel / handlers / IPIExitHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2016 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
10 package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
11
12 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
13 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
14 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
15 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
16 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
17
18 /**
19 * IPI Exit Handler
20 *
21 * @author Matthew Khouzam
22 */
23 public class IPIExitHandler extends KernelEventHandler {
24
25 /**
26 * Constructor
27 *
28 * @param layout
29 * event layout
30 */
31 public IPIExitHandler(IKernelAnalysisEventLayout layout) {
32 super(layout);
33 }
34
35 @Override
36 public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
37 Integer cpu = KernelEventHandlerUtils.getCpu(event);
38 if (cpu == null) {
39 return;
40 }
41 int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
42 Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIPIVector()).getValue()).intValue();
43 /* Put this IRQ back to inactive in the resource tree */
44 int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
45 TmfStateValue value = TmfStateValue.nullValue();
46 long timestamp = KernelEventHandlerUtils.getTimestamp(event);
47 ss.modifyAttribute(timestamp, value, quark);
48
49 /* Set the previous process back to running */
50 KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss);
51
52 /* Set the CPU status back to running or "idle" */
53 KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss);
54 }
55 }
This page took 0.031197 seconds and 5 git commands to generate.