JVM命令jinfo
jinfo也是jvm中参与的一个命令,可以查看运行中jvm的全部参数,还可以设置部分参数。
格式
jinfo [ option ] pid
jinfo [ option ] executable core
jinfo [ option ] [server-id@]remote-hostname-or-IP
参数说明
pid 对应jvm的进程id
executable core 产生core dump文件
[server-id@]remote-hostname-or-IP 远程的ip或者hostname,server-id标记服务的唯一性id
option
no option 输出全部的参数和系统属性
-flag name 输出对应名称的参数
-flag [+|-]name 开启或者关闭对应名称的参数
-flag name=value 设定对应名称的参数
-flags 输出全部的参数
-sysprops 输出系统属性
实例
1 输出全部的参数和系统属性
[java@xftest0 ~]$ jinfo 43934 Attaching to process ID 43934, please wait... Debugger attached successfully. Server compiler detected. JVM version is 20.45-b01 Java System Properties: java.runtime.name = Java(TM) SE Runtime Environment sun.boot.library.path = /usr/java/jdk1.6.0_45/jre/lib/amd64 java.vm.version = 20.45-b01 java.vm.vendor = Sun Microsystems Inc. java.vendor.url = http://java.sun.com/ path.separator = : java.vm.name = Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg = sun.io sun.java.launcher = SUN_STANDARD env = dev user.country = US sun.os.patch.level = unknown
2 只输出参数
[java@xftest0 ~]$ jinfo -flags 43934 Attaching to process ID 43934, please wait... Debugger attached successfully. Server compiler detected. JVM version is 20.45-b01 -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true
刚才提到不是全部参数可以修改,只有部分,下面是可以修改的参数列表
SZ-sten:go sten$ java -XX:+PrintFlagsFinal -version |grep manageable intx CMSAbortablePrecleanWaitMillis = 100 {manageable} intx CMSWaitDuration = 2000 {manageable} bool HeapDumpAfterFullGC = false {manageable} bool HeapDumpBeforeFullGC = false {manageable} bool HeapDumpOnOutOfMemoryError = false {manageable} ccstr HeapDumpPath = {manageable} uintx MaxHeapFreeRatio = 100 {manageable} uintx MinHeapFreeRatio = 0 {manageable} bool PrintClassHistogram = false {manageable} bool PrintClassHistogramAfterFullGC = false {manageable} bool PrintClassHistogramBeforeFullGC = false {manageable} bool PrintConcurrentLocks = false {manageable} bool PrintGC = false {manageable} bool PrintGCDateStamps = false {manageable} bool PrintGCDetails = false {manageable} bool PrintGCTimeStamps = false {manageable}
命令 java -XX:+PrintFlagsFinal -version是输出全部的参数
松下问童子,言师采药去。
只言此山中,云深不知处。