use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry in project tracecompass by tracecompass.
the class StateSystemPresentationProvider method getStateTableIndex.
@Override
public int getStateTableIndex(ITimeEvent event) {
if (event instanceof TimeEvent) {
TimeEvent timeEvent = (TimeEvent) event;
Object value = timeEvent.getLabel();
if (value != null) {
return Math.floorMod(value.hashCode(), NUM_COLORS);
}
ITimeGraphEntry entry = event.getEntry();
if (entry != null) {
ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();
if (model instanceof StateSystemEntryModel || model instanceof ModuleEntryModel) {
// tooltip
return INVISIBLE;
}
}
// grey
return NUM_COLORS;
}
return INVISIBLE;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry in project tracecompass by tracecompass.
the class AbstractStateSystemTimeGraphView method getRootEntries.
private static List<@NonNull TimeGraphEntry> getRootEntries(List<@NonNull TimeGraphEntry> list) {
Set<@NonNull TimeGraphEntry> roots = new LinkedHashSet<>();
for (@NonNull TimeGraphEntry entry : list) {
TimeGraphEntry root = entry;
while (root.getParent() != null) {
root = root.getParent();
}
roots.add(root);
}
return new ArrayList<>(roots);
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry in project tracecompass by tracecompass.
the class AbstractTimeGraphView method selectionChanged.
/**
* Signal indicating a data model element was selected somewhere
*
* @param signal
* the signal carrying the select data model metadata
* @since 4.2
*/
@TmfSignalHandler
public void selectionChanged(TmfDataModelSelectedSignal signal) {
// Ignore signal from self
if (signal.getSource() == this) {
return;
}
Multimap<@NonNull String, @NonNull Object> metadata = signal.getMetadata();
// See if the current selection intersects the metadata
ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
if (selection instanceof IElementResolver && IElementResolver.commonIntersect(metadata, ((IElementResolver) selection).getMetadata())) {
return;
}
// See if an entry intersects the metadata
List<TimeGraphEntry> traceEntries = getEntryList(getTrace());
if (traceEntries == null) {
return;
}
for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) {
Iterable<TimeGraphEntry> unfiltered = Utils.flatten(traceEntry);
for (TimeGraphEntry entry : unfiltered) {
if (IElementResolver.commonIntersect(metadata, entry.getMetadata())) {
getTimeGraphViewer().setSelection(entry, true);
}
}
}
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry in project tracecompass by tracecompass.
the class AbstractTimeGraphView method getVisibleItems.
/**
* Get the set of items that are currently visible in the view, according to
* the visible area height, the vertical scroll position and the expanded
* state of the items. A buffer of items above and below can be included.
*
* @param buffer
* number of items above and below the current visible area that
* should be included
* @return a set of visible items in the view with buffer above and below
* @since 4.2
*/
@NonNull
protected Set<@NonNull TimeGraphEntry> getVisibleItems(int buffer) {
TimeGraphControl timeGraphControl = fTimeGraphViewer.getTimeGraphControl();
if (timeGraphControl.isDisposed()) {
return Collections.emptySet();
}
int start = Integer.max(0, fTimeGraphViewer.getTopIndex() - buffer);
int end = Integer.min(fTimeGraphViewer.getExpandedElementCount() - 1, fTimeGraphViewer.getTopIndex() + timeGraphControl.countPerPage() + buffer);
Set<@NonNull TimeGraphEntry> visible = new HashSet<>(end - start + 1);
for (int i = start; i <= end; i++) {
/*
* Use the getExpandedElement by index to avoid creating a copy of all the the
* elements.
*/
TimeGraphEntry element = (TimeGraphEntry) timeGraphControl.getExpandedElement(i);
if (element != null) {
visible.add(element);
}
}
return visible;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry in project tracecompass by tracecompass.
the class ControlFlowEntryComparatorTest method birthTimeSecondaryTimeColumnComparatorTest.
/**
* Test {@link ControlFlowColumnComparators#BIRTH_TIME_COLUMN_COMPARATOR}
*
* Note, that when when birth time is the same: The order for that is
* process name, TID and PTID. Note that for secondary comparators the
* sort direction is not changed.
*/
@Test
public void birthTimeSecondaryTimeColumnComparatorTest() {
TimeGraphEntry trace1Entry1 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID1, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
TimeGraphEntry trace1Entry2 = generateCFVEntry(0, TRACE_EXEC_NAME2, TRACE_TID1, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
TimeGraphEntry trace1Entry3 = generateCFVEntry(0, TRACE_EXEC_NAME3, TRACE_TID1, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
List<TimeGraphEntry> testVec = Arrays.asList(trace1Entry2, trace1Entry3, trace1Entry1);
List<TimeGraphEntry> expectedDown = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
List<TimeGraphEntry> expectedUp = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
runTest(ControlFlowColumnComparators.BIRTH_TIME_COLUMN_COMPARATOR, testVec, expectedDown, expectedUp);
trace1Entry1 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID1, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
trace1Entry2 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID2, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
trace1Entry3 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID2, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
testVec = Arrays.asList(trace1Entry2, trace1Entry3, trace1Entry1);
expectedDown = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
expectedUp = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
runTest(ControlFlowColumnComparators.BIRTH_TIME_COLUMN_COMPARATOR, testVec, expectedDown, expectedUp);
trace1Entry1 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID1, TRACE_PTID1, TRACE_START_TIME1, TRACE_END_TIME);
trace1Entry2 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID1, TRACE_PTID2, TRACE_START_TIME1, TRACE_END_TIME);
trace1Entry3 = generateCFVEntry(0, TRACE_EXEC_NAME1, TRACE_TID1, TRACE_PTID3, TRACE_START_TIME1, TRACE_END_TIME);
testVec = Arrays.asList(trace1Entry2, trace1Entry3, trace1Entry1);
expectedDown = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
expectedUp = Arrays.asList(trace1Entry1, trace1Entry2, trace1Entry3);
runTest(ControlFlowColumnComparators.BIRTH_TIME_COLUMN_COMPARATOR, testVec, expectedDown, expectedUp);
}
Aggregations