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();
}
Aggregations