Search in sources :

Example 91 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testNewTimestamp.

/**
 * Try selecting a timestamp contained inside the trace's range. The trace's
 * current time should get updated correctly.
 */
@Test
public void testNewTimestamp() {
    openTrace(trace2);
    ITmfTimestamp ts = TmfTimestamp.fromNanos(t2start + ONE_SECOND);
    selectTimestamp(ts);
    TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
    assertEquals(ts, selection.getStartTime());
    assertEquals(ts, selection.getEndTime());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 92 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testTwoTracesTimestampInvalid.

/**
 * Test, with two traces in parallel, when we select a timestamp that is
 * completely out of the trace's range.
 *
 * None of the trace's timestamps should be updated.
 */
@Test
public void testTwoTracesTimestampInvalid() {
    openTrace(trace1);
    openTrace(trace2);
    selectTrace(trace1);
    ITmfTimestamp ts = TmfTimestamp.fromNanos(t2end + ONE_SECOND);
    selectTimestamp(ts);
    /* Timestamp of trace1 should not have changed */
    TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
    assertEquals(trace1.getStartTime(), selection.getStartTime());
    assertEquals(trace1.getStartTime(), selection.getEndTime());
    /* Timestamp of trace2 should not have changed */
    selectTrace(trace2);
    selection = tm.getCurrentTraceContext().getSelectionRange();
    assertEquals(trace2.getStartTime(), selection.getStartTime());
    assertEquals(trace2.getStartTime(), selection.getEndTime());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 93 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class ResourcesViewTest 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), START_TIME);
    SWTBotToolbarButton filterButton = getViewBot().toolbarButton("Show View Filters");
    filterButton.click();
    SWTBot bot = fBot.shell("Filter").activate().bot();
    /*
         * The filtered tree initialization triggers a delayed refresh job that can
         * interfere with the tree selection. Wait for new refresh jobs to avoid this.
         */
    SWTBotTree treeBot = bot.tree();
    // set filter text
    SWTBotTreeItem treeItem = treeBot.getTreeItem(LttngTraceGenerator.getName());
    bot.text().setText("24");
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 2));
    // clear filter text
    bot.text().setText(LttngTraceGenerator.getName());
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 75));
    // get how many items there are
    int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("default", 76, checked);
    // test "uncheck all button"
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    // test check all
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ALL, 76, checked);
    // test uncheck inactive
    treeBot.getTreeItem(LttngTraceGenerator.getName()).select("CPU 1 States");
    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, 75, checked);
    // test uncheck subtree
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 75, checked);
    // test filter
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    bot.text().setText("CPU 2");
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 75));
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("Filtered", 76, checked);
    bot.button("OK").click();
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 94 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange 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)

Example 95 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class ControlFlowViewTest method testDynamicFilteringCpu.

/**
 * Test dynamic filters dialog on CPU
 */
@Test
public void testDynamicFilteringCpu() {
    /* 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);
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length);
    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);
    assertFalse(activeThreadsCheckbox.isChecked());
    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Toggle active thread filter button */
    activeThreadsCheckbox.click();
    assertTrue(activeThreadsCheckbox.isChecked());
    /* Filter on selected CPUs */
    onCpuRadio.click();
    onCpuField.setText("0");
    shell.bot().button(DIALOG_OK).click();
    /*
         * A zoom thread is started after applying the filter. Make sure that the time graph
         * is ready before continuing with the test
         */
    timeGraphIsReadyCondition(range);
    /* Change window range to 50 us */
    range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 1, traceEntry, () -> "Entries size expected:1 actual:" + traceEntry.getEntries().length);
    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);
    assertTrue(activeThreadsCheckbox.isChecked());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertFalse(activeThreadsCheckbox.isChecked());
}
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) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) 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)

Aggregations

TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)168 Test (org.junit.Test)98 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)53 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)24 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)24 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)21 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)19 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)16 Vector (java.util.Vector)13 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)12 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)10 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)9 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)9 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)8 Point (org.eclipse.swt.graphics.Point)7