Search in sources :

Example 26 with TmfWindowRangeUpdatedSignal

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);
}
Also used : TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 27 with TmfWindowRangeUpdatedSignal

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

Example 28 with TmfWindowRangeUpdatedSignal

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();
}
Also used : SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) TmfTraceManager(org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) Test(org.junit.Test)

Example 29 with TmfWindowRangeUpdatedSignal

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

Example 30 with TmfWindowRangeUpdatedSignal

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));
        }
    }
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITimeGraphState(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState) NamedTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) ISelection(org.eclipse.jface.viewers.ISelection) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal) TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) ITmfTraceEditor(org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor)

Aggregations

TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)31 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)25 Test (org.junit.Test)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)9 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)9 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)8 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)7 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)6 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)6 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)5 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)5 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)5 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)5 IViewPart (org.eclipse.ui.IViewPart)5 Point (org.eclipse.swt.graphics.Point)4 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)4 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)4 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)4 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)3 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)2