jinfo
命令为指定的 Java 进程生成 Java的扩展配置信息。此命令是实验性的,不受支持。对于核心文件,请使用 jhsdb
jinfo
。
jps -v
也可以查看,但是是查看当前机器所有的进程的JVM配置。
先打开命令行cmd
或powershell
或者哪个都可以,其实IDEA也可以打开Terminal
输入命令jinfo
,如果不可用的话试试jhsdb jinfo
,查看可用参数及介绍。这两个的内容差不多。我们按jinfo
介绍。
(base) PS G:\Project\highway-resources> jinfo
Usage:
jinfo <option> <pid>
(to connect to a running process)
where <option> is one of:
-flag <name> to print the value of the named VM flag
-flag [+|-]<name> to enable or disable the named VM flag
-flag <name>=<value> to set the named VM flag to the given value
-flags to print VM flags
-sysprops to print Java system properties
<no option> to print both VM flags and system properties
-? | -h | --help | -help to print this help message
(base) PS G:\Project\highway-resources> jhsdb jinfo
--flags To print VM flags.
--sysprops To print Java System properties.
<no option> To print both of the above.
--pid <pid> To attach to and operate on the given live process.
--core <corefile> To operate on the given core file.
--exe <executable for corefile>
--connect [<serverid>@]<host>[:registryport][/servername] To connect to a remote debug server (debugd).
The --core and --exe options must be set together to give the core
file, and associated executable, to operate on. They can use
absolute or relative paths.
The --pid option can be set to operate on a live process.
The --connect option can be set to connect to a debug server (debugd).
--core, --pid, and --connect are mutually exclusive.
Examples: jhsdb jinfo --pid 1234
or jhsdb jinfo --core ./core.1234 --exe ./myexe
or jhsdb jinfo --connect serverid@debugserver:1234/servername
jinfo的命令行格式为:jinfo <option> <pid>
,pid可以通过jps
命令查看。option选择在下面表格
选项(option) | 简述 |
---|---|
-flag name | 查看指定参数名称和值 |
-flag [+|-]name | 启用或禁用指定的布尔命令 |
-flag name=value | 给指定的参数设置值 |
-flags | 打印JVM的配置 |
-
jps -flags <pid>
查看JVM的配置,这个看的比较全,比较常用
(base) PS G:\Project\highway-resources> jinfo -flags 11096 VM Flags: -XX:CICompilerCount=4 -XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:G1EagerReclaimRemSetThreshold=16 -XX:G1HeapRegionSize=2097152 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=268435456 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=4271898624 -XX:MaxNewSize=2562719744 -XX:MinHeapDeltaBytes=2097152 -XX:MinHeapSize=8388608 -XX:NonNMethodCodeHeapSize=5839372 -XX:NonProfiledCodeHeapSize=122909434 -XX:ProfiledCodeHeapSize=122909434 -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:SoftMaxHeapSize=4271898624 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation
-
jhsdb jinfo --flags --pid <pid>
jhsdb jinfo查看JVM的参数。
(base) PS G:\Project\highway-resources> jhsdb jinfo --flags --pid 11096 Attaching to process ID 11096, please wait... Debugger attached successfully. Server compiler detected. JVM version is 17+35-LTS-2724 Non-default VM flags: -XX:CICompilerCount=4 -XX:ConcGCThreads=2 -XX:G1ConcRefinementThreads=8 -XX:G1EagerReclaimRemSetThreshold=16 -XX:G1HeapRegionSize=2097152 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=268435456 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=4271898624 -XX:MaxNewSize=2562719744 -XX:MinHeapDeltaBytes=2097152 -XX:MinHeapSize=8388608 -XX:NonNMethodCodeHeapSize=5839372 -XX:NonProfiledCodeHeapSize=122909434 -XX:ProfiledCodeHeapSize=122909434 -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:SoftMaxHeapSize=4271898624 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation