use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.cpuusage.CpuUsageView in project tracecompass by tracecompass.
the class ResourcesAndCpuViewTest method testCpuView.
/**
* Simple test to check the CPU Usage view after getting signals.
*/
@Test
public void testCpuView() {
IViewPart viewPart = getSWTBotView().getViewReference().getView(true);
assertTrue(viewPart instanceof CpuUsageView);
final TmfCommonXAxisChartViewer chartViewer = (TmfCommonXAxisChartViewer) getChartViewer(viewPart);
assertNotNull(chartViewer);
fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
final Chart chart = getChart();
assertNotNull(chart);
SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available");
chartViewer.setNbPoints(10);
fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
/* Test data model */
SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/cpuusage/cpu-usage-res10.json", "Chart data is not valid");
/* Test chart style */
verifySeriesStyle(TOTAL_SERIES_NAME, ISeries.SeriesType.LINE, BLUE, LineStyle.SOLID, false);
/* Select a thread */
SWTBotTreeItem rootEntry = getSWTBotView().bot().tree().getTreeItem(TRACE_NAME);
SWTBotUtils.waitUntil(tree -> getTableCount() >= 8, rootEntry, "Did not finish loading");
SWTBotTreeItem selectedTheadNode = rootEntry.getNode(SELECTED_THREAD);
selectedTheadNode.check();
SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
/* Test data model */
SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, SELECTED_THREAD_SERIES), "resources/cpuusage/cpu-usage-res10Selected.json", "Chart data is not valid");
/* Test chart style */
verifySeriesStyle(SELECTED_THREAD_SERIES, ISeries.SeriesType.LINE, RED, LineStyle.SOLID, true);
selectedTheadNode.uncheck();
/* Selected an another thread and test in HD */
String otherSelectedThread = "lttng-consumerd";
SWTBotTreeItem otherSelectedThreadNode = rootEntry.getNode(otherSelectedThread);
otherSelectedThreadNode.check();
chartViewer.setNbPoints(100);
SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
/* Test data model */
SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, OTHERTHREAD_SERIES), "resources/cpuusage/cpu-usage-res100Selected.json", "Chart data is not valid");
/* Test chart style */
verifySeriesStyle(OTHERTHREAD_SERIES, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, true);
/*
* Test new TimeRange
*/
chartViewer.setNbPoints(10);
SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
assertNotNull(activeTrace);
fResourcesViewBot.getToolbarButtons().stream().filter(button -> button.getToolTipText().contains(RESET)).findAny().get().click();
fBot.waitUntil(ConditionHelpers.windowRange(new TmfTimeRange(TRACE_START, TRACE_END)));
SWTBotUtils.waitUntil(c -> c.getSeriesSet().getSeries().length >= 2, chart, "Only total available");
fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer));
/* Test data model */
SWTBotUtils.waitUntil(json -> isChartDataValid(chart, json, OTHERTHREAD_SERIES), "resources/cpuusage/cpu-usage-all-res10.json", "Chart data is not valid");
/* Test chart style */
verifySeriesStyle(OTHERTHREAD_SERIES, ISeries.SeriesType.LINE, GREEN, LineStyle.SOLID, true);
}
use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.cpuusage.CpuUsageView 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));
}
Aggregations