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
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
17 import org
.lttng
.scope
.lttng
.kernel
.core
.analysis
.os
.StateValues
;
18 import org
.lttng
.scope
.lttng
.kernel
.core
.trace
.layout
.ILttngKernelEventLayout
;
20 import ca
.polymtl
.dorsal
.libdelorean
.ITmfStateSystemBuilder
;
21 import ca
.polymtl
.dorsal
.libdelorean
.exceptions
.AttributeNotFoundException
;
22 import ca
.polymtl
.dorsal
.libdelorean
.statevalue
.ITmfStateValue
;
25 * Raise a soft irq event
27 public class SoftIrqRaiseHandler
extends KernelEventHandler
{
35 public SoftIrqRaiseHandler(ILttngKernelEventLayout layout
) {
40 public void handleEvent(ITmfStateSystemBuilder ss
, ITmfEvent event
) throws AttributeNotFoundException
{
41 Integer softIrqId
= ((Long
) event
.getContent().getField(getLayout().fieldVec()).getValue()).intValue();
42 Integer cpu
= KernelEventHandlerUtils
.getCpu(event
);
47 * Mark this SoftIRQ as *raised* in the resource tree.
49 int quark
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeSoftIRQs(cpu
, ss
), softIrqId
.toString());
51 ITmfStateValue value
= (isInSoftirq(ss
.queryOngoingState(quark
)) ?
52 StateValues
.SOFT_IRQ_RAISED_RUNNING_VALUE
:
53 StateValues
.SOFT_IRQ_RAISED_VALUE
);
54 ss
.modifyAttribute(KernelEventHandlerUtils
.getTimestamp(event
), value
, quark
);
58 private static boolean isInSoftirq(@Nullable ITmfStateValue state
) {
59 return (state
!= null &&
61 (state
.unboxInt() & StateValues
.CPU_STATUS_SOFTIRQ
) == StateValues
.CPU_STATUS_SOFTIRQ
);