关于java:java性能调优命令行工具使用jps

35次阅读

共计 2022 个字符,预计需要花费 6 分钟才能阅读完成。

这篇仅仅记录参数应用, 大多数还是须要本人推敲

同时还须要保持

:)

jps

C:\Users\98du>jps -help
usage: jps [-help]
       jps [-q] [-mlvV] [<hostid>]

Definitions:
    <hostid>:      <hostname>[:<port>]

C:\Users\98du>

参数阐明

-q      : 过程 id

-m      : 启动该过程所 输出执行的 java 命令(不蕴含 jvm 参数)

-l      : 启动的 jar 文件名或者包类名

-v      : java 过程启动参数(进 jvm 参数 不蕴含 - m 的输入)

-V      : 过程工具简写(默认该参数)

hostid 这个参数须要为 hostname, 而不是 ip

jmap

C:\Users\98du>jmap -h
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

C:\Users\98du>

参数阐明

-heap       : 打印各过程的 jvm 参数配置, 同时会打印举荐配置

-histo      : 打印各个类的对象数及占用大小
-histo:live : 只计算流动的对象

-clstats    : 打印 class 加载的类..?

-finalizerinfo  : 打印正在 gc 的类.?

-dump
示例
C:\Users\98du>jmap -dump:format=b,file="D:\test\test-jmap\t.hprof" 18704
Dumping heap to D:\test\test-jmap\t.hprof ...
Heap dump file created

C:\Users\98du>

jstack

C:\Users\98du>jstack -h
Usage:
    jstack [-l] <pid>
        (to connect to running process)
    jstack -F [-m] [-l] <pid>
        (to connect to a hung process)
    jstack [-m] [-l] <executable> <core>
        (to connect to a core file)
    jstack [-m] [-l] [server_id@]<remote server IP or hostname>
        (to connect to a remote debug server)

Options:
    -F  to force a thread dump. Use when jstack <pid> does not respond (process is hung)
    -m  to print both java and native frames (mixed mode)
    -l  long listing. Prints additional information about locks
    -h or -help to print this help message

C:\Users\98du>

jconsole(图形化操作)

命令行或者 win+r 输出 jconsole 即可

多看看吧, 兄die


首发链接

正文完
 0