1.dashboard
输入dashboard,按回车/enter,会展示当前进程的信息,按ctrl+c可以中断执行
3.3.9
ne
TarthME101621ASHLCaTD
TINE
yElti
H150
3
esttoyLAvaW
SignalDispatchar
RUVMARLE
arthas-NettyhttofelnetBoototrap-3-1
false
arthas-uforstot
NAITING
tolse
TIMEDHAITING
folse
orthos.commond-execute
TIMEDTMAITING
false
arthas-shell-sErver
TIMEDMNIIINC
NALIING
Talse
arthas-timer
TIMEDHALLING
ralse
container-t
LWEL
false
Henor
heap
7.78
edenSR
survivorspace
tenuredgen
.08
q,narkgweepconpact.tine(ns)
nonheap
.07
95.37
0.52
conpressedelanpspace
1024N
00K
100.00%
direcT
08.直a日4
出222.7.865
n.weunin
jawa.wengion
jdk/jdki.D.16/jr
Jaya.hos
9.a1
ywiemLag.nWeLnJje
●ID: Java级别的线程ID,注意这个ID不能跟jstack中的nativeID一一对应
●NAME: 线程名
●GROUP: 线程组名
●PRIORITY: 线程优先级, 1~10之间的数字,越大表示优先级越高
●STATE: 线程的状态
●CPU%: 线程消耗的cpu占比,采样100ms,将所有线程在这100ms内的cpu使用量求和,再算出每个线程的cpu使用占比。
●TIME: 线程运行总时间,数据格式为分:秒
●INTERRUPTED: 线程当前的中断位状态
●DAEMON: 是否是daemon线程
2.jad反编译指令
输入:jad + 文件全路径,如我想查看主启动类,则:
jadcom.arthas.ArthasApplication
arthas@30162]:
cLassLoader:
+ORGINGfRAMeWorkBo
sun.misc.auchersAppclassLoader@3deac69
sun.misc.achExtclassLoader?589b3632
Location:
fiLe:/opt/software/arthas/Arthas.jar!/BOO-INF/cLasse
DecompiledwithCFR.
Couldnotloadthefoilowingclasses:
org.springframework.boot,pringppication
org.springframework.boot.utconuriotication
packagecom.arthas
importorg.springframework.boot.ringpicatin
importorgspringframework.boot.utoconigurioictio
@SpringBootapplication
publicclassArthasApplication
main(Stringllargs)
publicstaticvoidm
Springapplicationunthpplicationi
Affect(row-cht:2)costin1563ms
3.thread
最忙的前N个线程并打印堆栈
arthas@30162]sthread-n3
cpuusage-100%RUNNABLE
arthas.command-execute"Id-37couusao
atsun.management.Threadmpl.dumhatih
atsun.management.threadmgehohema
stCo:Bt.mom
tComtabbab.rthorm
stCo.B
stoomobw.artb.om.mao.
可GbaarmiAoemmmmwmwm.
tteo.obboat.oeshaom.mmmm
tComtiba.rth.o
atjava.utt.cocurent.xuoexc)
atjava.uti.concut.uturaku(uturak
uboewd.otym.thmuomoloomowcomoo
ajoautt.oa.hoamerooomooom
atjoya.uti.cocut.xuxu
tjvautiukco)
atjava.lang.thread.run(Thread.java:748)
"RefeRenceHander2CAN
atjava.lang.objectwaittiMtod)
waltingonjava.ang.ef.ReferencesLock@40106a68
atjava.lang.object.waitjct.ja:
atjaya.lang.re.frence.tryHaddingencea
jaya.ang.ferenceteferenceHandLer.runeferenceJava:153)
TFLotzerLd3coulse-0WATiNyk
atjava.tang.objectwittio)
waitingonjava.ag.ck
atjaya.tang.e.eferenceoueue.removeefrenceoueuejaya;143)
atjava.lang.rencequeuencueay)
dtjaya.lang..aizi(n
所有线程的信息
器222中
HIMEDHAITIMG
aoaaoccoooacccoooacccoooc
HAITING
WAITING
ANAERAEREH.TELNETBOTSTIEN
BURNIAELI
RTIHAFL
Arthas-NenyhttprelnetBootstrap-.3-2
arthas-userStat
AITING
TIMED_WAITING
svsten
arthas.shell-server
NIMED_WAIIIN
container-0
hopnion.i.e.amnnaacteplm
httpnoe.0.0.0.m0oBlnckPollor
3188888
WAITINc
WALIING
HAITING
KAITING
NIOOO08O
HATTTNG
WAITING
N9
WAITING
http-n10-0.0.0.0-8090xec.
PN
WALIING
http-n10-0.0.0.0-80802xcc
WA开I限
http-n1o-0.0.0.0-8030xec8
http-nio-0.0.0.0-0080erfc9
指定线程的运行堆栈
如上有线程ID为37的,所以这里指明id=37
[arthas@301621thread37
"arthas-command-execute"Id-37RUNNABLE
atsun.management.threadmp.dumphradtihd)
atsun.management.Threadmp.gehd(hm
tCou.tobi.t..
atCotm
afConabbb.wm
ttdHawa.artt.oom.mmcm
tEo.tBbBCa.m
tGMabbbattit.o8.om.moomm.
atcomBbagt
atjava.utit.cocurent.xecutorsskumaeder.u
atjava.uti.concurentFuturfaskuuueask.a;
mbmdom.oooouoaomo
ajovawtt.oarem.mom
atjavautit.cocurent.uk
atjayauttoxukxuo)
atjava.tang.Thread.run(Thread.java:748)
当前阻塞其他线程的线程
无阻塞返回
[arthas@30162]$thread
Nomostblockingthreadfound!
有阻塞返回
注意, 目前只支持找出synchronized关键字阻塞住的线程, 如果是java.util.concurrent.Lock, 目前还不支持。
指定采样时间间隔
arthas@30162sthreadn3-11000
"arthas.command-executeld-37couusage-493RUNNABLE
atsun.management.hreadm.dumhredth
atsun.management.Tradml.gtheadnfo(hedmla4
afGoma.tmo
tComtaobag.rth.m.
atComb
utCoLbbB.m
t0bwooatwb.oeime
tobwooamboeme
utComabbag..
atjaya,util.concurent.xccutorsskualed.cuo)
atjava.uti.cocutuuu(uuaka
aoduTL.Cmuret3thauametraltohaaakomo
afbovauitomotthoomroteuossthuckmm
utv.utLou
atJovouttt.nu)
atjava.lang.Thread.run(Thread.java:748)
而w地
atsun.misc.unsate.park(NativeMethod)
watingojavautiut
atjaya.utit.conurnt.kkt
obwtt.otumemoh.htooowwom
AAtDS.Sooamo
sto.ut.wme.themoom
tJava.t.exuou
atjava.uttu
atjova.utit.cnuren.u)
torg.apathe.tomat.ut.
atjava.lang.Thread.run(Thread.java:748)
http:o000okt)
otsun.nio.ch.r.t
atsun.nlo.ch
atsun.nio.ch.Pmm
atsun.nio.chelectolmlkem
atsun.nio.chlcomcoma
torg:.path.totu
查看指定状态的线程
thread –state
状态:[RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, NEW, TERMINATED]
INE
WATTTNC
Q:
WAITING
0000080006000
WAITING
WALLING
WAITING
WATTING
HATTTNG
EH电3
WAITING
WAITING
WAWEINE
HATTTNG
hopnipo.0.0.0nanocacc6
WAITING
1中01.0.0.0.086600米4c-7
WAITING
true
http-n10.8.0.0.08080ex9c-8
3:U
WALIING
4.watch
查看方法耗时出参
如我有这样一个方法:
com.arthas.controiler;
package
importorg.springframework,steeotype.Controiler;
importorg.springframework.web.bindaottioneuestMaping
importorg.springframework.web.bindantationeoedy;
**
@authoryouzhaxiaobo
Qversion1.0
Ddate2020/8/1809:14
QDesc
*
@Controiler
publicclassArthasController
@RequestMapping(value
Itest")
@ResponseBody
publicstringarthasTeststringkey)
returnKey;
则指令为:
tarthasos01621watchcomarthas.controteontht
PressoorCtrl+Ctoabort.
Affect(classcount:,methodcount1)c
costin56msisteneId:2
result-@stringthelto]
ts-2020-08-1816:08:27;[cost-0.048968ms]
ts-20200-1816:08:32;[cost-0.036844ms]
result-@string[您好]
查看指定方法入参出参
Shell
运行代码复制代码
1
watch com.arthas.controller.ArthasController arthasTest "{params,returnObj}" -x 2
arthas@10999]
returnob
watchcom.athas.cotohe
params
Pressoorctrl+Ctoabort.
Affect(classcout:1.hu
t2020-08-1911:0:9;
@Objectul
@Stringthello]
@String[hello]
resultoarraylist
ts-2020-08-1911:05:47;[cost-0.072623ms]
@objectul
string[您好
@String[您好],
观察异常信息
arthasq1099915
vatchcom.arthas.contollerordercontrollerbinThread
@],throwExp
PressoorCtrl+cto
L+Ctoabort.
Aftect(classcount:,mthodcount:coie
t2020081911:09:1;tcost13
@Integer[14393],
avan.emoryror:unabletcreatth
alJavd.lang.thread.starte(NativeHlethod)
atjava.tang.thread.start(Thread.java:717
atcom.arthas.controterdton
atsunretectthcck
dtsun.eflect.tveethouccesolmp
atsun.etectetmhc
atjaya.anglctthoh
可可3mb0.hm.m.m
uQspmrawoko.mo.
叫d.oo
的种地心的心).聊.
0心
a0gprmgtateokwo.omm
utogpwgraioik.evec
torgspringfanwoke..
atog.ptwganoikeb.et
atoRg.3Plmgoke
atjavax,servlet.http.tpservet.ceerlet.)
tD3Plgmok
atjayax.servlet.httpttpservletce
atop.pm.tlm.ootoiom
torg.apathc.atatm
torg.apuche.ocoteock
atog.asthccaatmotm.
tog.cpidie.eaalma.ore.platmitem
tQpsprwtaiprkswo.htcm
5.退出Arthas
如果只是退出当前的连接,可以用quit或者exit命令。Attach到目标进程上的arthas还会继续运行,端口会保持开放,下次连接时可以直接连接上。
如果想完全退出arthas,可以执行stop命令。
1 人点赞
1