 |
» |
|
|
 |
The tools and options are categorized into the
following table groupings: Crash Analysis Tools |  |
Several of the options and tools described in
this chapter are designed for postmortem diagnostics. These are the
options and tools that can be used to obtain additional information
if an application crashes. This analysis may either be done at the
time of the crash or at a later time using information from the core
file. In addition to these tools, many other tools have features useful
for crash analysis. Table 1-1 Tools and Options for Crash Analysis | Tool or Option | Description and Usage |
|---|
| wdb /gdb | An HP-supported implementation
of the gdb debugger that has Java support. For
simplicity, this document refers to wdb/gdb as gdb from this point forward. gdb can be used to attach to a running process. | | Fatal Error Log (hs_err_pid<pid>.log) | Contains information obtained at the time of the crash. Often
one of the first pieces of data to examine when a crash occurs. | | -XX:ErrorFile | Specify filename to use for the fatal error log. | | -XX:OnError | Specify a sequence of user-supplied scripts or commands to
be executed when a crash occurs. | | -XX:+ShowMessageBoxOnError | Suspend the process when a crash occurs. Depending
on the user response, it can launch the gdb debugger to attach to the Java VM. | | jdb | Java language debugger. |
Hung or Deadlocked Processes |  |
The following options and tools can help you debug
a hung or deadlocked process: Table 1-2 Tools and Options for Debugging Hung or Deadlocked Processes | Tool or Option | Description and Usage |
|---|
| wdb/gdb | An HP-supported implementation
of the gdb debugger that has Java support. For
simplicity, this document refers to wdb/gdb as gdb from this point forward. gdb can be used to attach to a running process. | | HPjmeter | Used to identify and diagnose performance problems in Java
applications running on HP-UX. It can also be used to debug thread
and heap issues. | | Ctrl-Break Handler | Used to retrieve thread dump information. It also executes
a deadlock detection algorithm and reports any deadlocks detected
involving synchronized code. Heap dumps are also generated beginning
with JDK 1.5.0.05 and SDK 1.4.2.11 when the -XX:+HeapDumpOnCtrlBreak option is specified. | | gcore (11i v3 (11.31)
only) | Creates a core image of a running process. | | jdb | Java language debugger. |
Fatal Error Handling |  |
The following options are useful for retrieving
more information when fatal errors occur: Table 1-3 Options for Fatal Error Handling | Option | Description
and Usage |
|---|
| -XX:OnError | Used to specify a sequence of user-supplied scripts or commands
to be executed when a crash occurs. | | -XX:+ShowMessageBoxOnError | Used to suspend the process when a crash occurs.
After the process is suspended, the user can use gdb to attach to the Java VM. | | -XX:+HeapDumpOnOutOfMemoryError,
starting with SDK 1.4.2.11 and JDK 1.5.0.04 | Enables
dumping of the heap when an out of memory error condition occurs in
the Java VM. |
Memory Usage Monitoring Tools |  |
The following options and tools are useful for
monitoring memory usage of running applications: Table 1-4 Tools and Options for Monitoring Memory Usage | Tool | Description
and Usage |
|---|
| HPjmeter | Used to identify and diagnose performance problems in Java
applications by examining and monitoring the heap and threads. | | HPjtune | HPjtune functionality has been integrated into HPjmeter | | -XX:+HeapDump and _JAVA_HEAPDUMP Environment Variable, starting
with JDK 1.5.0.03 and SDK 1.4.2.10 | Used to observe memory
allocation in a running Java application by taking snapshots of the
heap over time. It can be set by providing the -XX:+HeapDump option or setting the _JAVA_HEAPDUMP environment
variable. | | -XX:+HeapDumpOnCtrlBreak ,
starting with JDK 1.5.0.05 and SDK 1.4.2.11 | Enables
the ability to take snapshots of the Java heap when a SIGQUIT signal is sent to the Java process without using
the JVMTI-based -Xrunhprof:heap=dump option. | | -XX:+HeapDumpOnOutOfMemoryError,
starting with JDK 1.5.0.04 and SDK 1.4.2.11 | Enables
dumping of the Java heap when an “Out Of Memory” error
condition occurs in the Java VM. | | -XX:+HeapDumpOnly,
starting with JDK 1.5.0.05 and SDK 1.4.2.11 | Used to
enable heap dumps using the SIGVTALRM signal
(signal 20). It can be set by providing the -XX:+HeapDumpOnly option or setting the _JAVA_HEAPDUMP_ONLY environment
variable. This interface is provided to separate the generation of
thread and trace information triggered via SIGQUIT from the heap dump information. | | -Xverbosegc (HP only)
and -verbose:gc | Used to enable logging of garbage collection information. The HP-only -Xverbosegc option generates additional GC information
that is used by HPjtune. It
is preferable to use -Xverbosegc instead of -verbose:gc. | | hat or jhat | This third-party
tool may be used to perform Java heap analysis. | | jconsole (1.5+ only) | Used to monitor and manage an application launched with a management
agent on a local or remote machine. | | “Allocation Site Statistics and Zero Preparation Xverbosegc” | Prompts the Java Virtual
Machine (JVM) to emit HP Xverbosegc information and allocation site
statistics for Java applications. |
Performance Tools |  |
The following tools are useful for identifying
where the application spends its time. Some tools enable you to monitor
performance in real time (dynamic analysis) and other tools enable
you to analyze captured profiling data (static analysis): Table 1-5 Performance Tools | Tool | Description
and Usage |
|---|
| GlancePlus | Easily examine system activities, identify and resolve performance
bottlenecks, and tune your system for more efficient operation. | | HP Caliper | Understand the execution of your applications and identify
ways to improve their performance. | | HPjmeter | Use statically collected eprof data to understand where the
application is spending time. Use dynamic real-time monitoring to
identify performance issues. | | HPjtune | HPjtune functionality has been integrated into HPjmeter | | hprof | Simple static profiler agent used for heap and CPU profiling. | | iostat | Iteratively reports I/O statistics for each active disk on the system. | | jstat (1.5+ only) | Attaches to the Java VM and collects and logs performance statistics
dynamically. | | jconsole (1.5+ only) | Launches a simple console tool enabling you to dynamically
monitor and manage an application launched with a management agent
on a local or remote machine. | | Prospect | Retrieve a profile of the compiled Java methods that the Java
VM compiler creates in data space. | | netstat | Displays statistics for network interfaces and protocols as well
as the contents of various network-related data structures. It can
show packet traffic, connections, error rates, and more. | | sar | Report various system activities, such as processor, I/O, context
switches, interrupts, page faults, and other kernel actions. | | swapinfo | Displays information about device and file-system-paging space. | | top | Displays the top processes on the system, periodically
updating the information; raw processor percentage is used to rank
the processes. | | tusc | Provides another view into the system activity, in addition to Java
stack traces, GlancePlus, and HPjmeter. | | vmstat | Reports statistics about the process, virtual memory, trap, and processor
activity. |
Miscellaneous Tools and Options |  |
The following tools and options do not fall into
any of the previous categories: Table 1-6 Miscellaneous Tools and Options | Tool or Option | Description and Usage |
|---|
| JAVA_TOOL_OPTIONS Environment Variable | Used to augment the options specified in the Java
command line. | | jvmstat Tools | Tools include jps, jstat, and jstatd. These tools are included with JDK
1.5+. | | visualgc | Uses jvmstat technology to provide visualization of garbage
collection activity in the Java VM. | | -verbose:class | Enables logging of class loading and unloading. | | -verbose:jni | Enables logging of JNI (Java Native Interface). | | -Xcheck:jni | Performs additional validation on the arguments passed to JNI
functions. |
JDK Tools Not Available on HP-UX |  |
Some JDK tools are not available on HP-UX, so
they are not described in this document. They are provided in JavaSoft
JDK as unsupported tools. Equivalent functionality is available via gdb Java support, HPjmeter, and the
HeapDump options. Table 1-7 JDK Tools Not Available on HP-UX | Tool | Description and HP-UX Alternative |
|---|
| jinfo | Prints Java configuration information for a given Java process, core
file, or remote debug server. | | jmap | Prints shared object memory maps or Java heap memory details of a
given process, core file, or remote debug server. Use the HeapDump
options or gdb heap dump functionality
instead. | | jstack | Prints a Java stack trace of Java threads for a given Java process,
core file, or remote debug server. Use gdb stack trace back functionality instead. | | Serviceability Agent (SA) | Not supported on HP-UX. |
|