Search in sources :

Example 1 with AbstractTimeGraphView

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));
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) IViewPart(org.eclipse.ui.IViewPart) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) CpuUsageView(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.cpuusage.CpuUsageView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 2 with AbstractTimeGraphView

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();
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotTable(org.eclipse.swtbot.swt.finder.widgets.SWTBotTable) SWTBotToolbarDropDownButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) SWTBotTableItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) DefaultCondition(org.eclipse.swtbot.swt.finder.waits.DefaultCondition) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with AbstractTimeGraphView

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;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart)

Example 4 with AbstractTimeGraphView

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()));
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart)

Example 5 with AbstractTimeGraphView

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);
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Aggregations

AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)14 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)11 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)7 Test (org.junit.Test)7 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)6 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)4 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)3 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)3 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)3 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)3 SWTBotTableItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 Before (org.junit.Before)2 File (java.io.File)1 Point (org.eclipse.swt.graphics.Point)1 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)1 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)1 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)1 SWTBotRootMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu)1