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.kernelanalysis.StateValues; | |
16 | import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout; | |
17 | import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; | |
18 | import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; | |
19 | import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; | |
20 | import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; | |
21 | ||
22 | /** | |
23 | * Raise a soft irq event | |
24 | */ | |
25 | public class SoftIrqRaiseHandler extends KernelEventHandler { | |
26 | ||
27 | /** | |
28 | * Constructor | |
19ed6598 MK |
29 | * |
30 | * @param layout | |
31 | * event layout | |
c8f45ad2 MK |
32 | */ |
33 | public SoftIrqRaiseHandler(IKernelAnalysisEventLayout layout) { | |
34 | super(layout); | |
35 | } | |
36 | ||
37 | @Override | |
38 | public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { | |
39 | Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue(); | |
19ed6598 MK |
40 | Integer cpu = KernelEventHandlerUtils.getCpu(event); |
41 | if (cpu == null) { | |
42 | return; | |
43 | } | |
c8f45ad2 MK |
44 | /* |
45 | * Mark this SoftIRQ as *raised* in the resource tree. State value = -2 | |
46 | */ | |
19ed6598 | 47 | int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString()); |
c8f45ad2 MK |
48 | ITmfStateValue value = StateValues.SOFT_IRQ_RAISED_VALUE; |
49 | ss.modifyAttribute(KernelEventHandlerUtils.getTimestamp(event), value, quark); | |
50 | } | |
51 | } |