Configure the Application Server using the Administration Console:
Select the JVM Settings component under the relevant configuration, then select the Profiler tab.
Edit the following fields:
Profiler Name: hprof
Profiler Enabled: true
Classpath: (leave blank)
JVM Option: For each of these options, select Add, type the option in the Value field, then check its box:
-Xrunhprof:file=log.txt,options
Here is an example of options you can use:
-Xrunhprof:file=log.txt,thread=y,depth=3 |
The file option determines where the stack dump is written in Step 2.
The syntax of HPROF options is as follows:
-Xrunhprof[:help]|[:option=value,option2=value2, ...] |
Using help lists options that can be passed to HPROF. The output is as follows:
Hprof usage: -Xrunhprof[:help]|[:<option>=<value>, ...] Option Name and Value Description Default --------------------- ----------- ------- heap=dump|sites|all heap profiling all cpu=samples|old CPU usage off format=a|b ascii or binary output a file=<file> write data to file java.hprof (.txt for ascii) net=<host>:<port> send data over a socket write to file depth=<size> stack trace depth 4 cutoff=<value> output cutoff point 0.0001 lineno=y|n line number in traces? y thread=y|n thread in traces? n doe=y|n dump on exit? y |
Restart the Application Server. This writes an HPROF stack dump to the file you specified using the file HPROF option in Step 1.