hprof is a simple profiler
agent, which is shipped with the JDK, and used for heap and CPU profiling.
Note that there can be very high intrusion due to the hprof agent. Therefore, when running on HP-UX, HP recommends using other
profiling options first. (For example, use Xeprof for performance profiling and +HeapDump for heap
profiling use.)
To start hprof, use one of the following
Java command lines:
$ java -agentlib:hprof[=options] appl_to_profile (JDK 1.5+)
$ java -Xrunhprof[:options] appl_to_profile (SDK 1.4.2.0+) |
hprof supports a number of
profiling options. Use java -Xrunhprof:help to
display the available options.
The following is an example hprof command to do heap profiling:
$ java -Xrunhprof:heap=dump Hello |
The output file can be read into HPjmeter, jhat, or hat, depending on the format
(binary or ASCII).
The following is an example hprof command to do performance profiling:
$ java -Xrunhprof:cpu=samples Hello |
For information about this tool on SDK 1.4 releases,
refer to:
http://java.sun.com/j2se/1.4.2/docs/guide/jvmpi/jvmpi.html#hprof
For information about the updated version of this
tool available on JDK 1.5+ releases, refer to:
http://java.sun.com/developer/technicalArticles/Programming/HPROF.html