Search in sources :

Example 41 with TmfSignalHandler

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

the class CriticalPathDataProviderFactory method analysisStarted.

/**
 * {@link TmfSignalHandler} for when {@link CriticalPathModule} is started, as
 * the analysis is not registered with the trace, we use this to know to
 * associate a {@link CriticalPathModule} to a trace.
 *
 * @param startAnalysisSignal
 *            analysis started signal
 */
@TmfSignalHandler
public synchronized void analysisStarted(TmfStartAnalysisSignal startAnalysisSignal) {
    IAnalysisModule analysis = startAnalysisSignal.getAnalysisModule();
    if (analysis instanceof CriticalPathModule) {
        CriticalPathModule criticalPath = (CriticalPathModule) analysis;
        map.put(criticalPath.getTrace(), criticalPath);
    }
}
Also used : CriticalPathModule(org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 42 with TmfSignalHandler

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

the class LamiReportViewTabPage method externalUpdateSelectionCustomCharts.

/**
 * Signal handler for a trace selection range update signal. It will try to
 * map the external selection to our lami table entry.
 *
 * @param signal
 *            The received signal
 */
@TmfSignalHandler
public void externalUpdateSelectionCustomCharts(TmfSelectionRangeUpdatedSignal signal) {
    /* Make sure we are not sending a signal to ourself */
    if (signal.getSource() == this) {
        return;
    }
    TmfTimeRange range = new TmfTimeRange(signal.getBeginTime(), signal.getEndTime());
    // Custom chart signal
    /* Find which lami table entry intersects the signal */
    Set<Object> selection = getEntriesIntersectingTimerange(fResultTable, range);
    /* Update all LamiViewer */
    ChartSelectionUpdateSignal updateSignal = new ChartSelectionUpdateSignal(this, fResultTable, selection);
    TmfSignalManager.dispatchSignal(updateSignal);
}
Also used : ChartSelectionUpdateSignal(org.eclipse.tracecompass.internal.provisional.tmf.chart.core.signal.ChartSelectionUpdateSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 43 with TmfSignalHandler

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

the class ControlFlowView method traceClosed.

@TmfSignalHandler
@Override
public void traceClosed(TmfTraceClosedSignal signal) {
    ITmfTrace parentTrace = signal.getTrace();
    super.traceClosed(signal);
    synchronized (fFlatTraces) {
        fFlatTraces.remove(parentTrace);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 44 with TmfSignalHandler

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

the class CpuUsageView method cpuSelect.

/**
 * Signal handler for when a cpu is selected
 *
 * @param signal
 *            the cpu being selected
 * @since 2.0
 */
@TmfSignalHandler
public void cpuSelect(TmfCpuSelectedSignal signal) {
    ITmfTrace trace = signal.getTrace();
    TmfXYChartViewer xyViewer = getChartViewer();
    TmfViewer viewer = getLeftChildViewer();
    if (xyViewer instanceof CpuUsageXYViewer && viewer instanceof CpuUsageTreeViewer) {
        Set<Integer> data = (Set<Integer>) getData(trace, CPU_USAGE_FOLLOW_CPU);
        if (data == null) {
            data = new TreeSet<>();
            saveData(trace, CPU_USAGE_FOLLOW_CPU, data);
        }
        int core = signal.getCore();
        if (core >= 0) {
            data.add(core);
        } else {
            data.clear();
        }
        xyViewer.refresh();
        ((CpuUsageXYViewer) xyViewer).setTitle();
        CpuUsageTreeViewer treeViewer = (CpuUsageTreeViewer) viewer;
        treeViewer.updateContent(treeViewer.getWindowStartTime(), treeViewer.getWindowEndTime(), false);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) Set(java.util.Set) TreeSet(java.util.TreeSet) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 45 with TmfSignalHandler

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

the class ResourcesView method listenToCpu.

/**
 * Signal handler for a cpu selected signal.
 *
 * @param signal
 *            the cpu selected signal
 * @since 2.0
 */
@TmfSignalHandler
public void listenToCpu(TmfCpuSelectedSignal signal) {
    int data = signal.getCore() >= 0 ? signal.getCore() : -1;
    ITmfTrace trace = getTrace();
    if (trace == null) {
        return;
    }
    TmfTraceManager.getInstance().updateTraceContext(trace, builder -> builder.setData(RESOURCES_FOLLOW_CPU, data));
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) 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