JDK 的命令行工具

一、jps 查询正在运行的虚拟机进程。

-m输出虚拟机进程启动时传递给main()函数的参数

-l输出进程执行的主类的全名

-v输出虚拟机进程启动时的JVM参数 

二、jinfo 查看虚拟机配置参数信息

三、jstack 生成java虚拟机当前时刻的线程快照

-F:当正常输出请求不被响应时,强制输出线程栈堆。

-l:显示关于锁的附加信息。

-m:显示本地方法栈

四、jmap 生成虚拟机内存转储快照

Usage:
    jmap [option] <pid>
        (to connect to running process)
    jmap [option] <executable <core>
        (to connect to a core file)
    jmap [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)

where <option> is one of:
    <none>               to print same info as Solaris pmap
    -heap                to print java heap summary
    -histo[:live]        to print histogram of java object heap; if the "live"
                         suboption is specified, only count live objects
    -clstats             to print class loader statistics
    -finalizerinfo       to print information on objects awaiting finalization
    -dump:<dump-options> to dump java heap in hprof binary format
                         dump-options:
                           live         dump only live objects; if not specified,
                                        all objects in the heap are dumped.
                           format=b     binary format
                           file=<file>  dump heap to <file>
                         Example: jmap -dump:live,format=b,file=heap.bin <pid>
    -F                   force. Use with -dump:<dump-options> <pid> or -histo
                         to force a heap dump or histogram when <pid> does not
                         respond. The "live" suboption is not supported
                         in this mode.
    -h | -help           to print this help message
    -J<flag>             to pass <flag> directly to the runtime system

五、jhat 分析 Jmap 产生的堆复制文件

jhat -J-Xmx512m heap.dmp

猜你喜欢

转载自blog.csdn.net/buyulian/article/details/83991798