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
.kernel
.Attributes
;
16 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernel
.StateValues
;
17 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
18 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystemBuilder
;
19 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.AttributeNotFoundException
;
20 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.ITmfStateValue
;
21 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.TmfStateValue
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
27 public class IrqEntryHandler
extends KernelEventHandler
{
35 public IrqEntryHandler(IKernelAnalysisEventLayout 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. The state value = the
50 * CPU on which this IRQ is sitting
52 int quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeIRQs(cpu
, ss
), irqId
.toString());
54 ITmfStateValue value
= TmfStateValue
.newValueInt(cpu
.intValue());
55 long timestamp
= KernelEventHandlerUtils
.getTimestamp(event
);
56 ss
.modifyAttribute(timestamp
, value
, quark
);
58 /* Change the status of the running process to interrupted */
59 quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getCurrentThreadNode(cpu
, ss
), Attributes
.STATUS
);
60 value
= StateValues
.PROCESS_STATUS_INTERRUPTED_VALUE
;
61 ss
.modifyAttribute(timestamp
, value
, quark
);
63 /* Change the status of the CPU to interrupted */
64 quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getCurrentCPUNode(cpu
, ss
), Attributes
.STATUS
);
65 value
= StateValues
.CPU_STATUS_IRQ_VALUE
;
66 ss
.modifyAttribute(timestamp
, value
, quark
);