Search in sources :

Example 16 with TimeGraphModel

use of org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphModel in project tracecompass by tracecompass.

the class BaseDataProviderTimeGraphView method zoomEntries.

@Override
protected void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, boolean fullSearch, @NonNull IProgressMonitor monitor) {
    if (resolution < 0) {
        // StateSystemUtils.getTimes would throw an illegal argument exception.
        return;
    }
    long start = Long.min(zoomStartTime, zoomEndTime);
    long end = Long.max(zoomStartTime, zoomEndTime);
    Sampling sampling = new Sampling(start, end, resolution);
    Multimap<ITimeGraphDataProvider<? extends TimeGraphEntryModel>, Long> providersToModelIds = filterGroupEntries(entries, zoomStartTime, zoomEndTime);
    // $NON-NLS-1$
    SubMonitor subMonitor = SubMonitor.convert(monitor, getClass().getSimpleName() + "#zoomEntries", providersToModelIds.size());
    for (Entry<ITimeGraphDataProvider<? extends TimeGraphEntryModel>, Collection<Long>> entry : providersToModelIds.asMap().entrySet()) {
        ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = entry.getKey();
        Map<@NonNull String, @NonNull Object> parameters = getFetchRowModelParameters(start, end, resolution, fullSearch, entry.getValue());
        TmfModelResponse<TimeGraphModel> response = dataProvider.fetchRowModel(parameters, monitor);
        TimeGraphModel model = response.getModel();
        if (model != null) {
            zoomEntries(fEntries.row(dataProvider), model.getRows(), response.getStatus() == ITmfResponse.Status.COMPLETED, sampling);
        }
        subMonitor.worked(1);
    }
}
Also used : ITimeGraphDataProvider(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider) TimeGraphModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphModel) SubMonitor(org.eclipse.core.runtime.SubMonitor) TimeGraphEntryModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel) Collection(java.util.Collection) Sampling(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry.Sampling)

Aggregations

TimeGraphModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphModel)16 SelectionTimeQueryFilter (org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter)12 ITimeGraphRowModel (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphRowModel)12 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)10 ArrayList (java.util.ArrayList)9 NonNull (org.eclipse.jdt.annotation.NonNull)9 HashMap (java.util.HashMap)7 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)7 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)6 StateSystemDisposedException (org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException)6 Map (java.util.Map)5 AtomicLong (java.util.concurrent.atomic.AtomicLong)5 TimeRangeException (org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException)5 TimeGraphRowModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphRowModel)5 List (java.util.List)4 Predicate (java.util.function.Predicate)4 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)4 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)4 LinkedHashMap (java.util.LinkedHashMap)3 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)3