Skip to content

Commit

Permalink
analysis.graph: Remove deprecated APIs in dependency graph
Browse files Browse the repository at this point in the history
Deprecated in patch:
https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/182723
https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/192194

Fixes issue eclipse-tracecompass#87

[Removed] ITmfGraphVisitor
[Removed] AbstractTmfGraphBuilderModule.getGraph()
[Removed] AbstractTmfGraphBuilderModule.getCriticalPath()
[Removed] ITmfGraphProvider.assignTargetGraph()
[Removed] ITmfGraphProvider.getAssignedGraph()
[Removed] AbstractTmfGraphProvider.assignTargetGraph()
[Removed] AbstractTmfGraphProvider.getAssignedGraph()
[Removed] AbstractCriticalPathModule.getCriticalPath()
[Removed] ICriticalPathAlgorithm.compute()
[Removed] ICriticalPathProvider.getCriticalPath()
[Removed] TmfEdge
[Removed] TmfGraph
[Removed] TmfVertex
[Removed] CriticalPathModule

Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
  • Loading branch information
PatrickTasse committed May 22, 2024
1 parent 535cfa6 commit 44ad40e
Show file tree
Hide file tree
Showing 21 changed files with 90 additions and 255 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 École Polytechnique de Montréal
* Copyright (c) 2022, 2024 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -13,8 +13,8 @@

import java.io.IOException;

import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.graph.ITmfGraph;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.internal.analysis.graph.core.graph.legacy.TmfGraphLegacyWrapper;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 École Polytechnique de Montréal
* Copyright (c) 2015, 2024 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -27,14 +27,15 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.analysis.graph.core.base.CycleDetectedException;
import org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker;
import org.eclipse.tracecompass.analysis.graph.core.base.ITmfGraphVisitor;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfEdge;
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.base.TmfVertex.EdgeDirection;
import org.eclipse.tracecompass.analysis.graph.core.graph.ITmfGraphVisitor;
import org.eclipse.tracecompass.analysis.graph.core.tests.stubs.TestGraphWorker;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfEdge;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfEdge.EdgeType;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraphStatistics;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfGraphVisitor;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfVertex;
import org.eclipse.tracecompass.internal.analysis.graph.core.base.TmfVertex.EdgeDirection;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.junit.Test;
Expand Down Expand Up @@ -318,7 +319,7 @@ public void testCheckVertical() {
n0.linkVertical(n1);
}

private class ScanCountVertex implements ITmfGraphVisitor {
private class ScanCountVertex extends TmfGraphVisitor {
public int nbVertex = 0;
public int nbVLink = 0;
public int nbHLink = 0;
Expand Down Expand Up @@ -433,7 +434,7 @@ public void testGraphStatistics() {
* @author Francis Giraldeau
*
*/
private class DuplicateDetectorVisitor implements ITmfGraphVisitor {
private class DuplicateDetectorVisitor extends TmfGraphVisitor {
private final Set<TmfVertex> set = new HashSet<>();
@Override
public void visitHead(TmfVertex vertex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Version: 4.1.1.qualifier
Bundle-Version: 5.0.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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2022 École Polytechnique de Montréal
* Copyright (c) 2015, 2024 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -18,13 +18,11 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.criticalpath.AbstractCriticalPathModule;
import org.eclipse.tracecompass.analysis.graph.core.criticalpath.ICriticalPathProvider;
import org.eclipse.tracecompass.analysis.graph.core.graph.ITmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.graph.WorkerSerializer;
import org.eclipse.tracecompass.internal.analysis.graph.core.Activator;
import org.eclipse.tracecompass.internal.analysis.graph.core.graph.legacy.TmfGraphLegacyWrapper;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
Expand All @@ -44,8 +42,7 @@
*/
public abstract class AbstractTmfGraphBuilderModule extends TmfAbstractAnalysisModule implements ICriticalPathProvider {

private @Nullable TmfGraph fGraph;
private @Nullable ITmfGraph fNewGraph;
private @Nullable ITmfGraph fGraph;
private @Nullable ITmfEventRequest fRequest;
private final AbstractCriticalPathModule fCriticalPathModule;

Expand All @@ -71,34 +68,14 @@ public AbstractTmfGraphBuilderModule() {
*/
protected abstract @Nullable ITmfGraph createGraphInstance(Path htFile, WorkerSerializer workerSerializer, long startTime, int version);

/**
* Gets the graph generated by the analysis
*
* @return The generated graph
* @deprecated Use the new {@link #getTmfGraph()} instead
*/
@Deprecated
public @Nullable TmfGraph getGraph() {
return fGraph;
}

/**
* Gets the graph generated by the analysis
*
* @return The generated graph
* @since 3.2
*/
public @Nullable ITmfGraph getTmfGraph() {
ITmfGraph newGraph = fNewGraph;
if (newGraph != null) {
return newGraph;
}
// Try wrapping the legacy graph if available
TmfGraph graph = fGraph;
if (graph != null) {
return new TmfGraphLegacyWrapper(graph);
}
return null;
return fGraph;
}

// ------------------------------------------------------------------------
Expand All @@ -107,18 +84,15 @@ public AbstractTmfGraphBuilderModule() {

@Override
protected boolean executeAnalysis(final IProgressMonitor monitor) {
if (fGraph == null) {
final ITmfGraphProvider provider = getGraphProvider();
final ITmfGraphProvider provider = getGraphProvider();

/*
* TODO: This will eventually support multiple backends so we can
* save the graph on disk, like the state system, but for now, it is
* just in memory
*/

createGraph(provider);
/*
* TODO: This will eventually support multiple backends so we can
* save the graph on disk, like the state system, but for now, it is
* just in memory
*/

}
createGraph(provider);
return !monitor.isCanceled();
}

Expand All @@ -144,12 +118,11 @@ protected void canceling() {
public void dispose() {
fCriticalPathModule.dispose();
super.dispose();
fGraph = null;
ITmfGraph newGraph = fNewGraph;
if (newGraph != null) {
newGraph.dispose();
ITmfGraph graph = fGraph;
if (graph != null) {
graph.dispose();
}
fNewGraph = null;
fGraph = null;
}

// ------------------------------------------------------------------------
Expand All @@ -166,8 +139,7 @@ private void createGraph(ITmfGraphProvider provider) {
Path htFile = Paths.get(fileDirectory + id + ".ht"); //$NON-NLS-1$

ITmfGraph graph = createGraphInstance(htFile, getWorkerSerializer(), provider.getStartTime(), provider.getGraphFileVersion());
fNewGraph = graph;
fGraph = new TmfGraph();
fGraph = graph;
if (graph != null) {
provider.assignGraph(graph);
}
Expand Down Expand Up @@ -230,7 +202,7 @@ private void build(ITmfGraphProvider provider, ITmfGraph graph) {
private static class TmfGraphBuildRequest extends TmfEventRequest {

private final ITmfGraphProvider fProvider;
private final ITmfGraph fGraph;
private final ITmfGraph fBuilderGraph;
private long fLastEnd;

/**
Expand All @@ -248,7 +220,7 @@ public TmfGraphBuildRequest(ITmfGraphProvider provider, ITmfGraph graph) {
ITmfEventRequest.ExecutionType.BACKGROUND);

fProvider = provider;
fGraph = graph;
fBuilderGraph = graph;
}

@Override
Expand All @@ -262,7 +234,7 @@ public void handleData(final ITmfEvent event) {
public synchronized void done() {
super.done();
fProvider.done();
fGraph.closeGraph(fLastEnd);
fBuilderGraph.closeGraph(fLastEnd);
}

@Override
Expand All @@ -273,17 +245,6 @@ public void handleCancel() {

}

/**
* @since 1.1
* @deprecated Use the new API via the {@link #getCriticalPathGraph()}
* method instead
*/
@Deprecated
@Override
public @Nullable TmfGraph getCriticalPath() {
return fCriticalPathModule.getCriticalPath();
}

@Override
public @Nullable ITmfGraph getCriticalPathGraph() {
return fCriticalPathModule.getCriticalPathGraph();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2022 École Polytechnique de Montréal
* Copyright (c) 2015, 2024 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -18,10 +18,10 @@

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.graph.ITmfGraph;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;

Expand Down Expand Up @@ -53,8 +53,7 @@ public abstract class AbstractTmfGraphProvider implements ITmfGraphProvider {
private boolean fGraphAssigned;

/** Graph in which to insert the state changes */
private @Nullable TmfGraph fGraph = null;
private @Nullable ITmfGraph fNewGraph = null;
private @Nullable ITmfGraph fGraph = null;

/**
* Instantiate a new graph builder plugin.
Expand All @@ -80,28 +79,15 @@ public long getStartTime() {
return fTrace.getStartTime().toNanos();
}

@Deprecated
@Override
public void assignTargetGraph(TmfGraph graph) {
fGraph = graph;
fGraphAssigned = true;
}

@Deprecated
@Override
public @Nullable TmfGraph getAssignedGraph() {
return fGraph;
}

@Override
public void assignGraph(@NonNull ITmfGraph graph) {
fNewGraph = graph;
fGraph = graph;
fGraphAssigned = true;
}

@Override
public @Nullable ITmfGraph getGraph() {
return fNewGraph;
return fGraph;
}

@Override
Expand All @@ -117,7 +103,6 @@ public void processEvent(ITmfEvent event) {
public void dispose() {
fGraphAssigned = false;
fGraph = null;
fNewGraph = null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2022 École Polytechnique de Montréal
* Copyright (c) 2015, 2024 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -12,7 +12,6 @@
package org.eclipse.tracecompass.analysis.graph.core.building;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph;
import org.eclipse.tracecompass.analysis.graph.core.graph.ITmfGraph;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
Expand Down Expand Up @@ -44,38 +43,6 @@ public interface ITmfGraphProvider {
*/
long getStartTime();

/**
* Assign the target graph where this builder will add new nodes and
* vertices
*
* This needs to be called before .run()!
*
* @param graph
* Target graph for the state changes generated by this input
* plugin
* @deprecated Use the new graph API with {@link #assignGraph(ITmfGraph)}
* instead. The legacy and new graphs are incompatible, if a the
* graph is built using the new API, this graph is not required
* to return anything, but if the old API is used, then this
* graph should be available
*/
@Deprecated
void assignTargetGraph(TmfGraph graph);

/**
* Return the currently assigned target graph.
*
* @return Reference to the currently assigned graph, or {@code null} if no
* graph is assigned yet
* @deprecated Use the new graph API with {@link #getGraph()} instead. The
* legacy and new graphs are incompatible, if a the graph is
* built using the new API, this graph is not required to return
* anything, but if the old API is used, then this graph should
* be available
*/
@Deprecated
@Nullable TmfGraph getAssignedGraph();

/**
* Send an event to this input plugin for processing. The implementation
* should check the contents, and call the state-modifying methods of its
Expand Down
Loading

0 comments on commit 44ad40e

Please sign in to comment.