Java Troubleshooting Guide for HP-UX Systems
1.7.1 Static Data Analysis
1.7.1.1 Using HPjmeter to Analyze Profiling Data
The following steps summarize how to collect and view profiling data from your application.
For applications running on HP-UX, use the extended profiling option -Xeprof to capture
profile data, and then view the data in HPjmeter. For applications running on non-HP-UX
platforms, you can use -Xrunhprof or -agentlib:hprof options, and use HPjmeter to view
the data. (For more details, refer to thehprof section.) The examples in this section use the
-Xeprof option.
1. Change the command line of your Java application to use -Xeprof.
To collect Xeprof data during the entire execution of the launched Java application, use:
$ java -Xeprof <yourApp>
You can send the Xeprof output to a specified file using the file= keyword as follows:
$ java -Xeprof:file=<yourApp>.eprof <yourApp>
The <pid> will be inserted automatically in the file name, for example,
<yourApp><pid>.eprof.
To collect Xeprof data for a specified time interval, there are two options.
a. Turn on/off profiling based on specified time since program start:
$ java -Xeprof:time_on=<start_time>,time_slice=<length_of_collection_time> <yourApp>
b. Turn on/off profiling using signals (for example, sigusr1 and sigusr2):
$ java -Xeprof:time_on=sigusr1,time_slice=sigusr2 <yourApp>
The generated filename will include the time between the start of an application and
the start of profiling, for example:
java<pid>_<t>.eprof
NOTE: If you are running JDK 1.5.0.04 or later, the command-line option is not required
in order to capture eprof data. Instead you can toggle eprof data gathering on and off by
sending signals to the currently running Java VM. One log file is produced per sample
period; the name for the log file is java<pid>_<startTime>.eprof.
The SIGUSR2 signal toggles the recording of eprof data. Use the following process to gather
eprof data for specific periods:
• Send SIGUSR2 to the Java VM process. The Java VM will begin recording eprof data.
• Send SIGUSR2 to the Java VM process. The Java VM will flush eprof data and close the
log file.
See Profiling with Zero Preparation in the HPjmeter User's Guide for more information.
2. Run the application to create a data file.
3. Start the console from a local installation on your client machine. For example, here are two
different ways:
$ $JAVA_HOME/bin/java <heap_settings> -jar /opt/hpjmeter/lib/HPjmeter.jar
$ /opt/hpjmeter/bin/hpjmeter
4. Click File—>Open File to browse for and open the data file.
5. A profile analysis screen opens, displaying a set of tabs containing summary and graphical
metric data. The following screen shows an example:
1.7 HPjmeter 27