use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.
the class TmfTimeViewer method updateWindow.
@Override
public void updateWindow(long windowStartTime, long windowEndTime) {
setWindowRange(windowStartTime, windowEndTime);
// Build the new time range; keep the current time
TmfTimeRange timeRange = new TmfTimeRange(TmfTimestamp.fromNanos(getWindowStartTime()), TmfTimestamp.fromNanos(getWindowEndTime()));
// Send the signal
TmfWindowRangeUpdatedSignal signal = new TmfWindowRangeUpdatedSignal(this, timeRange, getTrace());
fTimeRangeSyncThrottle.queue(signal);
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.
the class PinAndCloneTest method testFollow.
/**
* Test the follow time updates functionality
*/
@Test
public void testFollow() {
TmfTraceManager traceManager = TmfTraceManager.getInstance();
ITmfTrace ust = traceManager.getActiveTrace();
assertNotNull(ust);
ITmfTrace kernelTest = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL);
SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTest.getPath(), TRACETYPE_ID);
/* Finish waiting for the trace to index */
WaitUtils.waitForJobs();
SWTBotEditor kernelEditor = SWTBotUtils.activateEditor(fBot, kernelTest.getName());
// wait for the editor to be ready.
fBot.editorByTitle(kernelTest.getName());
ITmfTrace kernel = traceManager.getActiveTrace();
assertNotNull(kernel);
SWTBotTable kernelEventTable = kernelEditor.bot().table();
SWTBotTableItem kernelEvent = kernelEventTable.getTableItem(5);
kernelEvent.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click();
SWTBotUtils.activateEditor(fBot, ust.getName());
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust));
// assert that the kernel trace followed the ust trace's range
IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false);
assertTrue(part instanceof AbstractTimeGraphView);
AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, ust, RANGE));
SWTBotUtils.activateEditor(fBot, kernel.getName());
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, kernel, RANGE));
// unfollow (don't use context menu on table item to avoid updating selection)
kernelEventTable.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click();
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, ust.getInitialTimeRange(), ust));
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, kernel, RANGE));
kernelTest.dispose();
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.
the class PinAndCloneTest method testCloneSingleTrace.
/**
* Test the cloning feature.
*/
@Test
public void testCloneSingleTrace() {
// single trace.
SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_VIEW_MENU);
/*
* assert that the original editor was not renamed and that the cloned one
* exists and is pinned to the UST trace.
*/
cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click();
assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE);
assertEquals("Should not have created a new instance", 1, fBot.editors().size());
clonedView.close();
/*
* Assert that a new instance is created.
*/
cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click();
assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
clonedView = fBot.viewByTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE2);
assertEquals("Should have created a new instance", 2, fBot.editors().size());
SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + CLONED_TRACE_SUFFIX);
// Get the window range of the cloned trace
TmfTraceManager traceManager = TmfTraceManager.getInstance();
ITmfTrace cloneTrace = traceManager.getActiveTrace();
assertNotNull(cloneTrace);
// go back to original trace, pin it
SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName());
fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click();
ITmfTrace ust = traceManager.getActiveTrace();
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust));
// assert that the cloned trace's window range did not change
SWTBotUtils.activateEditor(fBot, cloneTrace.getName() + CLONED_TRACE_SUFFIX);
IWorkbenchPart part = clonedView.getViewReference().getPart(false);
assertTrue(part instanceof AbstractTimeGraphView);
AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, cloneTrace, INITIAL_UST_RANGE));
cloneEditor.close();
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.
the class MarkerSetSwtBotTest method testNavigateBetweenMarkers.
/**
* Test navigation between markers
*/
@Test
public void testNavigateBetweenMarkers() {
AbstractTimeGraphView part = (AbstractTimeGraphView) fViewBot.getViewReference().getPart(false);
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, fFullRange));
fBot.waitUntil(ConditionHelpers.windowRange(fFullRange));
insertContent();
fViewBot.setFocus();
SWTBotRootMenu viewMenu = fViewBot.viewMenu();
viewMenu.menu("Marker Set", "Set A").click();
fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(fStart)), TmfTimestamp.fromNanos(fStart)));
fViewBot.toolbarButton("Next Marker").click();
// Marker A-1: period = 10, unit = ns, offset = 0
long period = 10l;
long nextStart = fStart + (period - (fStart % period));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TmfTimestamp.fromNanos(nextStart), TmfTimestamp.fromNanos(nextStart + period))));
viewMenu.menu("Show Markers", "Marker A-1").hide();
fViewBot.toolbarButton("Previous Marker").click();
fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(nextStart)), TmfTimestamp.fromNanos(fStart)));
removeContent();
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.
the class FlameChartView method createPartControl.
// ------------------------------------------------------------------------
// ViewPart
// ------------------------------------------------------------------------
@Override
public void createPartControl(@Nullable Composite parent) {
super.createPartControl(parent);
getTimeGraphViewer().addTimeListener(event -> synchingToTime(event.getBeginTime()));
getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(@Nullable MouseEvent event) {
ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
if (!(selection instanceof TimeGraphEntry)) {
// also null checks
return;
}
ITimeGraphState function = fFunctions.get(((TimeGraphEntry) selection).getEntryModel().getId());
if (function != null) {
long entryTime = function.getStartTime();
long exitTime = entryTime + function.getDuration();
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(entryTime), TmfTimestamp.fromNanos(exitTime));
broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
getTimeGraphViewer().setStartFinishTime(entryTime, exitTime);
startZoomThread(entryTime, exitTime);
}
}
});
getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(@Nullable MouseEvent e) {
TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
ISelection selection = timeGraphControl.getSelection();
if (selection instanceof IStructuredSelection) {
for (Object object : ((IStructuredSelection) selection).toList()) {
if (object instanceof NamedTimeEvent) {
NamedTimeEvent event = (NamedTimeEvent) object;
long startTime = event.getTime();
long endTime = startTime + event.getDuration();
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
getTimeGraphViewer().setStartFinishTime(startTime, endTime);
startZoomThread(startTime, endTime);
break;
}
}
}
}
});
IEditorPart editor = getSite().getPage().getActiveEditor();
if (editor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
}
}
Aggregations