os.linux: remove unnecessary calls to getQuarkRelative
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / kernel / handlers / IPIEntryHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2016 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
10 package org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.handlers;
11
12 import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
13 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
14 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
15 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
16 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
17 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
18 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
19
20 /**
21 * IPI Entry Handler
22 *
23 * @author Matthew Khouzam
24 */
25 public class IPIEntryHandler extends KernelEventHandler {
26
27 /**
28 * Constructor
29 *
30 * @param layout
31 * event layout
32 */
33 public IPIEntryHandler(IKernelAnalysisEventLayout layout) {
34 super(layout);
35 }
36
37 @Override
38 public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
39
40 Integer cpu = KernelEventHandlerUtils.getCpu(event);
41 if (cpu == null) {
42 return;
43 }
44 Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIPIVector()).getValue()).intValue();
45
46 /*
47 * Mark this IRQ as active in the resource tree. The state value = the
48 * CPU on which this IRQ is sitting
49 */
50 int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
51
52 ITmfStateValue value = TmfStateValue.newValueInt(cpu.intValue());
53 long timestamp = KernelEventHandlerUtils.getTimestamp(event);
54 ss.modifyAttribute(timestamp, value, quark);
55
56 /* Change the status of the running process to interrupted */
57 quark = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
58 value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
59 ss.modifyAttribute(timestamp, value, quark);
60
61 /* Change the status of the CPU to interrupted */
62 quark = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
63 value = StateValues.CPU_STATUS_IRQ_VALUE;
64 ss.modifyAttribute(timestamp, value, quark);
65 }
66
67 }
This page took 0.03327 seconds and 5 git commands to generate.