Java Reference
In-Depth Information
Notes
This command is not strictly necessary as the standard Unix
ps
command could
suffice. However, it does not use the standard Unix mechanism for interrogating the
process, so there are circumstances where a Java process stops responding (and
looks dead to
jps
) but is still listed as alive by the operating system.
jstat
Basic usage
jstat <pid>
Description
This command displays some basic statistics about a given Java process. This is usu‐
ally a local process, but can be located on a remote machine, provided the remote
side is running a suitable
jstatd
process.
Common switches
-options
Reports a list of report types that
jstat
can produce
-class
Report on classloading activity to date
-compiler
JIT compilation of the process so far
-gcutil
Detailed GC report
-printcompilation
More detail on compilation
Notes
The general syntax
jstat
uses to identify a process (which may be remote) is:
[<
protocol
>:
//]<vmid>[@hostname][:port][/servername]
The general syntax is used to specify a remote process (which is usually connected
to via JMX over RMI), but in practice, the local syntax is far more common, which
simply uses the VM ID, which is the operating system process ID on mainstream
platforms (such as Linux, Windows, Unix, Mac, etc.).