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
.ui
.criticalpath
;
12 import org
.eclipse
.tracecompass
.analysis
.graph
.core
.criticalpath
.CriticalPathModule
;
13 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.model
.HostThread
;
14 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.signals
.TmfThreadSelectedSignal
;
15 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.analysis
.graph
.model
.LttngWorker
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.IAnalysisModule
;
17 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.TmfAbstractAnalysisParamProvider
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalHandler
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalManager
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
24 * Class that provides parameters to the critical path analysis for lttng kernel
27 * @author Geneviève Bastien
29 public class CriticalPathParameterProvider
extends TmfAbstractAnalysisParamProvider
{
31 private static final String NAME
= "Critical Path Lttng kernel parameter provider"; //$NON-NLS-1$
33 private HostThread fCurrentHostThread
= null;
38 public CriticalPathParameterProvider() {
40 TmfSignalManager
.register(this);
44 public String
getName() {
49 public Object
getParameter(String name
) {
50 if (name
.equals(CriticalPathModule
.PARAM_WORKER
)) {
51 final HostThread currentHostThread
= fCurrentHostThread
;
52 if (currentHostThread
== null) {
55 /* Try to find the worker for the critical path */
56 IAnalysisModule mod
= getModule();
57 if ((mod
!= null) && (mod
instanceof CriticalPathModule
)) {
58 LttngWorker worker
= new LttngWorker(currentHostThread
, "", 0); //$NON-NLS-1$
66 public boolean appliesToTrace(ITmfTrace trace
) {
70 private void setCurrentHostThread(HostThread hostThread
) {
71 if (!hostThread
.equals(fCurrentHostThread
)) {
72 fCurrentHostThread
= hostThread
;
73 notifyParameterChanged(CriticalPathModule
.PARAM_WORKER
);
78 * Signal handler to know that a thread was selected
81 * the thread was selected
84 public void tmfThreadSelectedSignalHander(TmfThreadSelectedSignal signal
) {
85 final TmfThreadSelectedSignal threadSignal
= signal
;
86 if (threadSignal
!= null) {
87 setCurrentHostThread(new HostThread(threadSignal
.getTraceHost(), threadSignal
.getThreadId()));
92 * Reset the selection when a new trace is selected
94 * @param signal The trace selected signal
97 public void traceSelected(TmfTraceSelectedSignal signal
) {
98 fCurrentHostThread
= null;