Search in sources :

Example 21 with TmfSignalHandler

use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.

the class ResourcesView method listenToCurrentThread.

/**
 * Signal handler for a thread selected signal.
 *
 * @param signal
 *            the thread selected signal
 * @since 2.0
 */
@TmfSignalHandler
public void listenToCurrentThread(TmfThreadSelectedSignal signal) {
    HostThread data = signal.getThreadId() >= 0 ? signal.getHostThread() : null;
    ITmfTrace trace = getTrace();
    if (trace == null) {
        return;
    }
    TmfTraceManager.getInstance().updateTraceContext(trace, builder -> builder.setData(HostThread.SELECTED_HOST_THREAD_KEY, data));
    if (data != null) {
        // $NON-NLS-1$ //$NON-NLS-2$
        setFollowedThread("Current_thread==" + data.getTid() + " || TID==" + data.getTid());
    } else {
        removeFollowedThread();
    }
    restartZoomThread();
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 22 with TmfSignalHandler

use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.

the class FlameGraphView method traceSelected.

/**
 * Handler for the trace selected signal
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public void traceSelected(final TmfTraceSelectedSignal signal) {
    ITmfTrace trace = signal.getTrace();
    fTrace = trace;
    if (trace != null) {
        Iterable<CallStackAnalysis> csModules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class);
        List<CallGraphAnalysis> cgModules = new ArrayList<>();
        for (CallStackAnalysis csModule : csModules) {
            csModule.schedule();
            ICallGraphProvider cgModule = csModule.getCallGraph();
            if (cgModule instanceof CallGraphAnalysis) {
                cgModules.add((CallGraphAnalysis) cgModule);
            }
        }
        fFlamegraphModules = cgModules;
        buildFlameGraph(cgModules);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) CallGraphAnalysis(org.eclipse.tracecompass.internal.analysis.profiling.core.callgraph.CallGraphAnalysis) ICallGraphProvider(org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider) ArrayList(java.util.ArrayList) CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 23 with TmfSignalHandler

use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.

the class AbstractSegmentStoreDensityViewer method windowRangeUpdated.

/**
 * Signal handler for handling of the window range signal.
 *
 * @param signal
 *            The {@link TmfWindowRangeUpdatedSignal}
 */
@TmfSignalHandler
public void windowRangeUpdated(@Nullable TmfWindowRangeUpdatedSignal signal) {
    if (signal == null) {
        return;
    }
    ITmfTrace parent = getTrace();
    if (parent == null) {
        return;
    }
    fCurrentTimeRange = NonNullUtils.checkNotNull(signal.getCurrentRange());
    updateWindowRange(fCurrentTimeRange, false);
    updateWithRange(fCurrentTimeRange);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 24 with TmfSignalHandler

use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.

the class AbstractSegmentStoreTableViewer method traceOpened.

/**
 * Trace opened handler
 *
 * @param signal
 *            New trace (on which segment store analysis has not been
 *            performed) is opened
 */
@TmfSignalHandler
public void traceOpened(TmfTraceOpenedSignal signal) {
    ITmfTrace trace = signal.getTrace();
    if (trace != fTrace) {
        // Cancel the filtering job from the previous trace
        Job job = fFilteringJob;
        if (job != null) {
            job.cancel();
        }
    }
    fTrace = trace;
    if (trace != null) {
        setData(getSegmentStoreProvider(trace));
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) Job(org.eclipse.core.runtime.jobs.Job) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 25 with TmfSignalHandler

use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.

the class TmfPerspectiveManager method traceOpened.

/**
 * Signal handler for the traceOpened signal.
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public synchronized void traceOpened(final TmfTraceOpenedSignal signal) {
    Display.getDefault().asyncExec(() -> {
        String id = TmfTraceTypeUIUtils.getPerspectiveId(signal.getTrace());
        if (id == null) {
            /*
                 * For experiments, switch only if all traces have the same
                 * associated perspective id.
                 */
            for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
                String perspectiveId = TmfTraceTypeUIUtils.getPerspectiveId(trace);
                if (id != null && !id.equals(perspectiveId)) {
                    return;
                }
                id = perspectiveId;
            }
        }
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (id != null && window != null && shouldSwitchPerspective(window, id, ITmfUIPreferences.SWITCH_TO_PERSPECTIVE)) {
            switchToPerspective(window, id);
        }
    });
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Aggregations

TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)53 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)19 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)6 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)6 Job (org.eclipse.core.runtime.jobs.Job)4 IFile (org.eclipse.core.resources.IFile)3 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)3 TmfTraceElement (org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement)3 Collection (java.util.Collection)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Set (java.util.Set)2 IResource (org.eclipse.core.resources.IResource)2 IStatus (org.eclipse.core.runtime.IStatus)2 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)2 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)2 HashMultiset (com.google.common.collect.HashMultiset)1