use of org.eclipse.tracecompass.tmf.core.response.ITmfResponse.Status in project tracecompass by tracecompass.
the class XmlTimeGraphDataProvider method fetchTree.
@Override
public TmfModelResponse<TmfTreeModel<@NonNull XmlTimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
@NonNull List<@NonNull XmlTimeGraphEntryModel> entryList = new ArrayList<>();
boolean isComplete = true;
String traceName = String.valueOf(getTrace().getName());
for (ITmfStateSystem ss : fSs) {
isComplete &= ss.waitUntilBuilt(0);
/* Don't query empty state system */
if (ss.getNbAttributes() > 0 && ss.getStartTime() != Long.MIN_VALUE) {
long start = ss.getStartTime();
long end = ss.getCurrentEndTime();
long id = fBaseQuarkToId.row(ss).computeIfAbsent(ITmfStateSystem.ROOT_ATTRIBUTE, s -> sfAtomicId.getAndIncrement());
Builder ssEntry = new Builder(id, -1, Collections.singletonList(traceName), start, end, null, ss, ITmfStateSystem.ROOT_ATTRIBUTE, fCompilationData);
entryList.add(ssEntry.build());
for (Element entry : fEntries) {
buildEntry(ss, entry, ssEntry, -1, StringUtils.EMPTY, end, entryList);
}
}
}
Status status = isComplete ? Status.COMPLETED : Status.RUNNING;
String msg = isComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING;
return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), entryList), status, msg);
}
use of org.eclipse.tracecompass.tmf.core.response.ITmfResponse.Status in project tracecompass by tracecompass.
the class StateSystemDataProvider method fetchTree.
@Override
@NonNull
public TmfModelResponse<TmfTreeModel<TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
// need to create the tree
boolean fetchTreeIsComplete;
synchronized (fEntryBuilder) {
fModuleEntryModelList.clear();
fetchTreeIsComplete = addTrace(monitor);
if (monitor != null && monitor.isCanceled()) {
return new TmfModelResponse<>(null, Status.CANCELLED, CommonStatusMessage.TASK_CANCELLED);
}
}
List<TimeGraphEntryModel> entryList = buildEntryList(monitor);
Status status = fetchTreeIsComplete ? Status.COMPLETED : Status.RUNNING;
String msg = fetchTreeIsComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING;
return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), entryList), status, msg);
}
use of org.eclipse.tracecompass.tmf.core.response.ITmfResponse.Status in project tracecompass by tracecompass.
the class ExampleTimeGraphDataProvider method fetchTree.
@Override
public TmfModelResponse<TmfTreeModel<@NonNull ITimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
fModule.waitForInitialization();
ITmfStateSystem ss = fModule.getStateSystem();
if (ss == null) {
return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.ANALYSIS_INITIALIZATION_FAILED);
}
boolean isComplete = ss.waitUntilBuilt(0);
long endTime = ss.getCurrentEndTime();
// Make an entry for each base quark
List<ITimeGraphEntryModel> entryList = new ArrayList<>();
for (Integer quark : ss.getQuarks("CPUs", "*")) {
// $NON-NLS-1$ //$NON-NLS-2$
Long id = fIDToDisplayQuark.inverse().computeIfAbsent(quark, q -> sfAtomicId.getAndIncrement());
entryList.add(new TimeGraphEntryModel(id, -1, ss.getAttributeName(quark), ss.getStartTime(), endTime));
}
Status status = isComplete ? Status.COMPLETED : Status.RUNNING;
String msg = isComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING;
return new TmfModelResponse<>(new TmfTreeModel<>(Collections.emptyList(), entryList), status, msg);
}
use of org.eclipse.tracecompass.tmf.core.response.ITmfResponse.Status in project tracecompass by tracecompass.
the class DataDrivenTimeGraphDataProvider method fetchTree.
@Override
public final TmfModelResponse<TmfTreeModel<@NonNull TimeGraphEntryModel>> fetchTree(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
List<TimeGraphEntryModel> entryList = new ArrayList<>();
boolean isComplete = true;
String traceName = String.valueOf(getTrace().getName());
for (ITmfStateSystem ss : fSs) {
isComplete &= ss.waitUntilBuilt(0);
/* Don't query empty state system */
if (ss.getNbAttributes() > 0 && ss.getStartTime() != Long.MIN_VALUE) {
long start = ss.getStartTime();
long end = ss.getCurrentEndTime();
long id = fBaseQuarkToId.row(ss).computeIfAbsent(ITmfStateSystem.ROOT_ATTRIBUTE, s -> sfAtomicId.getAndIncrement());
TimeGraphEntryModel ssEntry = new TimeGraphEntryModel(id, -1, traceName, start, end);
entryList.add(ssEntry);
for (DataDrivenOutputEntry entry : fEntries) {
entryList.addAll(entry.buildEntries(ss, ssEntry.getId(), getTrace(), -1, StringUtils.EMPTY, end, fIdGenerator, fQuarkCallback));
}
}
}
Status status = isComplete ? Status.COMPLETED : Status.RUNNING;
String msg = isComplete ? CommonStatusMessage.COMPLETED : CommonStatusMessage.RUNNING;
TmfTreeModel<@NonNull TimeGraphEntryModel> tree = new TmfTreeModel<>(Collections.emptyList(), entryList);
return new TmfModelResponse<>(tree, status, msg);
}
Aggregations