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
.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
.statesystem
.core
.statevalue
.TmfStateValue
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEventField
;
27 public class PiSetprioHandler
extends KernelEventHandler
{
31 * @param layout event layout
33 public PiSetprioHandler(IKernelAnalysisEventLayout layout
) {
38 public void handleEvent(ITmfStateSystemBuilder ss
, ITmfEvent event
) throws AttributeNotFoundException
{
39 ITmfEventField content
= event
.getContent();
40 Integer tid
= ((Long
) content
.getField(getLayout().fieldTid()).getValue()).intValue();
41 Integer prio
= ((Long
) content
.getField(getLayout().fieldNewPrio()).getValue()).intValue();
43 Integer updateThreadNode
= ss
.getQuarkRelativeAndAdd(KernelEventHandlerUtils
.getNodeThreads(ss
), tid
.toString());
45 /* Set the current prio for the new process */
46 int quark
= ss
.getQuarkRelativeAndAdd(updateThreadNode
, Attributes
.PRIO
);
47 ITmfStateValue value
= TmfStateValue
.newValueInt(prio
);
48 ss
.modifyAttribute(KernelEventHandlerUtils
.getTimestamp(event
), value
, quark
);