Search in sources :

Example 1 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal 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));
    }
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) LamiTimeRange(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 2 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ControlFlowViewTest method testDynamicFiltersDialog.

/**
 * Test dynamic filters dialog
 */
@Test
public void testDynamicFiltersDialog() {
    String valid_cpu_ranges = "0,1,2-100";
    String invalid_cpu_ranges = "-1,1";
    /* 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));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    SWTBotShell shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    /* Make sure nothing is checked and radio buttons are disabled */
    SWTBotCheckBox activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotRadio allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    assertFalse(activeThreadsCheckbox.isChecked());
    assertFalse(onCpuRadio.isEnabled());
    assertFalse(allActiveRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    /*
         * The All Active Threads option should be the default for a new filter
         */
    assertTrue(allActiveRadio.isSelected());
    /*
         * Select All Threads on CPUs option
         */
    onCpuRadio.click();
    /* All objects should be enabled */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    /*
         * Select All Active Threads then Active Threads on CPUs to validate
         * toggle of options
         */
    allActiveRadio.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    assertTrue(allActiveRadio.isSelected());
    assertFalse(onCpuRadio.isSelected());
    /* Select Active Threads on CPUs */
    onCpuRadio.click();
    /* All objects should be enabled */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    /* Put an invalid value in the CPU ranges field */
    onCpuField.setText(invalid_cpu_ranges);
    /* Make sure the OK button is not enabled when in an invalid state */
    assertFalse(shell.bot().button(DIALOG_OK).isEnabled());
    /* Put a valid value in the CPU ranges field */
    onCpuField.setText(valid_cpu_ranges);
    /* Make sure the OK button is enabled when in a valid state */
    assertTrue(shell.bot().button(DIALOG_OK).isEnabled());
    shell.bot().button(DIALOG_OK).click();
    timeGraphIsReadyCondition(range);
    /* Make sure that the quick Active Thread Filter toggle is checked */
    assertTrue(getViewBot().viewMenu(DYNAMIC_FILTER_ACTIVE_THREADS_ONLY_TOGGLE).isChecked());
    /* Make sure that the Flat presentation is checked */
    assertTrue(getViewBot().viewMenu(THREAD_PRESENTATION_FLAT).isChecked());
    assertFalse(getViewBot().viewMenu(THREAD_PRESENTATION_HIERARCHICAL).isChecked());
    /* Reopen the dialog */
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    /* Make sure nothing is checked and radio buttons are disabled */
    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Make sure the previous settings are set correctly */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertTrue(onCpuField.isEnabled());
    assertFalse(allActiveRadio.isSelected());
    assertTrue(onCpuRadio.isSelected());
    assertTrue(onCpuField.isEnabled());
    assertEquals("CPU ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    /*
         * Change to All Active Threads option click OK then reopen. The
         * previous CPU range should still be there.
         */
    allActiveRadio.click();
    /* Make sure that the ranges are still visible but disabled */
    assertFalse(onCpuField.isEnabled());
    assertEquals("Cpu ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    /* Close the dialog */
    shell.bot().button(DIALOG_OK).click();
    timeGraphIsReadyCondition(range);
    /* Open the dialog */
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    allActiveRadio = shell.bot().radio(DYNAMIC_FILTERS_ALL_ACTIVE_RADIO);
    onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Range field should have a value in it */
    assertTrue(activeThreadsCheckbox.isChecked());
    assertTrue(allActiveRadio.isEnabled());
    assertTrue(onCpuRadio.isEnabled());
    assertFalse(onCpuField.isEnabled());
    assertTrue(allActiveRadio.isSelected());
    assertFalse(onCpuRadio.isSelected());
    assertFalse(onCpuField.isEnabled());
    assertEquals("CPU ranges not equal", onCpuField.getText(), valid_cpu_ranges);
    shell.bot().button(DIALOG_CANCEL).click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotCheckBox(org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 3 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal 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));
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 4 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal 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";
        }
    });
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) IOException(java.io.IOException) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) DefaultCondition(org.eclipse.swtbot.swt.finder.waits.DefaultCondition) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) ICondition(org.eclipse.swtbot.swt.finder.waits.ICondition) Test(org.junit.Test)

Example 5 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ImportAndReadKernelSmokeTest method testHV.

private void testHV(IViewPart vp) {
    SWTBotView hvBot = (new SWTWorkbenchBot()).viewById(HistogramView.ID);
    List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
    for (SWTBotToolbarButton hvTool : hvTools) {
        if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
            hvTool.click();
        }
    }
    HistogramView hv = (HistogramView) vp;
    final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(hv, fDesired1.getTimestamp());
    final TmfSelectionRangeUpdatedSignal signal2 = new TmfSelectionRangeUpdatedSignal(hv, fDesired2.getTimestamp());
    hvBot.close();
    hv = (HistogramView) UIThreadRunnable.syncExec(() -> {
        try {
            return (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(HistogramView.ID));
        } catch (PartInitException e) {
        // Do nothing, returning null fails
        }
        return null;
    });
    assertNotNull(hv);
    hvBot = (new SWTWorkbenchBot()).viewById(HistogramView.ID);
    hv.updateTimeRange(100000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal);
    hv.broadcast(signal);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    hv.updateTimeRange(1000000000);
    WaitUtils.waitForJobs();
    hv.selectionRangeUpdated(signal2);
    hv.broadcast(signal2);
    WaitUtils.waitForJobs();
    SWTBotUtils.delay(1000);
    assertNotNull(hv);
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) PartInitException(org.eclipse.ui.PartInitException) HistogramView(org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)

Aggregations

TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)41 Test (org.junit.Test)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)18 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)11 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)11 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)11 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)9 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)5 Action (org.eclipse.jface.action.Action)4 IAction (org.eclipse.jface.action.IAction)4 Point (org.eclipse.swt.graphics.Point)3 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ISelection (org.eclipse.jface.viewers.ISelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)2 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)2 SWTBotCheckBox (org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox)2 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)2