+ 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);
+ }
+