Search in sources :

Example 1 with KernelMemoryUsageView

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView in project tracecompass by tracecompass.

the class KernelMemoryUsageViewTest method testFilter.

/**
 * Test that the filter button works
 */
@Test
public void testFilter() {
    IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
    assertTrue(viewPart instanceof KernelMemoryUsageView);
    final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
    assertNotNull(chartViewer);
    fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
    SWTBotUtils.waitUntil(bot -> bot.tree().getTreeItem(fTraceName).getItems().length == 5, getSWTBotView().bot(), "Failed to load the filtered threads");
    getSWTBotView().toolbarButton("Showing active threads").click();
    SWTBotUtils.waitUntil(bot -> bot.tree().getTreeItem(fTraceName).getItems().length == 16, getSWTBotView().bot(), "Failed to load all the threads");
    getSWTBotView().toolbarButton("Showing all threads").click();
    SWTBotUtils.waitUntil(bot -> bot.tree().getTreeItem(fTraceName).getItems().length == 5, getSWTBotView().bot(), "Failed to filter the threads");
}
Also used : IViewPart(org.eclipse.ui.IViewPart) KernelMemoryUsageView(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView) TmfCommonXAxisChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 2 with KernelMemoryUsageView

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView 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)

Aggregations

KernelMemoryUsageView (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.kernelmemoryusage.KernelMemoryUsageView)2 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)2 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)2 IViewPart (org.eclipse.ui.IViewPart)2 Test (org.junit.Test)2 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 Chart (org.eclipse.swtchart.Chart)1