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));
}
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);
}
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();
}
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");
}
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.");
}
Aggregations