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();
}
}
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));
}
}
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);
}
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);
}
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();
}
}
}
}
Aggregations