JVM jinfo命令

目录

查看

-fiags

-flag

设置值

扩展

java -XX:+PrintFlagsFinal


作用:实时查看和修改JVM配置参数

C:\Users\qianqian>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

查看

-fiags

查看赋过值的参数

C:\Users\qianqian>jinfo -flags 8740
Attaching to process ID 8740, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.211-b12
Non-default VM flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote 
-XX:CICompilerCount=3 -XX:ConcGCThreads=2 -XX:G1HeapRegionSize=1048576 
-XX:InitialHeapSize=268435456 -XX:+ManagementServer -XX:MarkStackSize=4194304 
-XX:MaxGCPauseMillis=100 -XX:MaxHeapSize=1073741824 -XX:MaxNewSize=643825664 
-XX:MinHeapDeltaBytes=1048576 -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers 
-XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC 
-XX:-UseLargePagesIndividualAllocation
Command line:  
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54923,suspend=y,server=n 
-XX:+UseG1GC -Xmx1G -XX:MaxGCPauseMillis=100 -XX:TieredStopAtLevel=1 -Xverify:none 
-Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote 
-Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain 
-Dspring.application.admin.enabled=true 
-javaagent:C:\Users\qianqian\AppData\Local\JetBrains\IntelliJIdea2020.2\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8

-flag

查看某个参数具体的值

C:\Users\qianqian>jinfo -flag UseG1GC 8740
-XX:+UseG1GC

C:\Users\qianqian>jinfo -flag MaxHeapSize 8740
-XX:MaxHeapSize=1073741824

设置值

参数被标记为manageable的flag才可以被实时修改。其实极其有限

C:\Users\qianqian>jinfo -flag PrintGCDetails 8740
-XX:-PrintGCDetails

C:\Users\qianqian>jinfo -flag +PrintGCDetails 8740

C:\Users\qianqian>jinfo -flag PrintGCDetails 8740
-XX:+PrintGCDetails

C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio 8740
-XX:MaxHeapFreeRatio=70

C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio=100 8740

C:\Users\qianqian>jinfo -flag MaxHeapFreeRatio 8740
-XX:MaxHeapFreeRatio=100

扩展

java -XX:+PrintFlagsFinal

C:\Users\qianqian>java -XX:+PrintFlagsFinal > 1.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值