![52085e315efe7dc8479e7723c138bc07.png](https://img-blog.csdnimg.cn/img_convert/52085e315efe7dc8479e7723c138bc07.png)
这篇仅仅记录参数使用,大多数还是需要自己琢磨
同时还需要坚持
:)
jps
C:Users98du>jps -help
usage: jps [-help]
jps [-q] [-mlvV] [<hostid>]
Definitions:
<hostid>: <hostname>[:<port>]
C:Users98du>
参数说明
-q : 进程id
-m : 启动该进程所 输入执行的java 命令(不包含jvm参数)
-l : 启动的jar文件名或者包类名
-v : java进程启动参数(进jvm参数 不包含-m的输出)
-V : 进程工具简写(默认该参数)
hostid这个参数需要为hostname, 而不是ip
jmap
C:Users98du>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:Users98du>
参数说明
-heap : 打印各进程的jvm参数配置, 同时会打印推荐配置
-histo : 打印各个类的对象数及占用大小
-histo:live : 只计算活动的对象
-clstats : 打印class加载的类..?
-finalizerinfo : 打印正在gc的类.?
-dump
示例
C:Users98du>jmap -dump:format=b,file="D:testtest-jmapt.hprof" 18704
Dumping heap to D:testtest-jmapt.hprof ...
Heap dump file created
C:Users98du>
jstack
C:Users98du>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:Users98du>
jconsole(图形化操作)
命令行或者win+r
输入jconsole
即可
![5c8e2542965f61204f1237fc75ae0547.png](https://img-blog.csdnimg.cn/img_convert/5c8e2542965f61204f1237fc75ae0547.png)
多看看吧, 兄die
感谢您的查阅, 文章来自自己公众号中的笔记,
首发链接mp.weixin.qq.com谢谢