Use diagnostic commands to communicate with a running Oracle JRockit JVM process. These commands tell the JRockit JVM to for example print a heap report or a garbage collection activity report, or to turn on or off a specific verbose module. This chapter describes how to run diagnostic commands and lists the available commands. The following sections are included:
Diagnostic commands help you communicate with a running JRockit JVM process. With these commands you can for example ask for a heap report or enable or disable a verbose module.
You can send diagnostic commands to a running JVM process in several ways:
jrcmd
, a command line tool that sends the commands to a given JRockit JVM process.ctrlhandler.act
file and execute the commands listed therein.
You can enable or disable any diagnostic command using the system property -Djrockit.ctrlbreak.enable<name>=<true|false>
, where name
is the name of the diagnostic command. The following two handlers are disallowed by default and need to be turned on:
-Djrockit.ctrlbreak.enablerun_class=true
jrcmd
is a command line tool included with the JRockit JDK you can use to send diagnostic commands to a running JVM process. This section provides a brief overview of jrcmd
. It includes information on the following subjects:
jrcmd
uses the JRIPC library, a small C library, to communicate with a running JRockit JVM process. JRIPC has the following basic functionality
To use jrcmd
, simply enter it at the command line, with the appropriate parameters:
jrcmd
<jrockit pid> [
<command>
[
<arguments>
]] [-l] [-f file] [-p] -h]
[
<command>
[
<arguments>
]]
is any diagnostic command and its associated arguments; for example, version
, print_properties
, command_line
, and so on.-l
displays the counters exposed by this process-f
reads and execute commands from the file-p
lists JRockit JVM processes on the local machine-h
shows help
If the PID is 0, commands will be sent to all JRockit JVM processes. If no options are given, default is -p
.
Here are some examples of using jrcmd for:
Do the following to list all JRockit JVM processes running on the machine:
To send a command to the process you identified in Listing JRockit JVM Processes, do the following:
10064
) jrcmd
with that PID and the version
command; for example:> jrcmd 10064 version
This command sends the version
command to the JRockit JVM. The response will be:
Oracle WebLogic JRockit(R) Virtual Machine build 9.9.9-1.5.0-Jun 9 2004-13:52:53-<internal>, Native Threads, GC strategy: parallel
You can create a file (just like the ctrlhandler.act
file) with several commands and execute all of them. Use this procedure:
jrcmd
; for example:> jrcmd 10064 -f commands.txt
Oracle WebLogic JRockit(R) Virtual Machine build 9.9.9-1.5.0-Jun 9 2004-13:52:53-<internal>, Native Threads, GC strategy: parallel
==== Timestamp ==== uptime: 0 days, 00:05:04 time: Fri Jun 11 14:28:31 2004
0
to send the commands to all running JRockit JVM processes.When using jrcmd, be aware of these limitations:
jrcmd <pid> <command>
.
Another way you can run diagnostic commands is by pressing Ctrl-Break. When you press Ctrl-Break, the JRockit JVM will search for a file named ctrlhandler.act
(see Listing 21-1) in your current working directory. If it doesn't find the file there, it will look in the directory containing the JVM. If it does not find this file there either, it will revert to displaying the normal thread dump. If it finds the file, it will read the file searching for command entries, each of which invoke the corresponding diagnostic command.
set_filename filename=c:\output.txt append=true
print_class_summary
print_object_summary increaseonly=true
print_threads
print_threads nativestack=true
print_utf8pool
jrarecording filename=c:\myjra.xml time=120 nativesamples=true
verbosity set=memory,memdbg,codegen,opt,sampling filename="c:\output"
timestamp
stop
# ctrl-break-handler will stop reading the file after it finds
# the stop key-word
#
# version - print JRockit version
#
# print_threads - the normal thread dump that lists all the currently
# running threads and there state
#
# print_class_summary - prints a tree of the currently loaded classes
#
# print_utf8pool - print the internal utf8 pool
#
# print_object_summary - display info about how many objects of each
# type that are live currently and how much size
# they use. Also displays points to information
#
# jvmpi_datadump
#
# jvmpi_datareset
#
# jrarecording - starts a jrarecording
#
# verbosity - changes the verbosity level , not functional in ariane142_04
#
# start_management_server - starts a management server
# kill_management_server - shuts the management server down
# (the managementserver.jar has to be in the bootclasspath for
# these command to work)
#
#
In the ctrlhandler.act
file, each command entry starts with a Ctrl-Break Handler name followed by the arguments to be passed to the Ctrl-Break Handler. The arguments should be on the property form (that is, name=value; for example, set_filename filename=c:\output.txt append=true
). String, integer or boolean values are acceptable property types.
You can disable Ctrl-Break functionality by setting this command:
-Djrockit.dontusectrlbreakfile=true
.
Table 21-1 lists the currently available diagnostic commands.
Set the file which all commands following this command will use for printing. You can have several
set_filename commands in a file. It takes two arguments: filename and an optional append to specify if you want to append to the file or overwrite it. The default file is stderr , and to overwrite the file.
|
|||
See the
JRockit Memory Leak Detector User Guide (for JRockit Mission Control 1.0) or the Memory Leak Detector built-in help (for Oracle JRockit Mission Control 2.0 and later).
|
|||
|
|||
Prints out a comprehensive summary of garbage collection activity so far during the run. In order to be able to dynamically print out the same information as
-XgcReport would provide at the end of an application run, make sure to have the option flag -XgcReport in your start-up configuration, otherwise the correct measurements won't be performed.
|
|||
Enable/disable printing of exceptions (see
-Xverbose ). To turn exception printing off completely you need to set exceptions = false even if it was turned on by stacktraces = true .
|
|||
To get help about the available commands, execute the special command help
. This will print all available commands.