功能
- 查看JVM參數(shù)(常用)
- 查看系統(tǒng)參數(shù)同木,即可通過System.getProperty(key)獲得的參數(shù)(常用)
- 修改JVM參數(shù)(少用)
使用
命令
- 分析pid
jinfo [option] {pid}
pid
: 可通過jps或者ps獲得
- 分析core dump文件
jinfo [option] {executable} {core}
executable
: The Java executable from which the core dump was produced.core
: The core file for which the configuration information is to be printed.
- 分析遠程進程
jinfo [option] [ server-id ] {remote-hostname-or-IP}
server-id
: An optional unique ID to use when multiple debug servers are running on the same remote host.remote-hostname-or-IP
: 遠程服務的IP或者hostname
option可選值
no-option
即,沒有任何option疼阔。會打印所有的JVM參數(shù)和系統(tǒng)參數(shù)。等同于-flags
+ -sysprops
-flag {name}
打印指定的JVM參數(shù)值。
如:
jinfo -flag SurvivorRatio 55394
結(jié)果為: -XX:SurvivorRatio=8
jinfo -flag MaxPermSize pid
結(jié)果為:-XX:MaxPermSize=85983232
-flag [+|-]name
enables or disables指定的VM參數(shù),也就是使指定的VM參數(shù)生效或者失效
如:
jinfo -flag -PrintGCDateStamps 12905
結(jié)果為:使PrintGCDateStamps失效
-flag name=value
為指定的VM參數(shù)(name)設置指定的值(value)
如:
jinfo -flag MaxHeapFreeRatio=80 12905
再通過
jinfo -flag MaxHeapFreeRatio 12905
查看其值
結(jié)果為: -XX:MaxHeapFreeRatio=80
-flags:
打印所有的VM參數(shù)
如:
jinfo -flags 12905
結(jié)果為:
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:
打印系統(tǒng)參數(shù)
如:
jinfo -sysprops 12905
結(jié)果為:
不列了汰蓉,自己試試吧,參數(shù)很多棒卷。歸根結(jié)底都是系統(tǒng)參數(shù)
-h
幫助信息顾孽,你懂得