Search in sources :

Example 1 with TmfSignalHandler

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

the class CriticalPathView method analysisStarted.

/**
 * Signal handler for analysis started, we need to rebuilt the entry list with
 * updated statistics values for the current graph worker of the critical path
 * module.
 *
 * @param signal
 *            The signal
 */
@TmfSignalHandler
public void analysisStarted(TmfStartAnalysisSignal signal) {
    IAnalysisModule analysis = signal.getAnalysisModule();
    if (analysis instanceof CriticalPathModule) {
        CriticalPathModule criticalPath = (CriticalPathModule) analysis;
        /*
             * We need to wait for CriticalPathDataProviderFactory to have
             * received this signal. Create a new phaser and register, and wait
             * for the end synch signal to arrive and advance in a new thread.
             */
        fPhaser = new Phaser();
        fPhaser.register();
        new Thread() {

            @Override
            public void run() {
                fPhaser.awaitAdvance(0);
                Collection<ITmfTrace> traces = TmfTraceManager.getTraceSetWithExperiment(getTrace());
                if (traces.contains(criticalPath.getTrace())) {
                    rebuild();
                }
            }
        }.start();
    }
}
Also used : CriticalPathModule(org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) Collection(java.util.Collection) Phaser(java.util.concurrent.Phaser) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 2 with TmfSignalHandler

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

the class LamiReportViewTabPage method updateSelection.

// ------------------------------------------------------------------------
// Signals
// ------------------------------------------------------------------------
// Custom chart signals
/**
 * Signal handler for a chart selection update. It will try to propagate a
 * {@link TmfSelectionRangeUpdatedSignal} if possible.
 *
 * @param signal
 *            The selection update signal
 */
@TmfSignalHandler
public void updateSelection(ChartSelectionUpdateSignal signal) {
    /* Make sure we are not sending a signal to ourself */
    if (signal.getSource() == this) {
        return;
    }
    /* Make sure the signal comes from the data provider's scope */
    if (fResultTable.hashCode() != signal.getDataProvider().hashCode()) {
        return;
    }
    /* Find which index row has been selected */
    Set<Object> entries = signal.getSelectedObject();
    /* Update the selection */
    fSelection = entries;
    /* Only propagate to all TraceCompass if there is a single selection */
    if (entries.size() == 1) {
        LamiTableEntry entry = (LamiTableEntry) Iterables.getOnlyElement(entries);
        /* Make sure the selection represent a time range */
        LamiTimeRange timeRange = entry.getCorrespondingTimeRange();
        if (timeRange == null) {
            return;
        }
        /* Get the timestamps from the time range */
        /**
         * TODO: Consider low and high limits of timestamps here.
         */
        Number tsBeginValueNumber = timeRange.getBegin().getValue();
        Number tsEndValueNumber = timeRange.getEnd().getValue();
        if (tsBeginValueNumber == null || tsEndValueNumber == null) {
            return;
        }
        /* Send Range update to other views */
        ITmfTimestamp start = TmfTimestamp.fromNanos(tsBeginValueNumber.longValue());
        ITmfTimestamp end = TmfTimestamp.fromNanos(tsEndValueNumber.longValue());
        TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, start, end));
    }
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) LamiTimeRange(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 3 with TmfSignalHandler

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

the class TmfCoalescedEventRequestTest method trigger.

/**
 * @param signal
 *            the trigger signal
 */
@TmfSignalHandler
public void trigger(final TmfTestTriggerSignal2 signal) {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(100, -3), TmfTimestamp.BIG_CRUNCH);
    requestedEvents1 = new Vector<>();
    request1 = new TmfEventRequest(ITmfEvent.class, range, 0, 1, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents1.add(event);
            }
        }
    };
    providers = TmfProviderManager.getProviders(ITmfEvent.class, TmfTraceStub.class);
    providers[0].sendRequest(request1);
}
Also used : ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 4 with TmfSignalHandler

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

the class TmfCoalescedEventRequestTest method trigger.

@TmfSignalHandler
public void trigger(final TmfTestTriggerSignal signal) {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    final long REQUEST_OFFSET = 1000;
    requestedEvents1 = new Vector<>();
    request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents1.add(event);
                if (signal.forceCancel) {
                    cancel();
                }
            }
        }
    };
    requestedEvents2 = new Vector<>();
    request2 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents2.add(event);
            }
        }
    };
    requestedEvents3 = new Vector<>();
    request3 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (!isCompleted()) {
                requestedEvents3.add(event);
            }
        }
    };
    providers = TmfProviderManager.getProviders(ITmfEvent.class, TmfTraceStub.class);
    providers[0].sendRequest(request1);
    providers[0].sendRequest(request2);
    providers[0].sendRequest(request3);
}
Also used : ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 5 with TmfSignalHandler

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

the class TmfStateSystemAnalysisModule method traceRangeUpdated.

/**
 * Signal handler for the TmfTraceRangeUpdatedSignal signal
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public void traceRangeUpdated(final TmfTraceRangeUpdatedSignal signal) {
    fTimeRange = signal.getRange();
    ITmfStateProvider stateProvider = fStateProvider;
    synchronized (fRequestSyncObj) {
        if (signal.getTrace() == getTrace() && stateProvider != null && stateProvider.getAssignedStateSystem() != null) {
            ITmfEventRequest request = fRequest;
            if ((request == null) || request.isCompleted()) {
                startRequest();
            }
        }
    }
}
Also used : ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) 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