Introduction
Creating and loading a profile
To create a profile and do performance analysis on a Java application, run your application
with the -Xrunhprof:cpu=old command line option (this is under JDK1.3; consult
your Java documentation for exact details on how to enable profiling with other JDK versions).
Once your application terminates the virtual machine writes a text file containing a
list of all the method
calls in the application (caller and callee method names) together with the number
of times that call was made and the time spent in that call. (Under JDK1.1 the times
are totals across all threads, where JDK 1.2 and later have the option to break
down the times by thread.)
Launch the profile viewer and use "File | Open..." to open a profile text file as generated
above. If the
profile is in the correct format, you should see a display as follows.
Main screen
The window is split into three panes: the main method list on the left, the caller
pane on the top right and the callee pane on the bottom right:
Each line represents one method, with a count of the number of times the method is
invoked, a short form of the class and method name itself, the time spent in that
method (in seconds) and a bargraph of the time.
The current method name is shown in red at the top of the window and between the caller
and callee panes. All the methods which call the current method are listed in the caller pane,
and all the methods that the current method itself invokes are listed in the callee breakdown,
together with "Own time" which indicates time spent in this method that cannot be attributed
to another method.
You can select a method to analyse by clicking on its name in any of the three panes,
eg. from the main list where methods are ordered by name or by time, or clicking
on a method in the callee breakdown to further analyse a hotspot.
Colour coding
When a method is called from one than once place its name is shown in light grey to indicate
that its breakdown is inconclusive. As there is more than one entry point, all the time in the
breakdown may be due to another use of the method than the one you're interested in.
Within the main and callee method lists the bargraph for each method indicates the total time for the
method and the method's own time in darker green.
Help index | Next topic