Search in sources :

Example 16 with TmfSignalHandler

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

the class TmfStateSystemExplorer method handleAnalysisStarted.

/**
 * Rebuild the view's entry tree to ensure that entries from a newly started
 * trace are added.
 *
 * @param signal
 *            analysis started signal.
 * @since 3.3
 */
@TmfSignalHandler
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) {
    IAnalysisModule module = signal.getAnalysisModule();
    if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) {
        /*
             * use set to wait for initialization in build entry list to avoid
             * deadlocks.
             */
        final ITmfTrace viewTrace = getTrace();
        if (Iterables.contains(allModules(viewTrace), module)) {
            /*
                 * Rebuild only if the started analysis module is from the
                 * active trace/experiment.
                 */
            new Thread(() -> {
                /*
                     *  DataProviderManager#getDataProvider() (see getDataProvider() below) should never be called in a signal handler.
                     */
                synchronized (fStartedAnalysis) {
                    fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
                    // Every children of ITmfAnalysisModuleWithStateSystems extends TmfAbstractAnalysisModule
                    ITmfTrace moduleTrace = module instanceof TmfAbstractAnalysisModule ? ((TmfAbstractAnalysisModule) module).getTrace() : viewTrace;
                    if (moduleTrace != null) {
                        getDataProvider(moduleTrace).startedAnalysisSignalHandler((ITmfAnalysisModuleWithStateSystems) module);
                        rebuild();
                    }
                }
            }).start();
        } else {
            /*
                 * Reset the View for the relevant trace, ensuring that the
                 * entry list will be rebuilt when the view switches back.
                 */
            for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) {
                if (Iterables.contains(allModules(trace), module)) {
                    synchronized (fStartedAnalysis) {
                        fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module);
                        resetView(trace);
                    }
                    break;
                }
            }
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfAbstractAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 17 with TmfSignalHandler

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

the class TimeChartView method traceClosed.

/**
 * Handler for the Trace Closed signal
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public void traceClosed(TmfTraceClosedSignal signal) {
    final ITmfTrace trace = signal.getTrace();
    for (int i = 0; i < fTimeAnalysisEntries.size(); i++) {
        if (fTimeAnalysisEntries.get(i).getTrace().equals(trace)) {
            fTimeAnalysisEntries.remove(i);
            fDecorationProviders.remove(trace);
            synchronized (fDecorateThreads) {
                for (DecorateThread thread : fDecorateThreads) {
                    if (thread.fTimeAnalysisEntry.getTrace() == trace) {
                        thread.cancel();
                        fDecorateThreads.remove(thread);
                        break;
                    }
                }
            }
            refreshViewer();
            break;
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 18 with TmfSignalHandler

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

the class TimeChartView method traceOpened.

// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
/**
 * Handler for the Trace Opened signal
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public void traceOpened(TmfTraceOpenedSignal signal) {
    final ITmfTrace trace = signal.getTrace();
    final IFile bookmarksFile = signal.getEditorFile();
    TimeChartAnalysisEntry timeAnalysisEntry = null;
    for (int i = 0; i < fTimeAnalysisEntries.size(); i++) {
        if (fTimeAnalysisEntries.get(i).getTrace().equals(trace)) {
            timeAnalysisEntry = fTimeAnalysisEntries.get(i);
            break;
        }
    }
    if (timeAnalysisEntry == null) {
        timeAnalysisEntry = new TimeChartAnalysisEntry(trace, fDisplayWidth * 2);
        fTimeAnalysisEntries.add(timeAnalysisEntry);
        fDecorationProviders.put(trace, new TimeChartDecorationProvider(bookmarksFile));
        startProcessTraceThread(timeAnalysisEntry);
    }
    refreshViewer();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IFile(org.eclipse.core.resources.IFile) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 19 with TmfSignalHandler

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

the class AbstractTimeGraphView method selectionChanged.

/**
 * Signal indicating a data model element was selected somewhere
 *
 * @param signal
 *            the signal carrying the select data model metadata
 * @since 4.2
 */
@TmfSignalHandler
public void selectionChanged(TmfDataModelSelectedSignal signal) {
    // Ignore signal from self
    if (signal.getSource() == this) {
        return;
    }
    Multimap<@NonNull String, @NonNull Object> metadata = signal.getMetadata();
    // See if the current selection intersects the metadata
    ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
    if (selection instanceof IElementResolver && IElementResolver.commonIntersect(metadata, ((IElementResolver) selection).getMetadata())) {
        return;
    }
    // See if an entry intersects the metadata
    List<TimeGraphEntry> traceEntries = getEntryList(getTrace());
    if (traceEntries == null) {
        return;
    }
    for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) {
        Iterable<TimeGraphEntry> unfiltered = Utils.flatten(traceEntry);
        for (TimeGraphEntry entry : unfiltered) {
            if (IElementResolver.commonIntersect(metadata, entry.getMetadata())) {
                getTimeGraphViewer().setSelection(entry, true);
            }
        }
    }
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) IElementResolver(org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver) TraceEntry(org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraphView.TraceEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 20 with TmfSignalHandler

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

the class ControlFlowView method traceSelected.

@TmfSignalHandler
@Override
public void traceSelected(TmfTraceSelectedSignal signal) {
    super.traceSelected(signal);
    /* Update the Flat and Hierarchical actions */
    synchronized (fFlatTraces) {
        if (fFlatTraces.contains(signal.getTrace())) {
            fHierarchicalAction.setChecked(false);
            fFlatAction.setChecked(true);
        } else {
            fFlatAction.setChecked(false);
            fHierarchicalAction.setChecked(true);
        }
    }
    /* Update the Dynamic Filters related actions */
    ViewerFilter activeThreadFilter = null;
    ViewerFilter[] traceFilters = getFiltersMap().get(signal.getTrace());
    if (traceFilters != null) {
        activeThreadFilter = getActiveThreadsFilter(traceFilters);
    }
    if (activeThreadFilter instanceof ActiveThreadsFilter) {
        fActiveThreadsFilter = (ActiveThreadsFilter) activeThreadFilter;
    } else {
        fActiveThreadsFilter = new ActiveThreadsFilter(null, false, getTrace());
    }
    fActiveThreadsRapidToggle.setChecked(fActiveThreadsFilter.isEnabled());
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ActiveThreadsFilter(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter) 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