Sun GlassFish Enterprise Server 2.1 Developer's Guide

ProcedureTo Use HPROF Profiling on UNIX

  1. Use the Admin Console. In the developer profile, select the Enterprise Server component and the JVM Settings tab. In the cluster profile, select the JVM Settings component under the relevant configuration. Then select the Profiler tab.

  2. Edit the following fields:

    • Profiler Name – hprof

    • Profiler Enabled – true

    • Classpath – (leave blank)

    • Native Library Path – (leave blank)

    • JVM Option – Select Add, type the HPROF JVM option in the Value field, then check its box. The syntax of the HPROF JVM option is as follows:

      -Xrunhprof[:help]|[:param=value,param2=value2, ...]

      Here is an example of params you can use:


      The file parameter determines where the stack dump is written.

      Using help lists parameters 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

      Note –

      Do not use help in the JVM Option field. This parameter prints text to the standard output and then exits.

      The help output refers to the parameters as options, but they are not the same thing as JVM options.

  3. Restart the Enterprise Server.

    This writes an HPROF stack dump to the file you specified using the file HPROF parameter.