1 /*******************************************************************************
2 * Copyright (c) 2015 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.handlers
;
12 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.nullToEmptyString
;
14 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.model
.HostThread
;
15 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
16 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.building
.LttngKernelExecGraphProvider
;
17 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.building
.LttngKernelExecGraphProvider
.ProcessStatus
;
18 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.model
.EventField
;
19 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.model
.LttngSystemModel
;
20 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.model
.LttngWorker
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
24 * Handles the LTTng statedump events necessary for the initialization of the
27 * @author Francis Giraldeau
29 public class TraceEventHandlerStatedump
extends BaseHandler
{
35 * The parent graph provider
37 public TraceEventHandlerStatedump(LttngKernelExecGraphProvider provider
) {
42 public void handleEvent(ITmfEvent event
) {
43 IKernelAnalysisEventLayout eventLayout
= getProvider().getEventLayout(event
.getTrace());
44 LttngSystemModel system
= getProvider().getSystem();
45 String eventName
= event
.getName();
46 if (!eventName
.equals(eventLayout
.eventStatedumpProcessState())) {
50 Integer tid
= EventField
.getInt(event
, eventLayout
.fieldTid());
51 String name
= EventField
.getOrDefault(event
, eventLayout
.fieldName(), nullToEmptyString(Messages
.TraceEventHandlerSched_UnknownThreadName
));
52 Integer status
= EventField
.getInt(event
, eventLayout
.fieldStatus());
54 String host
= event
.getTrace().getHostId();
55 long ts
= event
.getTimestamp().getValue();
57 HostThread ht
= new HostThread(host
, tid
);
58 LttngWorker task
= system
.findWorker(ht
);
60 task
= new LttngWorker(ht
, name
, ts
);
61 system
.addWorker(task
);
66 task
.setStatus(ProcessStatus
.getStatus(status
));