One way to improve performance is with performance analysis. Performance
analysis is looking at program execution to pinpoint where bottlenecks or other
performance problems such as memory leaks might occur. Once you know where
potential touble spots are, you can change your code to remove or reduce their
Analyze a Program
Operating System Performance Tools
The Java Virtual Machines (VMs) have had the ability to provide simple
profile reports since Java Development Kit (JDK) 1.0.2. However, the information
they provided was limited to a sorted list of method calls a program had called.
The Java® 2 platform software provides much better profiling capabilities
than previously available and analysis of this generated data has been made
easier by the emergence of a Heap Analysis Tool (HAT). The heap analysis tool,
as its name implies, lets you analyze profile reports of the heap. The heap is a
block of memory the Java VM uses when it is running. The heap analysis tool lets
you generate reports on objects that were used to run your application. Not only
can you get a listing of the most frequently called methods and the memory used
in calling those methods, but you can also track down memory leaks. Memory leaks
can have a significant impact on performance.
To analyze the TableExample3 program included in the demo/jfc/Table
directory in the Java 2 platform download, you need to generate a profile
report. The simplest report to generate is a text profile. To generate a text
profile, run the application with the -Xhprof parameter. In the
final release of the Java 2 platform software, this option was renamed -Xrunhprof.
To see a list of the currently available options run the command