Search in sources :

Example 6 with TmfCommonXAxisChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer 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 7 with TmfCommonXAxisChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer in project tracecompass by tracecompass.

the class SystemCallLatencyScatterChartViewTest method testWithTrace.

/**
 * Test to check the System Call Scatter view. When trace opens, there are a few
 * syscalls present, then we move to the zone without system calls, the tree
 * should be empty.
 *
 * TODO: Test the data
 */
@Test
public void testWithTrace() {
    // Wait for analysis to finish.
    WaitUtils.waitForJobs();
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof SystemCallLatencyScatterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    SWTBotUtils.waitUntil(bot -> bot.tree().visibleRowCount() >= 25, getSWTBotView().bot(), "Missing rows, expected 25, was " + getSWTBotView().bot().tree().visibleRowCount());
    SWTBotTreeItem[] items = getSWTBotView().bot().tree().getAllItems();
    for (SWTBotTreeItem item : items) {
        item.check();
    }
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 24, chart, "No data available");
    /* Test type, style and color of series */
    verifyChartStyle();
    // Update the time range to a range where there is no data
    long noDataStart = 1412670961274443542L;
    long noDataEnd = 1412670961298823940L;
    TmfTimeRange windowRange = new TmfTimeRange(TmfTimestamp.fromNanos(noDataStart), TmfTimestamp.fromNanos(noDataEnd));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, windowRange));
    fBot.waitUntil(ConditionHelpers.windowRange(windowRange));
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    // Only the root item should be present
    items = getSWTBotView().bot().tree().getAllItems();
    assertEquals(1, items.length);
}
Also used : IViewPart(org.eclipse.ui.IViewPart) SystemCallLatencyScatterView(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.SystemCallLatencyScatterView) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 8 with TmfCommonXAxisChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer in project tracecompass by tracecompass.

the class MemoryUsageViewTest method testMemoryUsage.

/**
 * Test Memory Usage data model
 */
@Test
public void testMemoryUsage() {
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof UstMemoryUsageView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    checkAllEntries();
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 3, chart, "No data available");
    chartViewer.setNbPoints(50);
    /* Test data model*/
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, FIRST_SERIES_NAME, SECOND_SERIES_NAME, THIRD_SERIES_NAME, FOURTH_SERIES_NAME), "resources/memory-res50.json", "Chart data is not valid");
    /* Test type, style and color of series */
    verifyChartStyle();
}
Also used : IViewPart(org.eclipse.ui.IViewPart) UstMemoryUsageView(org.eclipse.tracecompass.internal.lttng2.ust.ui.views.memusage.UstMemoryUsageView) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 9 with TmfCommonXAxisChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer in project tracecompass by tracecompass.

the class KernelMemoryUsageViewTest method testKernelMemoryView.

/**
 * Simple test to check the Kernel Memory Usage view data model
 */
@Test
public void testKernelMemoryView() {
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof KernelMemoryUsageView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    chartViewer.setNbPoints(NUMBER_OF_POINT);
    SWTBotTree treeBot = getSWTBotView().bot().tree();
    SWTBotTreeItem totalNode = treeBot.getTreeItem(fTraceName);
    SWTBotUtils.waitUntil(root -> root.getItems().length >= 5, totalNode, "Did not finish loading");
    /*
         * Select the total entry, which should be the first entry with an empty pid
         * column.
         */
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "No data available");
    /* Test type, style and color of series */
    verifySeriesStyle(TOTAL_PID, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);
    /* Test data model*/
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/kernelmemory/kernel-memory-res50.json", "Chart data is not valid");
    /*
         * Select a thread
         */
    SWTBotTreeItem sessiondEntry = totalNode.getNode("lttng-sessiond");
    sessiondEntry.check();
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
    /* Test type, style and color of series */
    verifySeriesStyle(SESSIOND_PID, ISeries.SeriesType.LINE, RED, LineStyle.SOLID, false);
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, SESSIOND_PID), "resources/kernelmemory/kernel-memory-res50Selected.json", "Chart data is not valid");
    /*
         * Select an another thread and change zoom
         */
    SWTBotTreeItem consumerdEntry = totalNode.getNode("lttng-consumerd");
    consumerdEntry.check();
    chartViewer.setNbPoints(MORE_POINTS);
    SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 3, chart, "Only total and sessiond available");
    /* Test type, style and color of series */
    verifySeriesStyle(CONSUMERD_PID, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, false);
    SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, CONSUMERD_PID), "resources/kernelmemory/kernel-memory-res100Selected.json", "Chart data is not valid");
}
Also used : IViewPart(org.eclipse.ui.IViewPart) KernelMemoryUsageView(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 10 with TmfCommonXAxisChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer in project tracecompass by tracecompass.

the class NewCounterViewTest method testDisplayingDataSeries.

/**
 * Validate the Counters view data model.
 */
@Test
public void testDisplayingDataSeries() {
    // Setup the chart viewer
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof CounterView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    chartViewer.setNbPoints(NUMBER_OF_POINTS);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    final Chart chart = getChart();
    assertNotNull(chart);
    assertEquals(0, chart.getSeriesSet().getSeries().length);
    // Check the counter entry
    SWTBotTree treeBot = getSWTBotView().bot().tree();
    WaitUtils.waitUntil(tree -> tree.rowCount() >= 1, treeBot, "The tree viewer did not finish loading.");
    SWTBotTreeItem root = treeBot.getTreeItem(TRACE_NAME);
    SWTBotTreeItem counter = retrieveTreeItem(root, COUNTER_NAME);
    assertNotNull(counter);
    counter.check();
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 1, chart, "The data series did not load.");
    // Ensure the data series has the correct styling
    verifySeriesStyle(MAIN_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);
    // Ensure the data model is valid
    WaitUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/minor_faults-res50.json", "The chart data is not valid.");
}
Also used : IViewPart(org.eclipse.ui.IViewPart) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) CounterView(org.eclipse.tracecompass.analysis.counters.ui.views.CounterView) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Aggregations

XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)10 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)10 IViewPart (org.eclipse.ui.IViewPart)10 Test (org.junit.Test)10 Chart (org.eclipse.swtchart.Chart)6 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)6 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)5 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)4 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)3 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)3 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)3 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)3 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)2 CpuUsageView (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.cpuusage.CpuUsageView)2 KernelMemoryUsageView (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView)2 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)2 TmfChartView (org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView)2 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)2 NonNull (org.eclipse.jdt.annotation.NonNull)1 RGB (org.eclipse.swt.graphics.RGB)1