Search in sources :

Example 1 with SelectedCounterQueryFilter

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

the class CounterDataProvider method internalFetch.

@Nullable
private Collection<IYModel> internalFetch(ITmfStateSystem ss, Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException {
    SelectedCounterQueryFilter filter = createCounterQuery(fetchParameters);
    if (filter == null) {
        return null;
    }
    long stateSystemEndTime = ss.getCurrentEndTime();
    Collection<Long> times = extractRequestedTimes(ss, filter, stateSystemEndTime);
    Map<Long, Integer> entries = Maps.filterValues(getSelectedEntries(filter), q -> ss.getSubAttributes(q, false).isEmpty());
    TreeMultimap<Integer, ITmfStateInterval> countersIntervals = TreeMultimap.create(Comparator.naturalOrder(), Comparator.comparingLong(ITmfStateInterval::getStartTime));
    Iterable<@NonNull ITmfStateInterval> query2d = ss.query2D(entries.values(), times);
    for (ITmfStateInterval interval : query2d) {
        if (monitor != null && monitor.isCanceled()) {
            return null;
        }
        countersIntervals.put(interval.getAttribute(), interval);
    }
    ImmutableList.Builder<IYModel> ySeries = ImmutableList.builder();
    for (Entry<Long, Integer> entry : entries.entrySet()) {
        if (monitor != null && monitor.isCanceled()) {
            return null;
        }
        int quark = entry.getValue();
        double[] yValues = buildYValues(countersIntervals.get(quark), filter);
        String seriesName = getTrace().getName() + '/' + ss.getFullAttributePath(quark);
        ySeries.add(new YModel(entry.getKey(), seriesName, yValues));
    }
    return ySeries.build();
}
Also used : YModel(org.eclipse.tracecompass.tmf.core.model.YModel) IYModel(org.eclipse.tracecompass.tmf.core.model.xy.IYModel) ImmutableList(com.google.common.collect.ImmutableList) ITmfStateInterval(org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval) SelectedCounterQueryFilter(org.eclipse.tracecompass.tmf.core.model.filters.SelectedCounterQueryFilter) IYModel(org.eclipse.tracecompass.tmf.core.model.xy.IYModel) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)1 YModel (org.eclipse.tracecompass.tmf.core.model.YModel)1 SelectedCounterQueryFilter (org.eclipse.tracecompass.tmf.core.model.filters.SelectedCounterQueryFilter)1 IYModel (org.eclipse.tracecompass.tmf.core.model.xy.IYModel)1