Package org.opencms.main
Class CmsSingleThreadDumperThread.SampleNode
java.lang.Object
org.opencms.main.CmsSingleThreadDumperThread.SampleNode
- Enclosing class:
- CmsSingleThreadDumperThread
Node for the summary tree generated from the thread dumps.
The tree keeps track of sample counts for stack trace frames.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.getKey()
Gets the key of the node.getOrAddChild
(Object key) Gets the child node for the given key, creating it it it doesn't exist yet.long
Returns the sample count.boolean
Check if this node has children.void
Increments the sample count for this node.static void
incrementPath
(CmsSingleThreadDumperThread.SampleNode root, List<?> path) Increment sample count for all nodes along the given path.nodesForPath
(CmsSingleThreadDumperThread.SampleNode root, 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
Sorts the children of this node by descending sample count.void
sortTree()
Recursively sorts this node's and all its descendants' children.
-
Constructor Details
-
SampleNode
Creates a new node.- Parameters:
key
- the key of the node, identifying it among its siblings
-
-
Method Details
-
compareBySamplesDescending
public static int compareBySamplesDescending(CmsSingleThreadDumperThread.SampleNode a, CmsSingleThreadDumperThread.SampleNode b) Compare nodes by descending sample count.- Parameters:
a
- first nodeb
- second node- Returns:
- the comparison result
-
incrementPath
Increment sample count for all nodes along the given path.- Parameters:
root
- the root nodepath
- a sequence of keys constituting a path in the tree
-
nodesForPath
public static List<CmsSingleThreadDumperThread.SampleNode> nodesForPath(CmsSingleThreadDumperThread.SampleNode root, 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.- Parameters:
root
- the root of the treepath
- the path- Returns:
- the sequence of nodes along the path
-
appendToXml
Dumps the tree node to XML.- Parameters:
parent
- the parent XML to append the XML to
-
getKey
Gets the key of the node.- Returns:
- the key of the node
-
getOrAddChild
Gets the child node for the given key, creating it it it doesn't exist yet.- Parameters:
key
- the key- Returns:
- the child for the key
-
getSamples
Returns the sample count.- Returns:
- the sample count
-
hasChildren
Check if this node has children.- Returns:
- true if this node has children
-
increment
Increments the sample count for this node. -
sortChildren
Sorts the children of this node by descending sample count. -
sortTree
Recursively sorts this node's and all its descendants' children.
-