/
ICallGraphProvider.java
102 lines (90 loc) · 4.14 KB
/
ICallGraphProvider.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*******************************************************************************
* 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 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.internal.analysis.callstack.core.callgraph;
import java.util.Collection;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.analysis.callstack.core.base.FlameDefaultPalette;
import org.eclipse.tracecompass.internal.analysis.callstack.core.base.ICallStackElement;
import org.eclipse.tracecompass.internal.analysis.callstack.core.base.ICallStackSymbol;
import org.eclipse.tracecompass.internal.analysis.callstack.core.base.IDataPalette;
import org.eclipse.tracecompass.internal.analysis.callstack.core.tree.IWeightedTreeGroupDescriptor;
import org.eclipse.tracecompass.internal.analysis.callstack.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.internal.analysis.callstack.core.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.internal.analysis.callstack.core.tree.WeightedTreeGroupBy;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
/**
* Interface that analyses who provide callgraph
*
* @author Geneviève Bastien
*/
public interface ICallGraphProvider extends IWeightedTreeProvider<ICallStackSymbol, ICallStackElement, AggregatedCallSite> {
/**
* Get the group descriptors that describe how the elements are grouped in
* this call graph hierarchy. This method will return the root group
* descriptor. Children groups can be retrieved by the parent group. For
* call graph providers who have only one series, this will be a singleton.
*
* @return The collection of group descriptors for this call graph
*/
Collection<IWeightedTreeGroupDescriptor> getGroupDescriptors();
@Override
default @Nullable IWeightedTreeGroupDescriptor getGroupDescriptor() {
// Return the first group descriptor
Collection<IWeightedTreeGroupDescriptor> groupDescriptors = getGroupDescriptors();
if (groupDescriptors.isEmpty()) {
return null;
}
return groupDescriptors.iterator().next();
}
/**
* Get the call graph for a given time range. This callgraph is for all the
* elements. The caller can then group the result by calling
* {@link WeightedTreeGroupBy#groupWeightedTreeBy(IWeightedTreeGroupDescriptor, IWeightedTreeSet, IWeightedTreeProvider)}
* method
*
* @param start
* The start of the range
* @param end
* The end of the range
* @return The call graph object containing the CCTs for each element in the
* range.
*/
CallGraph getCallGraph(ITmfTimestamp start, ITmfTimestamp end);
/**
* Get the call graph for the full range of the trace. This callgraph is for
* all the elements. The caller can then group the result by calling
* {@link WeightedTreeGroupBy#groupWeightedTreeBy(IWeightedTreeGroupDescriptor, IWeightedTreeSet, IWeightedTreeProvider)}
*
* @return The call graph object containing the CCTs for each element in the
* range.
*/
CallGraph getCallGraph();
@Override
default @Nullable IWeightedTreeSet<ICallStackSymbol, ICallStackElement, AggregatedCallSite> getSelection(ITmfTimestamp start, ITmfTimestamp end) {
return getCallGraph(start, end);
}
@Override
default IWeightedTreeSet<ICallStackSymbol, ICallStackElement, AggregatedCallSite> getTreeSet() {
return getCallGraph();
}
/**
* Factory method to create an aggregated callsite for a symbol
*
* @param object
* The symbol
* @return A new aggregated callsite
*/
AggregatedCallSite createCallSite(Object object);
@Override
default IDataPalette getPalette() {
return FlameDefaultPalette.getInstance();
}
}