use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.
the class ResourcesAndCpuViewTest method testResetTimeRange.
/**
* Test that the reset time range button resets the time range for both the CPU
* view and the Resources view.
*/
@Test
public void testResetTimeRange() {
ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
assertNotNull(activeTrace);
IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
assertTrue(viewPart instanceof CpuUsageView);
final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
assertNotNull(chartViewer);
IWorkbenchPart part = fResourcesViewBot.getViewReference().getPart(false);
assertTrue(part instanceof AbstractTimeGraphView);
AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
// click the reset time range button in the CPU view
getSWTBotView().toolbarButton(RESET).click();
assertChartRange(chartViewer, FULL_RANGE);
fResourcesViewBot.setFocus();
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, activeTrace, FULL_RANGE));
// go back to the original range
broadcast(new TmfWindowRangeUpdatedSignal(this, activeTrace.getInitialTimeRange(), activeTrace));
// click the reset time range button in the Resources View
fResourcesViewBot.toolbarButton(RESET).click();
assertChartRange(chartViewer, FULL_RANGE);
fResourcesViewBot.setFocus();
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, activeTrace, FULL_RANGE));
}
use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.
the class PinAndCloneTest method testPinTwoTraces.
/**
* Test the behavior with two traces.
*/
@Ignore
@Test
public void testPinTwoTraces() {
ITmfTrace ust = TmfTraceManager.getInstance().getActiveTrace();
assertNotNull(ust);
ITmfTrace kernelTestTrace = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL);
SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTestTrace.getPath(), TRACETYPE_ID);
/* Finish waiting for the trace to index */
WaitUtils.waitForJobs();
SWTBotEditor kernelEditor = SWTBotUtils.activateEditor(fBot, kernelTestTrace.getName());
// wait for the editor to be ready.
fBot.editorByTitle(kernelTestTrace.getName());
// assert that the pin to drop down menuItems are present for both traces.
fBot.waitUntil(new DefaultCondition() {
WidgetNotFoundException fException;
@Override
public boolean test() throws Exception {
try {
SWTBotToolbarDropDownButton toolbarDropDownButton = fOriginalViewBot.toolbarDropDownButton(PIN_VIEW_BUTTON_NAME);
toolbarDropDownButton.menuItem(PIN_TO_PREFIX + kernelTestTrace.getName());
toolbarDropDownButton.menuItem(PIN_TO_PREFIX + fUstTestTrace.getName()).click();
return true;
} catch (WidgetNotFoundException e) {
fException = e;
return false;
}
}
@Override
public String getFailureMessage() {
return "Traces not available in toolbar drop down menu: " + fException;
}
});
/*
* assert that the pinned view is the UST trace despite the active trace being
* the kernel trace.
*/
assertOriginalViewTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE);
ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
assertNotNull("There should be an active trace", activeTrace);
assertEquals("context-switches-kernel should be the active trace", kernelTestTrace.getName(), activeTrace.getName());
// Get the window range of the kernel trace
TmfTraceManager traceManager = TmfTraceManager.getInstance();
ITmfTrace kernelTrace = traceManager.getActiveTrace();
assertNotNull(kernelTrace);
// switch back and forth
SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName());
assertOriginalViewTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE);
SWTBotUtils.activateEditor(fBot, kernelTestTrace.getName());
assertOriginalViewTitle(PINNED_TO_UST_TIME_GRAPH_VIEW_TITLE);
IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false);
assertTrue(part instanceof AbstractTimeGraphView);
AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part;
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, kernelTrace));
// assert that the ust trace's window range did not change
SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName());
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, ust, INITIAL_UST_RANGE));
// unpin from another active trace
SWTBotUtils.activateEditor(fBot, kernelTrace.getName());
fOriginalViewBot.toolbarButton(UNPIN_VIEW_BUTTON_NAME).click();
assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click();
assertOriginalViewTitle(PINNED_TO_KERNEL_TIME_GRAPH_VIEW_TITLE);
SWTBotTable kernelEventTable = kernelEditor.bot().table();
SWTBotTableItem kernelEvent = kernelEventTable.getTableItem(5);
kernelEvent.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click();
TmfTimeRange expectedUstWindowRange = new TmfTimeRange(TmfTimestamp.fromNanos(UST_START + SECOND), TmfTimestamp.fromNanos(UST_END - SECOND));
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, expectedUstWindowRange, ust));
fBot.waitUntil(ConditionHelpers.timeGraphRangeCondition(abstractTimeGraphView, kernelTrace, expectedUstWindowRange));
// close the pinned trace
SWTBotEditor kernelTable = fBot.editorByTitle(kernelTestTrace.getName());
kernelTable.close();
assertOriginalViewTitle(TIME_GRAPH_VIEW_TITLE);
kernelTestTrace.dispose();
}
use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.
the class TimeGraphBaseHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Check if we are closing down
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return null;
}
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof AbstractTimeGraphView) {
AbstractTimeGraphView view = (AbstractTimeGraphView) part;
execute(view);
}
return null;
}
use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.
the class TimeGraphViewTest method timeGraphIsReadyCondition.
private void timeGraphIsReadyCondition(@NonNull TmfTimeRange selectionRange) {
IWorkbenchPart part = fViewBot.getViewReference().getPart(false);
fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, selectionRange, selectionRange.getEndTime()));
}
use of org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView in project tracecompass by tracecompass.
the class ControlFlowViewSortingTest method testColumnSorting.
// ------------------------------------------------------------------------
// Test case(s)
// ------------------------------------------------------------------------
/**
* UI test of sorting of processes in CFV based on column selection. To verify that the sorting
* was executed correctly, the test will use bot.waitUntil() the column content has the right
* order.
*/
@Test
public void testColumnSorting() {
fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(TRACE_START_TIME, TRACE_START_TIME), TRACE_START_TIME));
// Create a known state
applyFilter();
final SWTBotTree tree = fViewBot.bot().tree();
final SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(fViewBot.bot());
final SWTBotTimeGraphEntry timeGraphEntry = timeGraph.getEntry(TRACE_NAME, SYSTEMD_PROCESS_NAME);
timeGraphEntry.select();
testProcessSorting(tree, timeGraph);
testTidSorting(tree, timeGraph);
testPidSorting(tree, timeGraph);
testPtidSorting(tree, timeGraph);
testBirthtimeSorting(tree, timeGraph);
}
Aggregations