import org.eclipse.tracecompass.analysis.graph.core.base.TmfEdge.EdgeType;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfVertex;
+import org.eclipse.tracecompass.analysis.graph.core.building.TmfGraphBuilderModule;
import org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraphStatistics;
fRootList.put(owner, entry);
}
- @Override
- public void visit(TmfVertex node) {
- setStartTime(Math.min(getStartTime(), node.getTs()));
- setEndTime(Math.max(getEndTime(), node.getTs()));
- }
-
@Override
public void visit(TmfEdge link, boolean horizontal) {
if (horizontal) {
}
module.schedule();
if (module.waitForCompletion(fMonitor)) {
+ // Module is completed, set the start and end time of
+ // this view
+ setStartEndTime(module);
refresh();
}
private ITimeGraphEntry[] getWorkerEntries(IGraphWorker worker) {
fCurrentObject = worker;
List<TimeGraphEntry> entries = workerEntries.get(worker);
+ ITmfTrace trace = getTrace();
if (entries == null) {
buildEntryList(worker);
entries = workerEntries.get(worker);
+ } else if (trace != null) {
+ // Get the statistics object for this worker
+ TmfGraphStatistics stats = fObjectStatistics.get(trace, worker);
+ if (stats == null) {
+ stats = new TmfGraphStatistics();
+ final TmfGraph graph = getGraph(trace);
+ if (graph != null) {
+ stats.computeGraphStatistics(graph, worker);
+ }
+ }
+ fStats = stats;
}
return (entries == null) ?
if (graph == null) {
return;
}
- setStartTime(Long.MAX_VALUE);
- setEndTime(Long.MIN_VALUE);
final HashMap<Object, CriticalPathEntry> rootList = new HashMap<>();
fLinks.remove(trace, worker);
throw new IllegalStateException("Trace is null"); //$NON-NLS-1$
}
IGraphWorker worker = (IGraphWorker) obj;
- TmfGraphStatistics stats = fObjectStatistics.get(trace, worker);
- if (stats == null) {
- stats = new TmfGraphStatistics();
- fObjectStatistics.put(trace, worker, stats);
- }
- fStats = stats;
TimeGraphEntry tge = new CriticalPathBaseEntry(worker);
List<TimeGraphEntry> list = Collections.singletonList(tge);
refresh();
}
+ private void setStartEndTime(CriticalPathModule module) {
+ // Initialize the start/end time of the view to trace's times
+ ITmfTrace trace = getTrace();
+ if (trace == null) {
+ throw new IllegalStateException("The trace should not be null when we have a critical path to display"); //$NON-NLS-1$
+ }
+ long start = trace.getStartTime().toNanos();
+ long end = trace.getEndTime().toNanos();
+
+ // Set the start/end time of the view
+ Object paramGraph = module.getParameter(CriticalPathModule.PARAM_GRAPH);
+ if (paramGraph instanceof TmfGraphBuilderModule) {
+ TmfGraphBuilderModule graphModule = (TmfGraphBuilderModule) paramGraph;
+ TmfGraph graph = graphModule.getGraph();
+ if (graph == null) {
+ return;
+ }
+ TmfVertex head = graph.getHead();
+ if (head != null) {
+ start = Math.min(start, head.getTs());
+ for (IGraphWorker w : graph.getWorkers()) {
+ TmfVertex tail = graph.getTail(w);
+ if (tail != null) {
+ end = Math.max(end, tail.getTs());
+ }
+ }
+ }
+ }
+ setStartTime(start);
+ setEndTime(end);
+ }
+
}