Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.1.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.analysis.graph.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.analysis.graph.core.Activator
<parameter
name="algorithm">
</parameter>
- <tracetype
- class="org.eclipse.tracecompass.tmf.core.trace.TmfTrace">
- </tracetype>
</module>
</extension>
</plugin>
package org.eclipse.tracecompass.analysis.graph.core.building;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
+import org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule;
+import org.eclipse.tracecompass.analysis.graph.core.criticalpath.ICriticalPathProvider;
import org.eclipse.tracecompass.internal.analysis.graph.core.Activator;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
/**
* Base class for all modules building graphs
* @author Francis Giraldeau
* @author Geneviève Bastien
*/
-public abstract class TmfGraphBuilderModule extends TmfAbstractAnalysisModule {
+public abstract class TmfGraphBuilderModule extends TmfAbstractAnalysisModule implements ICriticalPathProvider {
private @Nullable TmfGraph fGraph;
private @Nullable ITmfEventRequest fRequest;
+ private final CriticalPathModule fCriticalPathModule = new CriticalPathModule();
/**
* Gets the graph provider to build this graph
return !monitor.isCanceled();
}
+ @Override
+ public boolean setTrace(@NonNull ITmfTrace trace) throws TmfAnalysisException {
+ boolean ret = super.setTrace(trace);
+ if (!ret) {
+ return ret;
+ }
+ ret = fCriticalPathModule.setTrace(trace);
+ if (ret) {
+ fCriticalPathModule.setParameter(CriticalPathModule.PARAM_GRAPH, getId());
+ }
+ return ret;
+ }
+
@Override
protected void canceling() {
ITmfEventRequest req = fRequest;
}
}
+ @Override
+ public void dispose() {
+ fCriticalPathModule.dispose();
+ super.dispose();
+ }
+
// ------------------------------------------------------------------------
// Graph creation methods
// ------------------------------------------------------------------------
}
+ /**
+ * @since 1.1
+ */
+ @Override
+ public @Nullable TmfGraph getCriticalPath() {
+ return fCriticalPathModule.getCriticalPath();
+ }
+
}
* @author Francis Giraldeau
* @author Geneviève Bastien
*/
-public class CriticalPathModule extends TmfAbstractAnalysisModule {
+public class CriticalPathModule extends TmfAbstractAnalysisModule implements ICriticalPathProvider {
/**
* Analysis ID for this module
*/
public CriticalPathModule() {
super();
+ addParameter(PARAM_GRAPH);
+ addParameter(PARAM_WORKER);
+ setId(ANALYSIS_ID);
}
@Override
*
* @return The critical path graph
*/
+ @Override
public @Nullable TmfGraph getCriticalPath() {
return fCriticalPath;
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.graph.core.criticalpath;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
+
+/**
+ * @author Geneviève Bastien
+ * @since 1.1
+ */
+public interface ICriticalPathProvider {
+
+ /**
+ * Get the critical path
+ *
+ * @return The critical path
+ */
+ public @Nullable TmfGraph getCriticalPath();
+
+}
class="org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule">
</analysisModuleClass>
</output>
+ <listener
+ class="org.eclipse.tracecompass.internal.analysis.graph.ui.criticalpath.view.CriticalPathModuleListener">
+ </listener>
</extension>
</plugin>
package org.eclipse.tracecompass.internal.analysis.graph.ui.criticalpath.view;
import org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker;
+import org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
/**
public class CriticalPathBaseEntry extends TimeGraphEntry {
private final IGraphWorker fWorker;
+ private final CriticalPathModule fModule;
/**
* Constructor
*
* @param worker
* The worker associated with this entry
+ * @param module
+ * The critical path module associated with this entry
*/
- public CriticalPathBaseEntry(IGraphWorker worker) {
+ public CriticalPathBaseEntry(IGraphWorker worker, CriticalPathModule module) {
super("Base entry", Long.MIN_VALUE, Long.MAX_VALUE); //$NON-NLS-1$
fWorker = worker;
+ fModule = module;
}
/**
return fWorker;
}
+ /**
+ * Get the critical path module associated with this entry
+ *
+ * @return The critical path module
+ */
+ public CriticalPathModule getModule() {
+ return fModule;
+ }
+
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2017 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.analysis.graph.ui.criticalpath.view;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.analysis.graph.core.building.TmfGraphBuilderModule;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.analysis.ITmfNewAnalysisModuleListener;
+import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
+
+/**
+ * @author Geneviève Bastien
+ */
+public class CriticalPathModuleListener implements ITmfNewAnalysisModuleListener {
+
+ /**
+ * Constructor
+ */
+ public CriticalPathModuleListener() {
+
+ }
+
+ @Override
+ public void moduleCreated(@Nullable IAnalysisModule module) {
+ if (module instanceof TmfGraphBuilderModule) {
+ module.registerOutput(new TmfAnalysisViewOutput(CriticalPathView.ID, module.getId()));
+ }
+ }
+
+}
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.analysis.graph.core.criticalpath.ICriticalPathProvider;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraphStatistics;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraphVisitor;
}
private class BuildThread extends Thread {
- private final ITmfTrace fBuildTrace;
+ private final CriticalPathModule fModule;
private final IProgressMonitor fMonitor;
- public BuildThread(final ITmfTrace trace) {
+ public BuildThread(final CriticalPathModule module) {
super("Critical path view build"); //$NON-NLS-1$
- fBuildTrace = trace;
+ fModule = module;
fMonitor = new NullProgressMonitor();
}
@Override
public void run() {
try {
- CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
- TmfTraceUtils.getAnalysisModulesOfClass(fBuildTrace, CriticalPathModule.class),
- null);
- if (module == null) {
- return;
- }
+ CriticalPathModule module = fModule;
module.schedule();
if (module.waitForCompletion(fMonitor)) {
// Module is completed, set the start and end time of
}
private @Nullable TmfGraph getGraph(final ITmfTrace trace) {
- CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
- TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class),
+ ICriticalPathProvider module = Iterables.<@Nullable ICriticalPathProvider> getFirst(
+ TmfTraceUtils.getAnalysisModulesOfClass(trace, ICriticalPathProvider.class),
null);
if (module == null) {
throw new IllegalStateException("View requires an analysis module"); //$NON-NLS-1$
return getLinksInRange(links, startTime, endTime);
}
- CriticalPathModule module = Iterables.<@Nullable CriticalPathModule> getFirst(
- TmfTraceUtils.getAnalysisModulesOfClass(trace, CriticalPathModule.class), null);
+ ICriticalPathProvider module = Iterables.<@Nullable ICriticalPathProvider> getFirst(
+ TmfTraceUtils.getAnalysisModulesOfClass(trace, ICriticalPathProvider.class), null);
if (module == null) {
throw new IllegalStateException("View requires an analysis module"); //$NON-NLS-1$
}
if (list.isEmpty()) {
return;
}
- final ITmfTrace trace = getTrace();
- if (trace == null) {
+
+ Object first = list.get(0);
+ if (!(first instanceof CriticalPathBaseEntry)) {
return;
}
+ CriticalPathModule module = ((CriticalPathBaseEntry) first).getModule();
fSyncLock.lock();
try {
if (buildThread != null) {
buildThread.cancel();
}
- buildThread = new BuildThread(trace);
+ buildThread = new BuildThread(module);
buildThread.start();
fBuildThread = buildThread;
} finally {
}
IGraphWorker worker = (IGraphWorker) obj;
- TimeGraphEntry tge = new CriticalPathBaseEntry(worker);
+ TimeGraphEntry tge = new CriticalPathBaseEntry(worker, module);
List<TimeGraphEntry> list = Collections.singletonList(tge);
putEntryList(trace, list);
refresh();
return;
}
IAnalysisModule selectedModule = selectedTrace.getAnalysisModule(module.getId());
- /* register only if the module is for the currently selected trace */
- if (selectedModule == module) {
+ /*
+ * register only if the module is for the currently selected trace or
+ * the current trace has no such module
+ */
+ if (selectedModule == null || selectedModule == module) {
fModule = module;
}
}