Search in sources :

Example 1 with TimeGraphEntry

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;
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) ModuleEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) StateSystemEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.StateSystemEntryModel) TimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent) ITimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 2 with TimeGraphEntry

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);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) NonNull(org.eclipse.jdt.annotation.NonNull) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 3 with TimeGraphEntry

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);
            }
        }
    }
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) IElementResolver(org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver) TraceEntry(org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraphView.TraceEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 4 with TimeGraphEntry

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;
}
Also used : TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) Point(org.eclipse.swt.graphics.Point) LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 5 with TimeGraphEntry

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);
}
Also used : TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) Test(org.junit.Test)

Aggregations

TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)70 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)47 Test (org.junit.Test)31 ITimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent)21 TimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent)20 NullTimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent)19 NonNull (org.eclipse.jdt.annotation.NonNull)10 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)8 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)8 ArrayList (java.util.ArrayList)7 SelectionTimeQueryFilter (org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter)6 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)6 Map (java.util.Map)5 ISelection (org.eclipse.jface.viewers.ISelection)5 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)5 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 Action (org.eclipse.jface.action.Action)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ResourcesEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel)4