Java Metrics
[Back]
The availability of metrics depends on the version of Java,
the version of the operating system, and the profiling option used.
To display a particular metric, from the File menu select
Open to open a data file, or select a previously opened one.
Then select the metric you want from the Metric menu.
Many metrics show CPU time or Clock time.
The clock time is the time as measured by an external independent clock,
sometimes called "wall clock."
The CPU time is the time spent by any of the CPUs (processors) on executing
a thread.
The time that a thread spends sleeping, waiting, performing an I/O operation,
or being preempted does not count toward the CPU time, but contributes
to the Clock time.
An HPjmeter window displays only one metric at a time,
but you can open several windows.
The following metrics are available:
-
Inclusive Method Times
(CPU or Clock)
This is the accumulated total time
used by all invocations of a method and all methods that were
called from it directly or indirectly.
Inclusive times are useful, if you want to see the cost of a particular
task performed by the application, and you can associate
this task with a single method.
However, for recursive methods, the inclusive times depend on the
depth of recursion and thus have very limited value.
To see all callers of a given method with the
accumulated inclusive time spent in all calls,
double click on the method name.
-
Exclusive Method Times
(CPU or Clock)
This is the accumulated total time used by a method,
but does not include the time
used by the methods which were called from it.
Exclusive times are useful for quick code tuning, which can focus
on a few methods, but does not change the overall code structure.
For the Clock version of this metric,
the standard Java methods java.lang.Thread.sleep
and java.lang.Object.wait
are not included.
-
Method Call Count
This is the total number of times a method was called.
Double click on a method name to see a list of all its callers,
with the cumulative number of calls from each caller.
-
Histogram
(Threads or Thread Groups)
This is a presentation of all threads (or thread groups)
created by the application.
The horizontal bars represent the lifetime of the threads (or thread groups),
with respect to the lifetime of the whole application.
If the profile data contains both CPU and clock times,
the bars are displayed using colors describing
thread states,
otherwise the bars are grey.
Double click on the bar to see the distribution of thread lifetime by state.
-
Call Graph Tree
(CPU, Clock or Call Count)
This is the method call graph represented as a tree.
The nodes within the graph represent methods and the arcs represent
cumulative calls from the preceding node.
Each non-leaf node of the graph can be interactively expanded or collapsed
by clicking on the small circle on the left side of the method name.
-
For CPU and Clock trees,
the numerical values represent the time used by the arc, that is,
the inclusive time used by all invocations represented by the arc.
The numbers in parenthesis indicate what percentage of the total
inclusive time used by the method was caused by the calls from the preceding
node. Here's a snippet from a Call Graph Tree with times:
By default, the arcs with numerical values less than 50 are not shown.
You can change this threshold value by using Tree->Prune from the
menu bar, or by clicking on the appropriate icon in the tool bar.
-
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 (that is, from all callers).
It may be unintuitive to traverse this graph if you get used to
the call graphs representing time. This is because below a low number
of calls (let's say 1) a very large number of further calls can
be hidden.
In cases when there's more than one caller of a method, the number
of other callers is also given.
For example, given the picture above, you can see that
JComponent.paintImmediately was the only caller of
JComponent._paintImmediately. The inclusive time for all
calls to JComponent._paintImmediately
was 138290 time units.
On the other hand, JComponent.paintImmediately used
402 time units on calls to
Component.isShowing, which represents 6%
of the total inclusive time used by this method. The remaining 94%
of time used by Component.isShowing was caused by calls from
the remaining 13 callers.
To see the list of all callers of the given method,
double click on the method name.
You can also limit the scope of your analysis to a selected subtree
(or a forest of subtrees) by selecting one or more nodes
and using Tree->Set as Root from the menu bar.
-
Exclusive Class Times
(CPU or Clock)
This is the total of the Exclusive Method Times (see above),
summed over all methods of the class.
To see the list of all contributing methods, double click on the class name.
For the Clock version,
the standard methods Thread.sleep and Object.wait
do not contribute to this metric,
however, they will be shown on the list of all contributing methods
for the respective classes.
-
Reference Graph Tree
The reference graph shows all objects remaining alive on the heap when
the application terminated. By expanding the nodes you can find out
what references are held by a given object.
Double click on an object to view all references to it.
-
Residual Objects
(Bytes or Count)
For each class or array type, this metric represents the objects which
remained allocated on the heap when the application terminated.
For Java 2 (hprof) you can see the allocation sites for each represented
type by double clicking on the type name.
-
Created Objects
(Bytes or Count)
For each class or array type,
this metric represents all objects of that type created
throughout the lifetime of the program.
Double clicking on the type name provides a list of allocation sites
with the metric values contributed by each listed method.
For Java 1.1, or for Java 2 (hprof) when no heap keyword was
active, this metric is only an estimation, based on the number of
calls to the class constructors.
[Back]