 |
» |
|
|
 |
The call graph trees are used to represent metrics
based on graphs. There are four metrics based on the method call graph (showing
CPU Time, Clock Time, Call Count, and Lock Delay),
and one based on the object references (Reference Graph). The trees are dynamic. You can expand or collapse any non-leaf node
by clicking on the small square on the left side of each node. A consequence of representing a graph in the tree form is that the same
graph node can be displayed many times within the tree (showing different
paths in the graph). Special color coding of the nodes helps you to navigate
the tree. Five colors are used: Table 5-6 Key to Color Coding of Call Graph Nodes | Leaf. Leaf nodes, written in black, represent
methods that did not call any other methods or objects that do not keep any
references to other objects. Leaf nodes cannot be expanded or collapsed. | | Expanded. After expansion the node will
be shown using grey. | | Expanded Elsewhere. A tree node that is
already expanded elsewhere in the tree will be shown in red. It
is possible to expand this node if you want to do so. The information shown
will be identical to that already displayed where the node is expanded. You
may find that expanding the same graph node in more than one place makes the
tree less manageable. | | Visited. A node that you have expanded
and then collapsed is called a visited node. It is shown in a different color
(purple) to remind you that you have already looked at the contents of this
node. | | Regular. All other non-leaf nodes that
have not been visited are presented in blue. |
See the figure below for examples. Interpreting Call Graph Data |  |
In the trees that are based on the call graph, the nodes represent methods
and the arcs represent cumulative calls from the preceding node. For CPU and Clock trees, the numerical values represent the
time used by the arc. That is, the numerical values represent the inclusive
time used by all invocations represented by the arc. The numbers in parentheses
indicate what percentage of the total inclusive time used by the method was
caused by the calls from the preceding node. By default, the arcs with numerical
values less than 50 are not shown. For a Call Count tree, the numerical values represent the
number of calls made to the method from the preceding node (the caller). The
percentage numbers represent the ratio of calls from the caller to the number
of all calls to this method from all callers. It may be non-intuitive to traverse
this graph if you get used to the call graphs representing time. This is because
below a low number of calls—for example, 1—a very large number
of further calls can be hidden.
In cases when there is more than one caller of a method, the number
of other callers is also given. Example of Node Color DisplayIt is best to explain the meaning of the numbers in a tree in an example.
Here's a snippet from a Call Graph Tree with times: In the picture above, you can see that run was
the only caller of sleepPerTab. The inclusive
time for all calls to sleepPerTab was 6,883,833 time
units. Lower down, you can see that sleepPerTab used 2,966 time
units on calls to setValue , which represents
97% of the total inclusive time used by this method. The remaining 3% of time
used by setValue was caused by calls from
the remaining callers (three other callers in this case).  |  |  |  |  | NOTE: Inclusive times include the time spent in called methods. Therefore,
for recursive calls, the same time is accumulated many times, depending on
the depth of the recursion. When this happens, a recursive method may show
an inclusive time that is greater than the inclusive time shown for its parent
method. |  |  |  |  |
 |  |  |  |  | TIP: To see the list of all callers of a given method, double-click on the
method name. |  |  |  |  |
The line showing repaint is marked
in red. This is because a node showing this method is already expanded elsewhere
in the tree. Note that all recursive calls will appear in red (unless you
expand the red node), but not all red nodes indicate a recursive call! Options for Manipulating the Call Tree Display |  |
You have several options for adjusting the display to better reveal
the data that you want to see. For the trees showing time, arcs with values of less than 50 are not
shown by default to avoid cluttering the display with arcs that are not essential
for finding performance bottleneck. However, because the time units are generally
abstract, and because your application may have run exceptionally long (or
briefly), this threshold (cut-off value) can be modified. Use Tree Prune to change
the cut-off value. You'll have a choice of changing the value just for the current tree,
or changing the default. The latter will be valid for all windows, but will
not affect the trees which are already displayed. Another form of pruning is available for the Object Reference Graph.
To keep the size of the displayed data manageable, array of references can
be only partially represented on the screen. The pruning mechanism controls
the maximum number of elements from each reference array that will be shown. Auto-Expanding the Call TreeQuite often the tree nodes that you would like to work with are deep
in the tree. To see them, you need to expand the entire call chain leading
from the root to the nodes of interest. To assist in this task, and to help
find the nodes that are good candidates for analysis in the top-down approach,
use the Tree Auto Expand function that automatically expands the tree and selects the
nodes which seem to correspond to complex high-level operations. Naturally, the tool's choice may be incorrect. In any case, your analysis
should not end at the nodes selected for you by HPjmeter. Excessive expansion of the tree makes the display hard to navigate.
It also slows down scrolling. You can get rid of the usually uninteresting, higher layers of the tree
by selecting one or more nodes and then executing Tree Set As Root(s). This will replace
the current roots of the displayed tree with the selected nodes. You can repeat
this command more than once, if necessary. To restore the original tree, use Tree Restore Roots. The search functions work in trees basically the same way they work
for other metrics, but there are a few special
considerations for searching call graph trees. Occasionally, not all nodes found in a search will be accessible
(visible). You'll be notified about such situations in the status bar at the
bottom of the window. A node will be inaccessible: if no path exists from the root to the node using only arcs
with values above the current cut-off value (see Tree Pruning),
or if no path exists from the root to the node at all. This can
happen when you change the roots of the tree (see Using Subtrees).
After a search, all found accessible nodes can be made visible
by expanding the tree to show the nodes. Occasionally, if the search yielded
many results, this creates a tree that is too large to be conveniently navigated,
even if you use the Find Next Selected command. You may then want to use Tree Collapse
All to fold down the tree alternately with Find
Next Selected. This will expand the tree to show only the current
node, rather than all selected nodes. The trees showing different metrics may expand differently,
even if the same node is found. For trees with time, the tree expands along the path from
the root that shows the maximum time (more precisely, the path that maximizes
the minimum arc time existing in the path). The tree with call counts expands showing the callers that
made the most calls to the found node and, recursively, its selected caller. Finally, the object reference tree expands showing the shortest
path from the root to the found node.
|