Skip to content

Commit

Permalink
execution comparison: third commit
Browse files Browse the repository at this point in the history
Introduce a module to compare two groups of executions using a
differential flame graph.

An "EventDensityView" is used to select a time range for each group.
Select the desired traces in an experiment.

Show the difference ratio based on self time required a modification to
AggregatedCalledFunction.

Introduce "ParametricWeightedTreeUtils" to get "SelfTime" instead of "duration"
while building the differential Trees.

Adding the option of textual input of dates and query
to build the differential flame graph.

grouping are added to hamburger menu

Dependencies to incubator for callstack and weighted tree packages are reslved

Hard disk operations from UI thread are removed

Duplicating flame graph is isolated

changing in time ranges or in query reflect in graphical treeview and density charts

Signed-off-by: fariba <[email protected]>
  • Loading branch information
farajidaneshgar committed Apr 24, 2024
1 parent 61fd594 commit dfb1b20
Show file tree
Hide file tree
Showing 12 changed files with 573 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@

import java.util.Collection;

import org.eclipse.tracecompass.incubator.analysis.core.concepts.AggregatedCallSite;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ICallStackSymbol;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IDataPalette;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTree;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.AggregatedCallSite;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider2;
import org.eclipse.tracecompass.analysis.profiling.core.base.ICallStackSymbol;
import org.eclipse.tracecompass.analysis.profiling.core.base.IDataPalette;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTree;
import org.eclipse.tracecompass.analysis.profiling.core.base.ICallStackElement;


import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeSet;
import org.eclipse.tracecompass.incubator.callstack.core.base.ICallStackElement;
import org.eclipse.tracecompass.incubator.callstack.core.callgraph.ICallGraphProvider;

/**
*
* DifferentialCallGraphProvider which provide a callgraphProvider. Inherited from DifferentialWeightedTreeProvider
* to edit naming and color ICallGraphProviderpalette to provide a differential flame graph
* @author Fateme Faraji Daneshgar
*/
public class DifferentialCallGraphProvider extends DifferentialWeightedTreeProvider<ICallStackSymbol> {

private final ICallGraphProvider fOriginalTree;
private final ICallGraphProvider2 fOriginalTree;

/**
* Constructor
Expand Down Expand Up @@ -59,7 +62,7 @@ public DifferentialCallGraphProvider(
IWeightedTreeProvider<ICallStackSymbol, ICallStackElement, ? extends WeightedTree<ICallStackSymbol>> originalTree,
DifferentialWeightedTreeSet<ICallStackSymbol> treeSet) {
super((IWeightedTreeProvider<ICallStackSymbol, ICallStackElement, WeightedTree<ICallStackSymbol>>)originalTree, treeSet);
fOriginalTree = (ICallGraphProvider) originalTree;
fOriginalTree = (ICallGraphProvider2) originalTree;
}

@Override
Expand All @@ -86,4 +89,4 @@ public String toDisplayString(DifferentialWeightedTree<ICallStackSymbol> tree) {

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Objects;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IDataPalette;
import org.eclipse.tracecompass.analysis.profiling.core.base.IDataPalette;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTree;
import org.eclipse.tracecompass.tmf.core.dataprovider.X11ColorUtils;
import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle;
Expand Down Expand Up @@ -86,7 +86,7 @@ private static String generateBlue(int i) {
StyleProperties.BACKGROUND_COLOR, WHITE_COLOR,
StyleProperties.OPACITY, 1,
StyleProperties.BORDER_STYLE, StyleProperties.BorderStyle.SOLID)));
// Add Blue tenses for Shorter duration
// Add Blue color palette for Shorter duration
for (i = MIN_HUE; i <= MAX_HUE; i++) {
j = (i-50)>0 ? i-50:0;
String blueKey = generateBlue(i);
Expand All @@ -96,7 +96,7 @@ private static String generateBlue(int i) {
StyleProperties.OPACITY, 1,
StyleProperties.BORDER_STYLE, StyleProperties.BorderStyle.SOLID)));
}
// Add Red tenses for Longer duration
// Add Red color palette for Longer duration
for (i = MIN_HUE; i <= MAX_HUE; i++) {
String redKey = generateRed(i);
builder.put(redKey, new OutputElementStyle(null, ImmutableMap.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.AggregatedCallSite;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ICallStackSymbol;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.ITree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTreeSet;
import org.eclipse.tracecompass.analysis.profiling.core.tree.ITree;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTree;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTreeSet;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeSet;
import org.eclipse.tracecompass.incubator.callstack.core.base.ICallStackElement;
import org.eclipse.tracecompass.incubator.callstack.core.callgraph.CallGraph;
import org.eclipse.tracecompass.incubator.callstack.core.callgraph.ICallGraphProvider;
import org.eclipse.tracecompass.incubator.callstack.core.instrumented.statesystem.InstrumentedCallStackAnalysis;
import org.eclipse.tracecompass.incubator.internal.callstack.core.instrumented.callgraph.AggregatedCalledFunction;
import org.eclipse.tracecompass.analysis.profiling.core.base.ICallStackElement;
import org.eclipse.tracecompass.analysis.profiling.core.base.ICallStackSymbol;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.AggregatedCallSite;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.CallGraph;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider2;
import org.eclipse.tracecompass.analysis.profiling.core.instrumented.InstrumentedCallStackAnalysis;
import org.eclipse.tracecompass.internal.analysis.profiling.core.callgraph2.AggregatedCalledFunction;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
Expand Down Expand Up @@ -76,7 +76,7 @@ public class DifferentialSeqCallGraphAnalysis extends TmfAbstractAnalysisModule
private static final String MERGE = "Merge"; //$NON-NLS-1$
private @Nullable DifferentialCallGraphProvider fDifferentialCallGraphProvider;
private static Map<String, String> fcallStackAnalysisMap = new HashMap<>();
private static Map<String, ICallGraphProvider> fTraceCallGraphRegistry = new HashMap<>();
private static Map<String, ICallGraphProvider2> fTraceCallGraphRegistry = new HashMap<>();
private ITmfTimestamp fStartA = TmfTimestamp.BIG_BANG;
private ITmfTimestamp fEndA = TmfTimestamp.BIG_CRUNCH;
private ITmfTimestamp fStartB = TmfTimestamp.BIG_BANG;
Expand Down Expand Up @@ -106,13 +106,6 @@ public void refreshDiffCG(@Nullable IProgressMonitor monitor) {
try (ScopeLog sl = new ScopeLog(LOGGER, Level.CONFIG, "DifferentialSequenceCGA::refresh()")) { //$NON-NLS-1$
Collection<WeightedTree<ICallStackSymbol>> originalTree = new ArrayList<>();
Collection<WeightedTree<ICallStackSymbol>> diffTree = new ArrayList<>();
/*
* if (fEndA == null || fStartA == null) { fEndA =
* TmfTimestamp.BIG_CRUNCH; } if (fStartA == null) { fStartA =
* TmfTimestamp.BIG_BANG; } if (fEndB == null) { fEndB =
* TmfTimestamp.BIG_CRUNCH; } if (fStartB == null) { fStartB =
* TmfTimestamp.BIG_BANG; }
*/
WeightedTreeSet<ICallStackSymbol, Object> callGraphA = mergeCallGraph(fStartA, fEndA, fTraceListA);
Collection<@NonNull ?> processes = callGraphA.getTreesForNamed(MERGE);
for (Object process : processes) {
Expand All @@ -126,11 +119,7 @@ public void refreshDiffCG(@Nullable IProgressMonitor monitor) {
}

Collection<DifferentialWeightedTree<ICallStackSymbol>> trees;
//if (diffTree.isEmpty()) {
// trees = ParametricWeightedTreeUtils.diffTrees(diffTree, originalTree, fStatistic);///injaaaa
//} else {
trees = ParametricWeightedTreeUtils.diffTrees(originalTree, diffTree, fStatistic);
//}
trees = ParametricWeightedTreeUtils.diffTrees(originalTree, diffTree, fStatistic);

IWeightedTreeProvider<ICallStackSymbol, ICallStackElement, AggregatedCallSite> instrumentedCallStackAnalysis = Iterables.get(fTraceCallGraphRegistry.values(), 0);
setDifferentialCallGraphProvider(new DifferentialCallGraphProvider(instrumentedCallStackAnalysis, trees));
Expand All @@ -156,7 +145,7 @@ public WeightedTreeSet<ICallStackSymbol, Object> mergeCallGraph(ITmfTimestamp st
String mainGroup = MERGE;

for (String traceName : traceList) {
ICallGraphProvider instrumentedCallStackAnalysis = fTraceCallGraphRegistry.get(traceName);
ICallGraphProvider2 instrumentedCallStackAnalysis = fTraceCallGraphRegistry.get(traceName);
if (instrumentedCallStackAnalysis != null) {
ITmfTrace trace = getTrace(traceName);
ITmfTimestamp traceStart = start;
Expand Down Expand Up @@ -316,13 +305,6 @@ public void selectionRangeUpdated(TmfComparisonFilteringUpdatedSignal signal) {
// tuning fTraceList
List<String> traceListA = signal.getTraceListA();
if (traceListA != null) {
/* for (String name : traceListA) {
if (fTraceListA.contains(name)) {
fTraceListA.remove(name);
} else {
fTraceListA.add(name);
}
}*/
fTraceListA.clear();
for (String name : signal.getTraceListA()) {
fTraceListA.add(name);
Expand All @@ -332,13 +314,6 @@ public void selectionRangeUpdated(TmfComparisonFilteringUpdatedSignal signal) {
}
List<String> traceListB = signal.getTraceListB();
if (traceListB != null) {
/* for (String name : traceListB) {
if (fTraceListB.contains(name)) {
fTraceListB.remove(name);
} else {
fTraceListB.add(name);
}
}*/
fTraceListB.clear();
for (String name : signal.getTraceListB()) {
fTraceListB.add(name);
Expand All @@ -350,7 +325,7 @@ public void selectionRangeUpdated(TmfComparisonFilteringUpdatedSignal signal) {
try (ScopeLog sl = new ScopeLog(LOGGER, Level.FINE, "MakeDiffCallGraph")) { //$NON-NLS-1$
synchronized (this) {
if (fDiffJob != null) {
fDiffJob.join();
fDiffJob.cancel();
}
fDiffJob = new Job("Make differential Callgraph") { //$NON-NLS-1$
@Override
Expand All @@ -364,11 +339,8 @@ protected IStatus run(@Nullable IProgressMonitor monitor) {
};
fDiffJob.schedule();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}

}

@Override
Expand Down Expand Up @@ -396,7 +368,6 @@ public void dispose() {
*/
private void setDifferentialCallGraphProvider(DifferentialCallGraphProvider differentialCallGraphProvider) {
fDifferentialCallGraphProvider = Objects.requireNonNull(differentialCallGraphProvider);

}
private static ITmfTrace getTrace(String traceName) {
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
Expand All @@ -406,11 +377,7 @@ private static ITmfTrace getTrace(String traceName) {
return traceMember;
}
}

return null;



}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.incubator.analysis.core.concepts.ICallStackSymbol;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.ITree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTreeUtils;
import org.eclipse.tracecompass.analysis.profiling.core.tree.ITree;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTree;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeProvider;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.DifferentialWeightedTreeSet;
import org.eclipse.tracecompass.incubator.callstack.core.callgraph.ICallGraphProvider;
import org.eclipse.tracecompass.incubator.internal.callstack.core.instrumented.callgraph.AggregatedCalledFunction;
import org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.diff.WeightedTreeUtils;
import org.eclipse.tracecompass.internal.analysis.profiling.core.callgraph2.AggregatedCalledFunction;
import org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider2;
import org.eclipse.tracecompass.tmf.core.util.Pair;

import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -142,7 +142,7 @@ private ParametricWeightedTreeUtils() {
* set, or <code>null</code> if the 2 treesets have no elements in
* common
*/
public static @Nullable DifferentialWeightedTreeProvider<ICallStackSymbol> diffTreeSets(ICallGraphProvider provider,
public static @Nullable DifferentialWeightedTreeProvider<ICallStackSymbol> diffTreeSets(ICallGraphProvider2 provider,
IWeightedTreeSet<ICallStackSymbol, @NonNull ?, WeightedTree<ICallStackSymbol>> first,
IWeightedTreeSet<ICallStackSymbol, @NonNull ?, WeightedTree<ICallStackSymbol>> second) {
Collection<Pair<@NonNull ?, @NonNull ?>> pairedElements = pairElementsFromTrees(first, second);
Expand Down Expand Up @@ -236,4 +236,4 @@ private ParametricWeightedTreeUtils() {
return null;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.ui,
org.eclipse.tracecompass.incubator.callstack.ui,
org.eclipse.tracecompass.incubator.callstack.core,
org.eclipse.tracecompass.incubator.analysis.core,
org.eclipse.tracecompass.incubator.executioncomparision.core,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional,
jakarta.validation.jakarta.validation-api
jakarta.validation.jakarta.validation-api,
org.eclipse.tracecompass.analysis.profiling.core
Export-Package: org.eclipse.tracecompass.incubator.internal.executioncomparision.ui;x-internal:=true
Automatic-Module-Name: org.eclipse.tracecompass.incubator.executioncomparision.ui
Import-Package: com.google.common.collect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<view
category="org.eclipse.linuxtools.tmf.ui.views.category"
class="org.eclipse.tracecompass.incubator.internal.executioncomparision.ui.MultipleDensityView"
class="org.eclipse.tracecompass.incubator.internal.executioncomparision.ui.ExecutionComparisonView"
id="org.eclipse.tracecompass.incubator.internal.entexecutioncomparison.ui.execComparison"
name="Execution Comparision"
restorable="true">
Expand Down
Loading

0 comments on commit dfb1b20

Please sign in to comment.