性能分析工具-JINFO

JINFO介绍

The jinfo command-line utility gets configuration information from a running Java process or crash dump and prints the system properties or the command-line flags that were used to start the JVM.

“JINFO 命令工具可以从一个正在运行的java应用进程或者崩溃记录中获取配置属性,打印用于启动JVM的系统属性或命令行属性”

JINFO基本命令

1.概览

可以通过jinfo -help 查看jinfo支持的命令。如下:

/usr/local/java8/bin/jinfo -help

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

 

2.详细介绍

 

命令

说明

命令执行结果

jinfo  pid

以name-value的形式打印jvm启动参数和系统参数

/usr/local/java8/bin/jinfo 155543

Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment

java.vm.version = 25.45-b02

sun.boot.library.path = /usr/local/jdk1.8.0_45/jre/lib/amd64

java.protocol.handler.pkgs = org.springframework.boot.loader

java.vendor.url = http://java.oracle.com/

java.vm.vendor = Oracle Corporation

path.separator = :

file.encoding.pkg = sun.io

java.vm.name = Java HotSpot(TM) 64-Bit Server VM

sun.os.patch.level = unknown

sun.java.launcher = SUN_STANDARD

user.country = US

 

VM Flags:

Non-default VM flags: -XX:CICompilerCount=2 -XX:+CMSClassUnloadingEnabled

 

Command line:  -Xloggc:/var/

 

jinfo <-flag name> pid

打印指定参数的值

/usr/local/java8/bin/jinfo -flag CICompilerCount 155543 

-XX:CICompilerCount=2

jinfo <-flag [+/-]name> pid

设置boolean型属性生效/失效

/usr/local/java8/bin/jinfo -flag -HeapDumpOnOutOfMemoryError 155543 

/usr/local/java8/bin/jinfo -flag HeapDumpOnOutOfMemoryError 155543 

-XX:-HeapDumpOnOutOfMemoryError

jinfo <-flags> pid

打印JVM参数信息

/usr/local/java8/bin/jinfo -flags 155543 

Attaching to process ID 155543, please wait...

Debugger attached successfully.

Server compiler detected.

JVM version is 25.45-b02

Non-default VM flags: -XX:CICompilerCount=2

jinfo <-sysprops> pid

打印系统属性

/usr/local/java8/bin/jinfo -sysprops 155543 

Attaching to process ID 155543, please wait...

Debugger attached successfully.

Server compiler detected.

JVM version is 25.45-b02

java.runtime.name = Java(TM) SE Runtime Environment

java.vm.version = 25.45-b02

sun.boot.library.path = /usr/local/jdk1.8.0_45/jre/lib/amd64

java.protocol.handler.pkgs = org.springframework.boot.loader

java.vendor.url = http://java.oracle.com/

java.vm.vendor = Oracle Corporation

 

备注

在JDK8中介绍了JMC,JFR,JCMD等工具用来诊断jvm和java应用问题,与jinfo相比jcmd有更强的诊断能力和更小的性能开销。

JCMD的使用参考:https://blog.csdn.net/fresh_student_1/article/details/104750024

参考资料

https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr013.html

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值