Search in sources :

Example 6 with ITmfEventRequest

use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.

the class CopyToClipboardOperation method copy.

private IStatus copy(final StringBuilder sb, final IProgressMonitor monitor) {
    ITmfEventRequest request = new TmfEventRequest(ITmfEvent.class, TmfTimeRange.ETERNITY, fStartRank, (int) (fEndRank - fStartRank + 1), ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            if (monitor.isCanceled()) {
                cancel();
                return;
            }
            monitor.worked(1);
            if (fFilter == null || fFilter.matches(event)) {
                try {
                    boolean needTab = false;
                    for (TmfEventTableColumn column : fColumns) {
                        if (needTab) {
                            sb.append('\t');
                        }
                        sb.append(column.getItemString(event));
                        needTab = true;
                    }
                    sb.append(LINE_SEPARATOR);
                } catch (OutOfMemoryError e) {
                    sb.setLength(0);
                    sb.trimToSize();
                    showErrorDialog();
                    cancel();
                }
            }
        }
    };
    fTrace.sendRequest(request);
    try {
        request.waitForCompletion();
    } catch (InterruptedException e) {
        // $NON-NLS-1$
        Activator.getDefault().logError("Wait for completion interrupted for copy to clipboard ", e);
        Thread.currentThread().interrupt();
    }
    return Status.OK_STATUS;
}
Also used : ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfEventTableColumn(org.eclipse.tracecompass.tmf.ui.viewers.events.columns.TmfEventTableColumn) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Example 7 with ITmfEventRequest

use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.

the class StreamListAnalysis method executeAnalysis.

@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
    IProgressMonitor mon = (monitor == null ? new NullProgressMonitor() : monitor);
    ITmfTrace trace = getTrace();
    if (trace == null) {
        /* This analysis was cancelled in the meantime */
        return false;
    }
    ITmfEventRequest request = fRequest;
    if ((request != null) && (!request.isCompleted())) {
        request.cancel();
    }
    request = new TmfEventRequest(PcapEvent.class, TmfTimeRange.ETERNITY, 0L, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND) {

        @Override
        public void handleData(ITmfEvent data) {
            // Called for each event
            super.handleData(data);
            if (!(data instanceof PcapEvent)) {
                return;
            }
            PcapEvent event = (PcapEvent) data;
            for (Map.Entry<TmfPcapProtocol, TmfPacketStreamBuilder> entry : fBuilders.entrySet()) {
                entry.getValue().addEventToStream(event);
            }
        }
    };
    trace.sendRequest(request);
    fRequest = request;
    try {
        request.waitForCompletion();
    } catch (InterruptedException e) {
        // Request was canceled.
        return false;
    }
    return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) PcapEvent(org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Example 8 with ITmfEventRequest

use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.

the class TmfSyntheticEventProviderStub method armRequest.

@Override
public ITmfContext armRequest(final ITmfEventRequest request) {
    // Get the TmfSyntheticEventStub provider
    final ITmfEventProvider[] eventProviders = TmfProviderManager.getProviders(ITmfEvent.class, TmfEventProviderStub.class);
    final ITmfEventProvider provider = eventProviders[0];
    final TmfTimeRange range = request.getRange();
    final TmfEventRequest subRequest = new TmfEventRequest(ITmfEvent.class, range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(final ITmfEvent event) {
            super.handleData(event);
            handleIncomingData(event);
        }
    };
    provider.sendRequest(subRequest);
    // Return a dummy context
    return new TmfContext();
}
Also used : ITmfEventProvider(org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider) TmfContext(org.eclipse.tracecompass.tmf.core.trace.TmfContext) ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)

Example 9 with ITmfEventRequest

use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.

the class TmfStateSystemAnalysisModule method startRequest.

private void startRequest() {
    ITmfStateProvider stateProvider = fStateProvider;
    TmfTimeRange timeRange = fTimeRange;
    if (stateProvider == null || timeRange == null) {
        return;
    }
    ITmfEventRequest request = createEventRequest(stateProvider, timeRange, fNbRead);
    stateProvider.getTrace().sendRequest(request);
    fRequest = request;
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Example 10 with ITmfEventRequest

use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.

the class PartialHistoryBackend method registerCheckpoints.

private void registerCheckpoints() {
    ITmfEventRequest request = new CheckpointsRequest(fPartialInput, fCheckpoints);
    fPartialInput.getTrace().sendRequest(request);
/* The request will countDown the checkpoints latch once it's finished */
}
Also used : ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Aggregations

ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)18 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)4 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)4 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)2 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)2 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 TmfCoalescedEventRequest (org.eclipse.tracecompass.internal.tmf.core.request.TmfCoalescedEventRequest)1 PcapEvent (org.eclipse.tracecompass.internal.tmf.pcap.core.event.PcapEvent)1 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)1 TimeRangeException (org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException)1 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)1 TmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval)1 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)1