Home

jstat

jstat is a command-line utility bundled with the Java Development Kit (JDK) that provides real-time statistics about a running Java Virtual Machine (JVM). It is designed for lightweight monitoring of memory usage, garbage collection, class loading, and related VM activities with minimal overhead, making it useful for quick diagnostics and tuning tasks. The tool is available on platforms that run the JDK, including Windows, macOS, and Linux.

Overview: jstat connects to a target VM and prints selected statistics to standard output. The target is

Usage: Typical usage is jstat -option pid interval count. For example, jstat -gc 1234 1000 5 prints

Remote monitoring: In environments requiring remote access, a jstatd daemon or the Attach API allows querying

Limitations: jstat is primarily designed for HotSpot-based VMs and may not expose all metrics on every JVM

identified
by
its
process
ID
(PID).
Data
can
be
sampled
at
regular
intervals
by
supplying
an
interval
and
a
count.
Common
options
include
-class
(class
loading
statistics),
-gc
(generation
and
garbage-collection
statistics),
-gccapacity
(memory
pool
capacities),
-gcutil
(garbage-collection
utilization),
and
-printcompilation
(compilation
activity).
GC-related
statistics
for
PID
1234
every
1
second,
for
five
samples.
Another
example,
jstat
-class
1234
1000
5,
shows
class-loading
activity
over
the
same
interval.
statistics
from
a
remote
JVM,
subject
to
security
policies.
Data
is
obtained
from
the
HotSpot
runtime
instrumentation.
implementation.
Output
formats
and
available
columns
can
vary
between
JVM
versions
and
builds.