zoukankan      html  css  js  c++  java
  • jstack使用教程

    1. qmq是部署在tomcat中的应用名
    ps -ef | grep qmq | grep -v grep

    拿到进程号, 例如上面对应的是3192
    2. 第二步找出该进程内最耗费CPU的线程,可以使用ps -Lfp pid或者ps -mp pid -o THREAD, tid, time或者top -Hp pid
    例如用第三个 top -Hp 3192

    Tasks: 123 total,   0 running, 123 sleeping,   0 stopped,   0 zombie
    Cpu(s):  0.3%us,  0.4%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   3922688k total,  3272588k used,   650100k free,   432768k buffers
    Swap:  4194296k total,        0k used,  4194296k free,   596488k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
     3494 tomcat    20   0 4905m 1.1g  11m S  0.3 28.4   0:51.91 java
     3551 tomcat    20   0 4905m 1.1g  11m S  0.3 28.4   4:46.32 java
     3588 tomcat    20   0 4905m 1.1g  11m S  0.3 28.4   0:07.35 java
     3192 tomcat    20   0 4905m 1.1g  11m S  0.0 28.4   0:00.00 java
     3194 tomcat    20   0 4905m 1.1g  11m S  0.0 28.4   0:00.82 java
    

    3. TIME列就是各个Java线程耗费的CPU时间,CPU时间最长的是线程ID为3551的线程,用
    printf "%x " 3551
    得到ddf

    4. sudo -u tomcat jstack 3192 | grep ddf

    "New I/O worker #30" daemon prio=10 tid=0x00007f44fd525800 nid=0xde4 runnable [0x00007f4530ddf000]
    "DubboResponseTimeoutScanTimer" daemon prio=10 tid=0x00007f44fca88000 nid=0xddf waiting on condition [0x00007f45322e5000]
  • 相关阅读:
    解析ASP.NET WebForm和Mvc开发的区别
    relink:在Linux/UNIX平台上relink Oracle软件(转)
    Java开发 Eclipse使用技巧(转)
    职场人生:情商
    RPC
    PLSQL Developer Debug
    uC/OS-III学习2::uC/OS-III LED闪烁实验
    Flex文件读取报错
    C++字节对齐问题
    写可測试的代码
  • 原文地址:https://www.cnblogs.com/userrain/p/6142244.html
Copyright © 2011-2022 走看看