public static class CmsSingleThreadDumperThread.SampleNode extends java.lang.Object
The tree keeps track of sample counts for stack trace frames.
Constructor and Description |
---|
SampleNode(java.lang.Object key)
Creates a new node.
|
Modifier and Type | Method and Description |
---|---|
void |
appendToXml(org.dom4j.Element parent)
Dumps the tree node to XML.
|
static int |
compareBySamplesDescending(CmsSingleThreadDumperThread.SampleNode a,
CmsSingleThreadDumperThread.SampleNode b)
Compare nodes by descending sample count.
|
java.lang.Object |
getKey()
Gets the key of the node.
|
CmsSingleThreadDumperThread.SampleNode |
getOrAddChild(java.lang.Object key)
Gets the child node for the given key, creating it it it doesn't exist yet.
|
long |
getSamples()
Returns the sample count.
|
boolean |
hasChildren()
Check if this node has children.
|
void |
increment()
Increments the sample count for this node.
|
static void |
incrementPath(CmsSingleThreadDumperThread.SampleNode root,
java.util.List<?> path)
Increment sample count for all nodes along the given path.
|
static java.util.List<CmsSingleThreadDumperThread.SampleNode> |
nodesForPath(CmsSingleThreadDumperThread.SampleNode root,
java.util.List<?> path)
Given a path consisting of a list of node keys, this method collects all nodes along that path,
including the given root node, and creates nodes if they don't exist in the tree yet.
|
void |
sortChildren()
Sorts the children of this node by descending sample count.
|
void |
sortTree()
Recursively sorts this node's and all its descendants' children.
|
public SampleNode(java.lang.Object key)
key
- the key of the node, identifying it among its siblingspublic static int compareBySamplesDescending(CmsSingleThreadDumperThread.SampleNode a, CmsSingleThreadDumperThread.SampleNode b)
a
- first nodeb
- second nodepublic static void incrementPath(CmsSingleThreadDumperThread.SampleNode root, java.util.List<?> path)
root
- the root nodepath
- a sequence of keys constituting a path in the treepublic static java.util.List<CmsSingleThreadDumperThread.SampleNode> nodesForPath(CmsSingleThreadDumperThread.SampleNode root, java.util.List<?> path)
root
- the root of the treepath
- the pathpublic void appendToXml(org.dom4j.Element parent)
parent
- the parent XML to append the XML topublic java.lang.Object getKey()
public CmsSingleThreadDumperThread.SampleNode getOrAddChild(java.lang.Object key)
key
- the keypublic long getSamples()
public boolean hasChildren()
public void increment()
public void sortChildren()
public void sortTree()