arthas使用

安装

  • 第一步:下载arthas 安装jar包
curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar

日常使用命令

详细参考:https://arthas.aliyun.com/doc/en/commands.html

trace

  • 作用:跟踪方法调用路径,并输出路径中每个节点的时间开销。
    trace:命名名称
    demo.MathGame:类名全路径
    run:方法名称
    '#cost>2':条件(耗时大于2毫秒)

  • 查看耗时大于2毫秒的调用

trace demo.MathGame run '#cost>2'
  • 只查看第一条
trace demo.MathGame run -n 1
  • 线下jdk方法调用
trace --skipJDKMethod false demo.MathGame run

thread

  • 查看当前有哪些线程
thread
  • 根据具体的线程id查看线程信息
thread 1
  • 查看当前有哪些阻塞的线程
thread -b
  • 计算最后1000毫秒的线程cpu时间
thread -i 1000
  • 列出1000毫秒内最繁忙的3个线程堆栈
thread -n 3 -i 1000

jad

反编译指定的类

  • 反编译指定类
- 反编译指定类的方法
jad demo.MathGame
jad demo.MathGame main

monitor

监控方法调用

  • 5次调用,监控成功和失败次数
monitor -c 5 demo.MathGame primeFactors
  • 5次调用,监控成功和失败次数,筛选条件是第一个参数小于等于2的情况
monitor -c 5 demo.MathGame primeFactors "params[0] <= 2"

jvm

查看jvm详细信息

sysprop

检查目标JVM中的系统属性

vmoption

显示并更新vm诊断选项

你可能感兴趣的:(arthas使用)