JDK提供的免费的JVM监控与故障处理工具有:
class
: Displays statistics about the behavior of the class loader.
compiler
: Displays statistics about the behavior of the Java HotSpot VM Just-in-Time compiler.
gc
: Displays statistics about the behavior of the garbage collected heap.
gccapacity
: Displays statistics about the capacities of the generations and their corresponding spaces.
gccause
: Displays a summary about garbage collection statistics (same as -gcutil
), with the cause of the last and current (when applicable) garbage collection events.
gcnew
: Displays statistics of the behavior of the new generation.
gcnewcapacity
: Displays statistics about the sizes of the new generations and its corresponding spaces.
gcold
: Displays statistics about the behavior of the old generation and metaspace statistics.
gcoldcapacity
: Displays statistics about the sizes of the old generation.
gcmetacapacity
: Displays statistics about the sizes of the metaspace.
gcutil
: Displays a summary about garbage collection statistics.
printcompilation
: Displays Java HotSpot VM compilation method statistics.
Class loader statistics.
Loaded
: Number of classes loaded.
Bytes
: Number of kBs loaded.
Unloaded
: Number of classes unloaded.
Bytes
: Number of Kbytes unloaded.
Time
: Time spent performing class loading and unloading operations.
Java HotSpot VM Just-in-Time compiler statistics.
Compiled
: Number of compilation tasks performed.
Failed
: Number of compilations tasks failed.
Invalid
: Number of compilation tasks that were invalidated.
Time
: Time spent performing compilation tasks.
FailedType
: Compile type of the last failed compilation.
FailedMethod
: Class name and method of the last failed compilation.
Garbage-collected heap statistics.
S0C
: Current survivor space 0 capacity (kB).
S1C
: Current survivor space 1 capacity (kB).
S0U
: Survivor space 0 utilization (kB).
S1U
: Survivor space 1 utilization (kB).
EC
: Current eden space capacity (kB).
EU
: Eden space utilization (kB).
OC
: Current old space capacity (kB).
OU
: Old space utilization (kB).
MC
: Metaspace capacity (kB).
MU
: Metacspace utilization (kB).
CCSC
: Compressed class space capacity (kB).
CCSU
: Compressed class space used (kB).
YGC
: Number of young generation garbage collection events.
YGCT
: Young generation garbage collection time.
FGC
: Number of full GC events.
FGCT
: Full garbage collection time.
GCT
: Total garbage collection time.
Memory pool generation and space capacities.
NGCMN
: Minimum new generation capacity (kB).
NGCMX
: Maximum new generation capacity (kB).
NGC
: Current new generation capacity (kB).
S0C
: Current survivor space 0 capacity (kB).
S1C
: Current survivor space 1 capacity (kB).
EC
: Current eden space capacity (kB).
OGCMN
: Minimum old generation capacity (kB).
OGCMX
: Maximum old generation capacity (kB).
OGC
: Current old generation capacity (kB).
OC
: Current old space capacity (kB).
MCMN
: Minimum metaspace capacity (kB).
MCMX
: Maximum metaspace capacity (kB).
MC
: Metaspace capacity (kB).
CCSMN
: Compressed class space minimum capacity (kB).
CCSMX
: Compressed class space maximum capacity (kB).
CCSC
: Compressed class space capacity (kB).
YGC
: Number of young generation GC events.
FGC
: Number of full GC events.
This option displays the same summary of garbage collection statistics as the -gcutil
option, but includes the causes of the last garbage collection event and (when applicable) the current garbage collection event. In addition to the columns listed for -gcutil
, this option adds the following columns.
LGCC
: Cause of last garbage collection
GCC
: Cause of current garbage collection
New generation statistics.
S0C
: Current survivor space 0 capacity (kB).
S1C
: Current survivor space 1 capacity (kB).
S0U
: Survivor space 0 utilization (kB).
S1U
: Survivor space 1 utilization (kB).
TT
: Tenuring threshold.
MTT
: Maximum tenuring threshold.
DSS
: Desired survivor size (kB).
EC
: Current eden space capacity (kB).
EU
: Eden space utilization (kB).
YGC
: Number of young generation GC events.
YGCT
: Young generation garbage collection time.
New generation space size statistics.
NGCMN
: Minimum new generation capacity (kB).
NGCMX
: Maximum new generation capacity (kB).
NGC
: Current new generation capacity (kB).
S0CMX
: Maximum survivor space 0 capacity (kB).
S0C
: Current survivor space 0 capacity (kB).
S1CMX
: Maximum survivor space 1 capacity (kB).
S1C
: Current survivor space 1 capacity (kB).
ECMX
: Maximum eden space capacity (kB).
EC
: Current eden space capacity (kB).
YGC
: Number of young generation GC events.
FGC
: Number of full GC events.
Old generation and metaspace behavior statistics.
MC
: Metaspace capacity (kB).
MU
: Metaspace utilization (kB).
CCSC
: Compressed class space capacity (kB).
CCSU
: Compressed class space used (kB).
OC
: Current old space capacity (kB).
OU
: Old space utilization (kB).
YGC
: Number of young generation GC events.
FGC
: Number of full GC events.
FGCT
: Full garbage collection time.
GCT
: Total garbage collection time.
Old generation size statistics.
OGCMN
: Minimum old generation capacity (kB).
OGCMX
: Maximum old generation capacity (kB).
OGC
: Current old generation capacity (kB).
OC
: Current old space capacity (kB).
YGC
: Number of young generation GC events.
FGC
: Number of full GC events.
FGCT
: Full garbage collection time.
GCT
: Total garbage collection time.
Metaspace size statistics.
MCMN
: Minimum metaspace capacity (kB).
MCMX
: Maximum metaspace capacity (kB).
MC
: Metaspace capacity (kB).
CCSMN
: Compressed class space minimum capacity (kB).
CCSMX
: Compressed class space maximum capacity (kB).
YGC
: Number of young generation GC events.
FGC
: Number of full GC events.
FGCT
: Full garbage collection time.
GCT
: Total garbage collection time.
Summary of garbage collection statistics.
S0
: Survivor space 0 utilization as a percentage of the space's current capacity.
S1
: Survivor space 1 utilization as a percentage of the space's current capacity.
E
: Eden space utilization as a percentage of the space's current capacity.
O
: Old space utilization as a percentage of the space's current capacity.
M
: Metaspace utilization as a percentage of the space's current capacity.
CCS
: Compressed class space utilization as a percentage.
YGC
: Number of young generation GC events.
YGCT
: Young generation garbage collection time.
FGC
: Number of full GC events.
FGCT
: Full garbage collection time.
GCT
: Total garbage collection time.
Java HotSpot VM compiler method statistics.
Compiled
: Number of compilation tasks performed by the most recently compiled method.
Size
: Number of bytes of byte code of the most recently compiled method.
Type
: Compilation type of the most recently compiled method.
Method
: Class name and method name identifying the most recently compiled method. Class name uses slash (/) instead of dot (.) as a name space separator. Method name is the method within the specified class. The format for these two fields is consistent with the HotSpot -XX:+PrintCompilation
option.
jinfo [ option ] pid
jinfo [ option ] executable core
jinfo [ option ] [ servier-id ] remote-hostname-or-IP
Prints both command-line flags and system property name-value pairs.
Prints the name and value of the specified command-line flag.
enables or disables the specified Boolean command-line flag.
Sets the specified command-line flag to the specified value.
Prints command-line flags passed to the JVM.
Prints Java system properties as name-value pairs.
Prints a help message.
Prints a help message.
The process ID for which the configuration information is to be printed. The process must be a Java process. To get a list of Java processes running on a machine, use the jps
(1) command.
The Java executable from which the core dump was produced.
The core file for which the configuration information is to be printed.
The remote debug server hostname
or IP
address. See jsadebugd
(1).
An optional unique ID to use when multiple debug servers are running on the same remote host.
jmap [ options ] pid
jmap [ options ] executable core
jmap [ options ] [ pid ] server-id@ ] remote-hostname-or-IP
When no option is used, the jmap
command prints shared object mappings. For each shared object loaded in the target JVM, the start address, size of the mapping, and the full path of the shared object file are printed. This behavior is similar to the Oracle Solaris pmap
utility.
Dumps the Java heap in hprof binary format to filename. The live suboption is optional, but when specified, only the active objects in the heap are dumped. To browse the heap dump, you can use the jhat(1) command to read the generated file.
Prints information about objects that are awaiting finalization.
-heapPrints a heap summary of the garbage collection used, the head configuration, and generation-wise heap usage. In addition, the number and size of interned Strings are printed.
-histo[:live]Prints a histogram of the heap. For each Java class, the number of objects, memory size in bytes, and the fully qualified class names are printed. The JVM internal class names are printed with an asterisk (*) prefix. If the live
suboption is specified, then only active objects are counted.
Prints class loader wise statistics of Java heap. For each class loader, its name, how active it is, address, parent class loader, and the number and size of classes it has loaded are printed.
-FForce. Use this option with the jmap -dump
or jmap -histo
option when the pid does not respond. The live
suboption is not supported in this mode.
Prints a help message.
-helpPrints a help message.
The process ID for which the memory map is to be printed. The process must be a Java process. To get a list of Java processes running on a machine, use the jps
(1) command.
The Java executable from which the core dump was produced.
coreThe core file for which the memory map is to be printed.
remote-hostname-or-IPThe remote debug server hostname
or IP
address. See jsadebugd
(1).
An optional unique ID to use when multiple debug servers are running on the same remote host.
jhat [ options ] heap-dump-file
Turns off tracking object allocation call stack. If allocation site information is not available in the heap dump, then you have to set this flag to false
. The default is true
.
Turns off tracking of references to objects. Default is true
. By default, back pointers, which are objects that point to a specified object such as referrers or incoming references, are calculated for all objects in the heap.
Sets the port for the jhat
HTTP server. Default is 7000.
Specifies a file that lists data members that should be excluded from the reachable objects query. For example, if the file lists java.lang.String.value
, then, then whenever the list of objects that are reachable from a specific object o
are calculated, reference paths that involve java.lang.String.value
field are not considered.
Specifies a baseline heap dump. Objects in both heap dumps with the same object ID are marked as not being new. Other objects are marked as new. This is useful for comparing two different heap dumps.
Sets the debug level for this tool. A level of 0 means no debug output. Set higher values for more verbose modes.
Reports the release number and exits
Displays a help message and exits.
Displays a help message and exits.
Passes flag
to the Java Virtual Machine on which the jhat
command is running. For example, -J-Xmx512m
to use a maximum heap size of 512 MB.
Java binary heap dump file to be browsed. For a dump file that contains multiple heap dumps, you can specify which dump in the file by appending #
to the file name, for example, myfile.hprof#3
.
jstack [ options ] pid
jstack [ options ] executable core
jstack [ options ] [ server-id@ ] remote-hostname-or-IP
Force a stack dump when jstack
[-l
] pid
does not respond.
Long listing. Prints additional information about locks such as a list of owned java.util.concurrent ownable synchronizers. See the AbstractOwnableSynchronizer class description at http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/AbstractOwnableSynchronizer.html
-mPrints a mixed mode stack trace that has both Java and native C/C++ frames.
-hPrints a help message.
-helpPrints a help message.
The process ID for which the stack trace is printed. The process must be a Java process. To get a list of Java processes running on a machine, use the jps
(1) command.
The Java executable from which the core dump was produced.
coreThe core file for which the stack trace is to be printed.
remote-hostname-or-IPThe remote debug server hostname
or IP
address. See jsadebugd
(1).
An optional unique ID to use when multiple debug servers are running on the same remote host.
VisualVM基于NetBeans平台开发,一开始就具备了插件扩展功能的特性,通过插件扩展支持,VisualVM可以做到: