1. 概述

1.1. 工具简介

jstack(Stack Trace for java),用于生成VM当前时刻的线程快照(一般称为threaddump或者javacore文件);

线程快照就是当前VM内每一条线程正在执行的方法堆栈集合,生成的快照信息可用于分析线程死锁、死循环、blocked等问题;

1.2. 命令帮助

wanghui@Mokalas-MacBook-Pro ~ $ 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
  • F:当正常情况下无法输出时,强制输出;
  • l:除输出堆栈信息外,额外输出关于锁的附加信息;
  • m:若调用本地方法,则可输出c/c++堆栈;
Copyright © 辉辉大侠@杭州 2017 all right reserved,powered by Gitbook修订时间: 2017-03-30 01:17:50

results matching ""

    No results matching ""