use of org.eclipse.tracecompass.analysis.counters.core.CounterAnalysis in project tracecompass by tracecompass.
the class CounterDataProviderFactory method createProvider.
/**
* @since 2.0
*/
@Override
@Nullable
public ITmfTreeXYDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace) {
Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(trace);
if (traces.size() == 1) {
List<ITmfTreeXYDataProvider<TmfTreeDataModel>> dataProviders = new ArrayList<>();
for (CounterAnalysis module : TmfTraceUtils.getAnalysisModulesOfClass(trace, CounterAnalysis.class)) {
ITmfTrace subTrace = module.getTrace();
ITmfTreeXYDataProvider<TmfTreeDataModel> provider = CounterDataProvider.create(Objects.requireNonNull(subTrace), module);
if (provider != null) {
dataProviders.add(provider);
}
}
if (dataProviders.isEmpty()) {
return null;
} else if (dataProviders.size() == 1) {
return dataProviders.get(0);
}
return new TmfTreeXYCompositeDataProvider<>(dataProviders, TITLE, CounterDataProvider.ID);
}
return TmfTreeXYCompositeDataProvider.create(traces, TITLE, CounterDataProvider.ID);
}
Aggregations