jinfo用法说明

以下几种用法

-flags pid :打印当前VM的参数

-flag <name> pid:打印指定JVM的参数值 

-flag [+|-]<name> pid:设置指定JVM参数的布尔值

-flag <name>=<value> pid:设置指定JVM参数的值

-sysprops  pid : 获取当前系统参数包括-D设置的参数

 当然并不是所有的参数都是允许修改的,只允许修改其中部分参数。

可以通过PrintFlagFinal参数打印支持的参数。

java -XX:+PrintFlagsFinal -version|grep manageable  

输出结果:
     intx CMSAbortablePrecleanWaitMillis            = 100                                 {manageable}
     intx CMSTriggerInterval                        = -1                                  {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 PrintGCID                                 = false                               {manageable}
     bool PrintGCTimeStamps                         = false                               {manageable}
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

1、jinfo -flags pid  

./jinfo -flags 13553

  输出结果:

Attaching to process ID 13553, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.51-b03
Non-default VM flags: -XX:CICompilerCount=4 -XX:InitialHeapSize=526385152 -XX:MaxHeapSize=8415870976 -XX:MaxNewSize=2804940800 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=175112192 -XX:OldSize=351272960 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC 
Command line: 

2、jinfo -flag <name> pid

./jinfo -flag InitialHeapSize 13553

  输出结果:

-XX:InitialHeapSize=526385152

3、jinfo -flag [+|-]<name> pid

./jinfo -flag +PrintGCDetails 13553

./jinfo -flag -PrintGCDetails 13553

4、jinfo -flag <name>=<value> pid

./jinfo -flag MaxHeapFreeRatio=10 13553

5、jinfo -sysprops  pid

通过以下方式启动Java程序:java -Dtest.dir=/opt -cp test.jar test.Main

./jinfo -flag test.dir 3532

输出结果中,存在启动时添加的-Dtest.dir=/opt

test.dir = /opt
posted @ 2018-01-02 19:50  woniu4  阅读(826)  评论(0编辑  收藏  举报