1. 下面是arthas官网 有非常详细的使用文档:
2. 官方推荐的下载,使用方式:
# 自己找个文件夹下载arthas jar包
cd /home
# 下载
curl -O https://arthas.aliyun.com/arthas-boot.jar
# 运行
java -jar arthas-boot.jar
3. 选择监控的jar 端口(输入数字即可)
4. 命令行输入:dashboard
5. thread 19查看线程运行
6. 反编译jad 命令 :
# 查看类
jad cn.test.mobile.controller.order.OrderController
# 查看方法
jad cn.test.mobile.controller.order.OrderController getOrderInfo
作用: 查看是否编译后的版本是否正确
7. trace 命令:
作用:输出方法内部调用路径,和路径上每个节点的耗时
# 命令-j是指过滤掉jdk中的方法
trace -j cn.test.mobile.controller.order.OrderController getOrderInfo
# 查看耗时长的: 单位ms ==>大于10ms 的
trace -j cn.test.mobile.controller.order.OrderController getOrderInfo '#cost > 10'
8. watch 命令:
作用:监测方法的入参和返回值
参数名称 | 参数说明 |
class-pattern | 类名表达式匹配 |
method-pattern | 方法名表达式匹配 |
express | 观察表达式 |
condition-express | 条件表达式 |
[b] | 方法调用前观察 |
[e] | 方法异常之后观察 |
[s] | 方法返回之后观察 |
[f] | 在方法结束之后(正常返回和异常返回)观察,默认选项 |
[E] | 开启正则表达式匹配,默认为通配符匹配 |
[x:] | 指定输出结果的属性遍历深度,默认为 1 |
# 遍历深度2
watch cn.test.mobile.controller.order.OrderController getOrderInfo "{params,returnObj}" -x 2
7. 其他很多命令查看官网