analysis: Split up KernelStateProvider
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / kernel / handlers / ProcessFreeHandler.java
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.trace.IKernelAnalysisEventLayout;
16 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
17 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
18 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
19
20 /**
21 * Process free event handler
22 */
23 public class ProcessFreeHandler extends KernelEventHandler {
24
25 /**
26 * Constructor
27 *
28 * @param layout
29 * event layout
30 */
31 public ProcessFreeHandler(IKernelAnalysisEventLayout layout) {
32 super(layout);
33 }
34
35 @Override
36 public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
37
38 Integer tid = ((Long) event.getContent().getField(getLayout().fieldTid()).getValue()).intValue();
39 /*
40 * Remove the process and all its sub-attributes from the current state
41 */
42 int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), tid.toString());
43 ss.removeAttribute(KernelEventHandlerUtils.getTimestamp(event), quark);
44 }
45 }
This page took 0.052333 seconds and 6 git commands to generate.