JDK命令-jinfo

最后更新:2020-04-24

jinfo可以在程序执行时修改某个标志的值

	# jinfo -h
	Usage:
	    jinfo [option] <pid>
	        (to connect to running process)
	    jinfo [option] <executable <core>
	        (to connect to a core file)
	    jinfo [option] [server_id@]<remote server IP or hostname>
	        (to connect to remote debug server)
	
	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 of the above
	    -h | -help           to print this help message

打印所有的标志值

	# jinfo -flags 8605
	Attaching to process ID 8605, please wait...
	Debugger attached successfully.
	Server compiler detected.
	JVM version is 25.20-b23
	Non-default VM flags: -XX:CICompilerCount=3 -XX:InitialHeapSize=314572800 -XX:MaxHeapSize=314572800 -XX:MaxNewSize=157286400 -XX:MinHeapDeltaBytes=524288 -XX:NewRatio=1 -XX:NewSize=157286400 -XX:OldSize=157286400 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 
	Command line:  -Xms300m -Xmx300m -XX:NewRatio=1

打印单个标志值

	# jinfo -flag PrintGCDetails 8605
	-XX:-PrintGCDetails

开启或关闭摸个标志值

	#jinfo -flag +PrintGCDetails 8605
	# jinfo -flag PrintGCDetails 8605
	-XX:+PrintGCDetails
Edgar

Edgar
一个略懂Java的小菜比