jinfo可以实时查看和调整虚拟机各项参数
语法 jinfo [option] {pid}
option可选值:
-flag {name}
打印指定的JVM参数值。
如:
查看新生代中Eden区域和Survivor区域(From幸存区或To幸存区)的比例
jinfo -flag SurvivorRatio 55394
结果为: -XX:SurvivorRatio=8
查看永久代最大空间
jinfo -flag MaxPermSize pid
结果为:-XX:MaxPermSize=85983232
-flag [+|-]name
使指定的VM参数生效或者失效
如:
jinfo -flag -PrintGCDateStamps 12905
结果为:使PrintGCDateStamps失效
-flag name=value
为指定的VM参数(name)设置指定的值(value)
如:
jinfo -flag MaxHeapFreeRatio=80 12905
再通过
jinfo -flag MaxHeapFreeRatio 12905
查看其值
结果为: -XX:MaxHeapFreeRatio=80
-flags:
打印所有的VM参数
如:
jinfo -flags 12905
结果为:
Non-default VM flags: -XX:CICompilerCount=2 -XX:CMSFullGCsBeforeCompaction=0 -XX:CMSInitiatingOccupancyFraction=80 -XX:+DisableExplicitGC -XX:ErrorFile=null -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=null -XX:InitialCodeCacheSize=134217728 -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=1073741824 -XX:MaxMetaspaceSize=268435456 -XX:MaxNewSize=268435456 -XX:MinHeapDeltaBytes=196608 -XX:NewSize=268435456 -XX:OldPLABSize=16 -XX:OldSize=805306368 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:ReservedCodeCacheSize=134217728 -XX:SurvivorRatio=8 -XX:+UseCMSCompactAtFullCollection -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseFastUnorderedTimeStamps -XX:+UseParNewGC Command line: -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.io.tmpdir=/opt/micheal/tmp -Djava.net.preferIPv6Addresses=false -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Xmx1g -Xms1g -Xmn256m -XX:SurvivorRatio=8 -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:ReservedCodeCacheSize=128m -XX:InitialCodeCacheSize=128m -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+UseConcMarkSweepGC -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSFullGCsBeforeCompaction=0 -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=80 -Xloggc:/opt/logs/mobile/xm.test.read/xm.test.read.gc.log -XX:ErrorFile=/opt/logs/mobile/xm.test.read/xm.test.read.vmerr.log -XX:HeapDumpPath=/opt/logs/mobile/xm.test.read/xm.test.read.heaperr.log -Djetty.appkey=xm.test.read -Djetty.context=/ -Djetty.logs=/opt/logs/mobile/xm.test.read -Djetty.webroot=/opt/micheal/mobile/xm.test.read/webroot
其中,Command line是在启动java进程时写的命令行
-sysprops:
打印系统参数
如:
jinfo -sysprops 12905
结果为:
不列了,自己试试吧,参数很多。归根结底都是系统参数
no-option
即,没有任何option。会打印所有的JVM参数和系统参数。等同于-flags
+ -sysprops