public final class StacktraceGraphModel
extends java.lang.Object
The model is state-less. The model is created and built once, and read only.
Instances of this class are thread safe.
The typical way of using this class is to first decide on the FrameSeparator
and then
create the model.
Opening a Java flight Recording and setting up the stack trace model can be done like this:
IItemCollection items = JfrLoaderToolkit.loadEvents(file); IItemCollection filteredItems = items.apply(JdkFilters.EXECUTION_SAMPLE); FrameSeparator frameSeparator = new FrameSeparator(FrameCategorization.METHOD, false); StacktraceGraphModel model = new StacktraceGraphModel(frameSeparator, filteredItems);
Modifier and Type | Field and Description |
---|---|
private IAttribute<IQuantity> |
attribute |
private java.util.Map<java.lang.Integer,java.util.Set<Edge>> |
edges
From node id -> Edge
|
private FrameSeparator |
frameSeparator |
private IItemCollection |
items |
private int |
nodeCounter |
private java.util.Map<AggregatableFrame,Node> |
nodes
Frame -> Node
|
private int |
totalEdgeCount |
private int |
totalTraceCount |
Constructor and Description |
---|
StacktraceGraphModel(FrameSeparator frameSeparator,
IItemCollection items,
IAttribute<IQuantity> attribute)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addItem(IItem item,
IMemberAccessor<IMCStackTrace,IItem> stackTraceAccessor,
IMemberAccessor<IQuantity,IItem> quantityAccessor) |
private void |
buildModel() |
int |
findEdgeMaxCount()
Searches the edges for the max count.
|
double |
findEdgeMaxValue()
Searches the edges for the max value.
|
int |
findEdgeMinCount()
Searches the edges for the min count.
|
double |
findEdgeMinValue()
Searches the edges for the min value.
|
int |
findNodeMaxCount()
Searches the nodes for the max count.
|
double |
findNodeMaxWeight()
Searches the nodes for the max weight.
|
int |
findNodeMinCount()
Searches the nodes for the min count.
|
double |
findNodeMinWeight()
Searches the nodes for the min weight.
|
private static <T> IMemberAccessor<T,IItem> |
getAccessor(IItemIterable iterable,
IAttribute<T> attr) |
IAttribute<IQuantity> |
getAttribute() |
java.util.Collection<Edge> |
getEdges() |
IItemCollection |
getItems() |
java.util.Collection<Node> |
getNodes() |
private Edge |
getOrCreateLink(Node fromNode,
Node toNode) |
private Node |
getOrCreateNode(IMCFrame frame) |
int |
getTotalEdgeCount() |
int |
getTotalTraceCount() |
boolean |
isEmpty() |
static void |
main(java.lang.String[] args) |
java.lang.String |
toString() |
private final FrameSeparator frameSeparator
private final IItemCollection items
private final IAttribute<IQuantity> attribute
private int totalTraceCount
private int totalEdgeCount
private int nodeCounter
private final java.util.Map<java.lang.Integer,java.util.Set<Edge>> edges
private final java.util.Map<AggregatableFrame,Node> nodes
public StacktraceGraphModel(FrameSeparator frameSeparator, IItemCollection items, IAttribute<IQuantity> attribute)
frameSeparator
- how to aggregate frames.items
- the items to graph.attribute
- the (optional) attribute to use for calculating the values.public java.util.Collection<Edge> getEdges()
public java.util.Collection<Node> getNodes()
public IAttribute<IQuantity> getAttribute()
public boolean isEmpty()
public IItemCollection getItems()
public int getTotalEdgeCount()
public int getTotalTraceCount()
public int findNodeMinCount()
public int findNodeMaxCount()
public double findNodeMinWeight()
public double findNodeMaxWeight()
public double findEdgeMinValue()
public double findEdgeMaxValue()
public int findEdgeMinCount()
public int findEdgeMaxCount()
public java.lang.String toString()
toString
in class java.lang.Object
private void buildModel()
private static <T> IMemberAccessor<T,IItem> getAccessor(IItemIterable iterable, IAttribute<T> attr)
private void addItem(IItem item, IMemberAccessor<IMCStackTrace,IItem> stackTraceAccessor, IMemberAccessor<IQuantity,IItem> quantityAccessor)
public static void main(java.lang.String[] args) throws java.io.IOException, CouldNotLoadRecordingException
java.io.IOException
CouldNotLoadRecordingException