Search in sources :

Example 26 with SelectionTimeQueryFilter

use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.

the class TmfFilteredXYChartViewer method createQueryParameters.

@Override
@NonNull
protected Map<String, Object> createQueryParameters(long start, long end, int nb) {
    Map<@NonNull String, @NonNull Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(start, end, nb, fSelectedIds));
    Multimap<@NonNull Integer, @NonNull String> regexesMap = getRegexes();
    if (!regexesMap.isEmpty()) {
        parameters.put(DataProviderParameterUtils.REGEX_MAP_FILTERS_KEY, regexesMap.asMap());
    }
    return parameters;
}
Also used : SelectionTimeQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 27 with SelectionTimeQueryFilter

use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.

the class CounterChartViewer method createQueryParameters.

@Override
@NonNull
protected Map<String, Object> createQueryParameters(long start, long end, int nb) {
    Map<@NonNull String, @NonNull Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(start, end, nb, getSelected()));
    parameters.put(CounterDataProvider.CUMULATIVE_COUNTER_KEY, fIsCumulative);
    return parameters;
}
Also used : SelectionTimeQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 28 with SelectionTimeQueryFilter

use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.

the class CriticalPathDataProvider method fetchRowModel.

@Override
@NonNull
public TmfModelResponse<@NonNull TimeGraphModel> fetchRowModel(@NonNull Map<@NonNull String, @NonNull Object> fetchParameters, @Nullable IProgressMonitor monitor) {
    IGraphWorker graphWorker = getCurrent();
    if (graphWorker == null) {
        return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED);
    }
    CriticalPathVisitor visitor = fHorizontalVisitorCache.getIfPresent(graphWorker);
    if (visitor == null) {
        return new TmfModelResponse<>(null, Status.COMPLETED, CommonStatusMessage.COMPLETED);
    }
    // TODO server: Parameters validation should be handle separately. It
    // can be either in the data provider itself or before calling it. It
    // will avoid the creation of filters and the content of the map can be
    // use directly.
    SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters);
    if (filter == null) {
        return new TmfModelResponse<>(null, Status.FAILED, CommonStatusMessage.INCORRECT_QUERY_PARAMETERS);
    }
    Map<@NonNull Integer, @NonNull Predicate<@NonNull Multimap<@NonNull String, @NonNull Object>>> predicates = new HashMap<>();
    Multimap<@NonNull Integer, @NonNull String> regexesMap = DataProviderParameterUtils.extractRegexFilter(fetchParameters);
    if (regexesMap != null) {
        predicates.putAll(computeRegexPredicate(regexesMap));
    }
    List<@NonNull ITimeGraphRowModel> rowModels = new ArrayList<>();
    for (Long id : filter.getSelectedItems()) {
        /*
             * need to use asMap, so that we don't return a row for an ID that does not
             * belong to this provider, else fStates.get(id) might return an empty
             * collection for an id from another data provider.
             */
        Collection<ITimeGraphState> states = visitor.fStates.asMap().get(id);
        if (states != null) {
            List<ITimeGraphState> filteredStates = new ArrayList<>();
            for (ITimeGraphState state : states) {
                if (overlaps(state.getStartTime(), state.getDuration(), filter.getTimesRequested())) {
                    // Reset the properties for this state before filtering
                    state.setActiveProperties(0);
                    applyFilterAndAddState(filteredStates, state, id, predicates, monitor);
                }
            }
            rowModels.add(new TimeGraphRowModel(id, filteredStates));
        }
    }
    return new TmfModelResponse<>(new TimeGraphModel(rowModels), Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) TimeGraphModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphModel) IGraphWorker(org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker) ArrayList(java.util.ArrayList) TmfModelResponse(org.eclipse.tracecompass.tmf.core.response.TmfModelResponse) ITimeGraphRowModel(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphRowModel) TimeGraphRowModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphRowModel) Predicate(java.util.function.Predicate) ITimeGraphState(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState) ITimeGraphRowModel(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphRowModel) SelectionTimeQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter) NonNull(org.eclipse.jdt.annotation.NonNull) AtomicLong(java.util.concurrent.atomic.AtomicLong) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 29 with SelectionTimeQueryFilter

use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.

the class ResourcesStatusDataProvider method getFilterData.

@Override
@NonNull
public Multimap<@NonNull String, @NonNull Object> getFilterData(long entryId, long time, @Nullable IProgressMonitor monitor) {
    Multimap<@NonNull String, @NonNull Object> data = HashMultimap.create();
    data.putAll(super.getFilterData(entryId, time, monitor));
    SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(Collections.singletonList(time), Collections.singleton(Objects.requireNonNull(entryId)));
    TmfModelResponse<Map<String, String>> response = fetchTooltip(FetchParametersUtils.selectionTimeQueryToMap(filter), monitor);
    Map<@NonNull String, @NonNull String> model = response.getModel();
    if (model != null) {
        for (Entry<String, String> entry : model.entrySet()) {
            data.put(entry.getKey(), entry.getValue());
        }
    }
    return data;
}
Also used : SelectionTimeQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter) Map(java.util.Map) BiMap(com.google.common.collect.BiMap) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HashBiMap(com.google.common.collect.HashBiMap) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 30 with SelectionTimeQueryFilter

use of org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter in project tracecompass by tracecompass.

the class ControlFlowPresentationProvider method getEventHoverToolTipInfo.

@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) {
    Map<String, String> retMap = super.getEventHoverToolTipInfo(event, hoverTime);
    if (retMap == null) {
        retMap = new LinkedHashMap<>(1);
    }
    ThreadEntryModel entryModel = ControlFlowView.getThreadEntryModel(event.getEntry());
    if (!(event instanceof TimeEvent) || !((TimeEvent) event).hasValue() || entryModel == null) {
        return retMap;
    }
    ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = BaseDataProviderTimeGraphView.getProvider((TimeGraphEntry) event.getEntry());
    TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = dataProvider.fetchTooltip(FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(hoverTime, hoverTime, 1, Collections.singletonList(entryModel.getId()))), null);
    Map<@NonNull String, @NonNull String> tooltipModel = response.getModel();
    if (tooltipModel != null) {
        retMap.putAll(tooltipModel);
    }
    return retMap;
}
Also used : SelectionTimeQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter) NonNull(org.eclipse.jdt.annotation.NonNull) ThreadEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.threadstatus.ThreadEntryModel) NullTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent) NamedTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent) TimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent) ITimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

SelectionTimeQueryFilter (org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter)37 NonNull (org.eclipse.jdt.annotation.NonNull)21 HashMap (java.util.HashMap)13 TimeGraphModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphModel)12 ITimeGraphRowModel (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphRowModel)10 ArrayList (java.util.ArrayList)9 LinkedHashMap (java.util.LinkedHashMap)9 Map (java.util.Map)9 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)9 AtomicLong (java.util.concurrent.atomic.AtomicLong)8 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)7 StateSystemDisposedException (org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException)7 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)7 IYModel (org.eclipse.tracecompass.tmf.core.model.xy.IYModel)7 Nullable (org.eclipse.jdt.annotation.Nullable)6 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)6 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)6 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)6 ImmutableList (com.google.common.collect.ImmutableList)5 YModel (org.eclipse.tracecompass.tmf.core.model.YModel)5