5f550526bf777481dbdd46e4eed58d5266338ea8
[deliverable/tracecompass.git] / lttng / org.lttng.scope.lttng.kernel.core / src / org / lttng / scope / lttng / kernel / core / analysis / os / handlers / internal / IrqExitHandler.java
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.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
14
15 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
16 import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
17
18 import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
19 import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
20 import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
21
22 /**
23 * Irq Exit handler
24 */
25 public class IrqExitHandler extends KernelEventHandler {
26
27 /**
28 * Constructor
29 *
30 * @param layout
31 * event layout
32 */
33 public IrqExitHandler(ILttngKernelEventLayout layout) {
34 super(layout);
35 }
36
37 @Override
38 public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
39 Integer cpu = KernelEventHandlerUtils.getCpu(event);
40 if (cpu == null) {
41 return;
42 }
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);
50
51 /* Set the previous process back to running */
52 KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss);
53
54 /* Set the CPU status back to running or "idle" */
55 KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss);
56 }
57 }
This page took 0.031878 seconds and 4 git commands to generate.