use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class ControlFlowViewTest method testToolBarFollowCPUForwardBackward.
/**
* Test tool bar buttons "Follow CPU Forward" and "Follow CPU Backward"
*/
@Test
public void testToolBarFollowCPUForwardBackward() {
/* change window range to 10 ms */
TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
fBot.waitUntil(ConditionHelpers.windowRange(range));
/* set selection to trace start time */
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
SWTBotView viewBot = getViewBot();
/* set focus on time graph */
SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
timeGraph.setFocus();
/* select first thread */
timeGraph.getEntry(LttngTraceGenerator.getName(), "gnuplot").select();
/* click "Follow CPU Forward" 3 times */
timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME2)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME2));
/* shift-click "Follow CPU Forward" 3 times */
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID5_TIME1)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "5"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID5_TIME1));
/* shift-click "Follow CPU Backward" 4 times */
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME1));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME1)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME1));
/* click "Follow CPU Forward" 2 times */
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME3)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME3));
/* shift-click "Follow CPU Backward" 3 times */
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID1_TIME1));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID1_TIME1)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "1"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1));
/* shift-click "Follow CPU Forward" 4 times */
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
viewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME4));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME4)));
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraph, 1, "2"));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME4));
/* click "Follow CPU Backward" 5 times */
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
viewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME)));
assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME));
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class ControlFlowViewTest method testFilter.
/**
* Test the filter
*/
@Test
public void testFilter() {
/* change window range to 1 ms */
TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(1000000L, ITmfTimestamp.NANOSECOND_SCALE));
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
SWTBotView viewBot = getViewBot();
SWTBotToolbarButton filterButton = viewBot.toolbarButton("Show View Filters");
filterButton.click();
SWTBot bot = fBot.shell("Filter").activate().bot();
SWTBotTree treeBot = bot.tree();
// get how many items there are
int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals("default", 226, checked);
// test "uncheck all button"
bot.button(UNCHECK_ALL).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(0, checked);
// test check active
bot.button(CHECK_ACTIVE).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(CHECK_ACTIVE, 69, checked);
// test check all
bot.button(CHECK_ALL).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(CHECK_ALL, 226, checked);
// test uncheck inactive
bot.button(UNCHECK_INACTIVE).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(UNCHECK_INACTIVE, 69, checked);
// test check selected
treeBot.getTreeItem(LttngTraceGenerator.getName()).select("gnuplot");
bot.button(UNCHECK_ALL).click();
bot.button(CHECK_SELECTED).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(CHECK_SELECTED, 2, checked);
// test check subtree
bot.button(UNCHECK_ALL).click();
bot.button(CHECK_SUBTREE).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(CHECK_SUBTREE, 2, checked);
// test uncheck selected
bot.button(CHECK_ALL).click();
bot.button(UNCHECK_SELECTED).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(UNCHECK_SELECTED, 225, checked);
// test uncheck subtree
bot.button(CHECK_ALL).click();
bot.button(UNCHECK_SUBTREE).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(UNCHECK_SELECTED, 225, checked);
// test filter
bot.button(UNCHECK_ALL).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals(0, checked);
bot.text().setText("half-life 3");
SWTBotTreeItem treeItem = treeBot.getTreeItem(LttngTraceGenerator.getName());
treeItem.rowCount();
fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 25));
bot.button(CHECK_ALL).click();
checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
assertEquals("Filtered", 26, checked);
bot.button(DIALOG_OK).click();
SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
for (SWTBotTimeGraphEntry entry : traceEntry.getEntries()) {
assertEquals("Filtered Control flow view", "Half-life 3", entry.getText());
}
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class CriticalPathTest method testFull.
/**
* test the behavior of the critical path for a thread selection signal from
* the control flow view
*/
@Test
public void testFull() {
SWTBotTimeGraph timeGraphCfv = new SWTBotTimeGraph(fViewBotCfv.bot());
SWTBotTree treeCp = fViewBotCp.bot().tree();
SWTBotTimeGraph timeGraphCp = new SWTBotTimeGraph(fViewBotCp.bot());
assertNotNull(timeGraphCfv.widget);
assertNotNull(treeCp.widget);
SWTBotTreeItem[] allItems = treeCp.getAllItems();
for (int i = 0; i < allItems.length; i++) {
assertEquals(0, allItems[i].getNodes().size());
}
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
assertNotNull(trace);
SWTBotTimeGraphEntry entry = timeGraphCfv.getEntry(trace.getName(), "systemd", "we", PROCESS);
assertNotNull(entry);
entry.select();
SWTBotMenu menu = entry.contextMenu("Follow " + PROCESS + "/" + TID);
assertEquals("Follow " + PROCESS + "/" + TID, menu.getText());
menu.click();
fBot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
SWTBotTimeGraphEntry[] entries = timeGraphCp.getEntries();
return CRIT_PATH_MAIN_ENTRY.equals(entries[0].getEntries()[0].getText());
}
@Override
public String getFailureMessage() {
return "Could not find " + CRIT_PATH_MAIN_ENTRY + " in Critical Path view";
}
});
// Test navigating the critical path view with the follow arrows buttons
IWorkbenchPart part = fViewBotCp.getViewReference().getPart(false);
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, CPU_TIME0));
SWTBotTimeGraphEntry critPathEntry = timeGraphCp.getEntry(trace.getHostId(), CRIT_PATH_MAIN_ENTRY);
critPathEntry.select();
// Condition to wait for the time graph view to refresh
ICondition timeGraphIsReadyCondition = ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(CPU_TIME1, CPU_TIME1), CPU_TIME1);
// Reach the end of the current event
fViewBotCp.toolbarButton(FOLLOW_FORWARD).click();
fBot.waitUntil(timeGraphIsReadyCondition);
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_MAIN_ENTRY));
// Follow the arrow down to the next item
fViewBotCp.toolbarButton(FOLLOW_FORWARD).click();
fBot.waitUntil(timeGraphIsReadyCondition);
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_OTHER_ENTRY));
// Make sure changing the selection changed the selection in CFV too
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCfv, 0, KWORKER_PROCESS));
// Follow it back up
fViewBotCp.toolbarButton(FOLLOW_BACKWARD).click();
fBot.waitUntil(timeGraphIsReadyCondition);
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_MAIN_ENTRY));
// Make sure changing the selection changed the selection in CFV too
fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCfv, 0, PROCESS));
// Follow another process and make sure the critical path changes
entry = timeGraphCfv.getEntry(trace.getName(), "systemd", "we", PROCESS, PROCESS2);
assertNotNull(entry);
entry.select();
menu = entry.contextMenu("Follow " + PROCESS2 + "/" + TID2);
assertEquals("Follow " + PROCESS2 + "/" + TID2, menu.getText());
menu.click();
fBot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
SWTBotTimeGraphEntry[] entries = timeGraphCp.getEntries();
return CRIT_PATH_MAIN_ENTRY2.equals(entries[0].getEntries()[0].getText());
}
@Override
public String getFailureMessage() {
return "Could not find " + CRIT_PATH_MAIN_ENTRY2 + " in Critical Path view";
}
});
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class KernelTimeGraphViewTestBase method testHorizontalScrollbar.
/**
* Test the horizontal scroll bar position
*/
@Test
public void testHorizontalScrollbar() {
SWTBotView viewBot = openView();
List<? extends @NonNull Slider> sliders = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class));
assertTrue("The view has " + sliders.size() + " sliders", sliders.size() >= 2);
Rectangle sliderRect = getBounds(sliders.get(HORIZONTAL_SCROLLBAR_INDEX));
SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)));
Rectangle timegraphRect = getBounds(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)));
assertEquals("Incorrect horizontal slider start position", timegraphRect.x + tgBot.getNameSpace(), sliderRect.x);
}
use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.
the class ResourcesViewTest method testShowMarkers.
/**
* Test "Show Markers" view menu
*/
@Test
public void testShowMarkers() {
SWTBotView viewBot = getViewBot();
/* set selection to trace start time */
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
/* set focus on time graph */
SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
timeGraph.setFocus();
/* select first item */
timeGraph.getEntry(LttngTraceGenerator.getName()).select();
assertTrue(viewBot.viewMenu(LOST_EVENTS).isChecked());
/* check that "Next Marker" and "Previous Marker" are enabled */
assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
/* disable Lost Events markers */
viewBot.viewMenu(LOST_EVENTS).click();
/* check that "Next Marker" and "Previous Marker" are disabled */
assertFalse(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
assertFalse(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
/* enable Lost Events markers */
viewBot.viewMenu(LOST_EVENTS).click();
/* check that "Next Marker" and "Previous Marker" are enabled */
assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
}
Aggregations