-statOption
Determines the statistics information the jstat command displays. The following lists the available options. Use the -options general option to display the list of options for a particular platform installation. See Stat Options and Output.
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
Stat Options and Output
The following information summarizes the columns that the jstat command outputs for each statOption.
-class option
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.
PS C:\Users\11860> jmap -help
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
手动导出映像文件
PS C:\Users\11860> jmap -dump:format=b,file=heap.hprof 11720
Dumping heap to L:\heap.hprof ...
Heap dump file created
jmap相关命令
PS C:\Users\11860> jmap -heap 11720
Attaching to process ID 11720, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.151-b12
using thread-local object allocation.
Parallel GC with 8 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 33554432 (32.0MB)
NewSize = 11010048 (10.5MB)
MaxNewSize = 11010048 (10.5MB)
OldSize = 22544384 (21.5MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 7864320 (7.5MB)
used = 6748264 (6.435646057128906MB)
free = 1116056 (1.0643539428710938MB)
85.80861409505208% used
From Space:
capacity = 1572864 (1.5MB)
used = 950272 (0.90625MB)
free = 622592 (0.59375MB)
60.416666666666664% used
To Space:
capacity = 1572864 (1.5MB)
used = 0 (0.0MB)
free = 1572864 (1.5MB)
0.0% used
PS Old Generation
capacity = 22544384 (21.5MB)
used = 21187512 (20.20598602294922MB)
free = 1356872 (1.2940139770507812MB)
93.9813303392987% used
16212 interned Strings occupying 2160560 bytes.
PS C:\Users\11860> jstack
Usage:
jstack [-l]
(to connect to running process)
jstack -F [-m] [-l]
(to connect to a hung process)
jstack [-m] [-l]
(to connect to a core file)
jstack [-m] [-l] [server_id@]
(to connect to a remote debug server)
Options:
-F to force a thread dump. Use when jstack does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
-h or -help to print this help message