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