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
.analysis
.os
.StateValues
;
17 import org
.lttng
.scope
.lttng
.kernel
.core
.trace
.layout
.ILttngKernelEventLayout
;
19 import ca
.polymtl
.dorsal
.libdelorean
.ITmfStateSystemBuilder
;
20 import ca
.polymtl
.dorsal
.libdelorean
.exceptions
.AttributeNotFoundException
;
21 import ca
.polymtl
.dorsal
.libdelorean
.statevalue
.ITmfStateValue
;
22 import ca
.polymtl
.dorsal
.libdelorean
.statevalue
.TmfStateValue
;
27 public class IrqEntryHandler
extends KernelEventHandler
{
35 public IrqEntryHandler(ILttngKernelEventLayout layout
) {
40 public void handleEvent(ITmfStateSystemBuilder ss
, ITmfEvent event
) throws AttributeNotFoundException
{
42 Integer cpu
= KernelEventHandlerUtils
.getCpu(event
);
46 Integer irqId
= ((Long
) event
.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
49 * Mark this IRQ as active in the resource tree.
51 int quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeIRQs(cpu
, ss
), irqId
.toString());
53 ITmfStateValue value
= TmfStateValue
.newValueInt(StateValues
.CPU_STATUS_IRQ
);
54 long timestamp
= KernelEventHandlerUtils
.getTimestamp(event
);
55 ss
.modifyAttribute(timestamp
, value
, quark
);
57 /* Change the status of the running process to interrupted */
58 quark
= KernelEventHandlerUtils
.getCurrentThreadNode(cpu
, ss
);
59 value
= StateValues
.PROCESS_STATUS_INTERRUPTED_VALUE
;
60 ss
.modifyAttribute(timestamp
, value
, quark
);
62 /* Change the status of the CPU to interrupted */
63 quark
= KernelEventHandlerUtils
.getCurrentCPUNode(cpu
, ss
);
64 value
= StateValues
.CPU_STATUS_IRQ_VALUE
;
65 ss
.modifyAttribute(timestamp
, value
, quark
);