当前位置:网站首页>JVM调试工具-jstack
JVM调试工具-jstack
2022-06-24 06:39:00 【Angryshark_128】
jstack
常用命令
打印栈信息
> jstack 23766
2020-09-17 09:07:23
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode):
...
"GC task thread#22 (ParallelGC)" os_prio=0 tid=0x00007fd21c049000 nid=0x5cef runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007fd21c451800 nid=0x5d09 waiting on condition
JNI global references: 9644
打印附加锁信息,耗时较长,不建议使用
> jstack -l 23766
2020-09-17 09:10:47
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode):
"Ftp-JS-20200917-outputDetail" #26254 prio=5 os_prio=0 tid=0x00007fd04c086800 nid=0x31e8 waiting on condition
...
"GC task thread#22 (ParallelGC)" os_prio=0 tid=0x00007fd21c049000 nid=0x5cef runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007fd21c451800 nid=0x5d09 waiting on condition
JNI global references: 9648
打印java和native c/c++框架的所有栈信息.可以打印JVM的堆栈,显示上Native的栈帧,一般应用排查不需要使用
> jstack -m 23766
Attaching to process ID 23766, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.191-b12
Deadlock Detection:
No deadlocks found.
----------------- 23768 -----------------
0x00007fd22506c6d5 __pthread_cond_wait + 0xc5
0x00007fd224167d09 _ZN7Monitor5IWaitEP6Threadl + 0xe9
0x00007fd224169130 _ZN7Monitor4waitEblb + 0xf0
0x00007fd2243174d1 _ZN7Threads10destroy_vmEv + 0x51
0x00007fd223f5f366 jni_DestroyJavaVM + 0x76
0x00007fd224e513a8 JavaMain + 0x5b8
----------------- 23769 -----------------
0x00007fd22418ea53 _ZN13ObjArrayKlass19oop_follow_contentsEP20ParCompactionManagerP7oopDesc + 0x573
0x00007fd224210b6f _ZN20ParCompactionManager21follow_marking_stacksEv + 0xdf
0x00007fd2241f3a7b _ZN16StealMarkingTask5do_itEP13GCTaskManagerj + 0x2bb
0x00007fd223e60f36 _ZN12GCTaskThread3runEv + 0x1b6
0x00007fd2241a9c92 _ZL10java_startP6Thread + 0x102
...
jstat
jstat的主要作用就是对Java应用程序的资源和性能进行实时监控的命令行工具,主要包括GC情况和Heap Size资源使用情况。
命令个数:jstat - [-t] [-h] [ []]
option 常见的都是使用-gcutil查看gc情况,其他可选项见下图。
vmid : VM的进程号,即当前运行的java进程号。
interval : 间隔时间,单位为秒或毫秒
count:打印次数,如果缺省则打印无数次。
-class 统计加载class的数量及其所占空间大小等信息
-compiler 统计HotSpot实时编译的数量等信息
-gc 统计gc信息,包括young gc次数、young gc时间、full gc次数、full gc时间和gc总时间
-gccapacity 统计gc时,不同generations内存大小
-gccause 统计gc时,最近一次GC的信息(等效于-gcutil)和引起gc原因
-gcpermcapacity 统计gc时,permanent区大小(JDK7及其以前版本)
-gcmetacapacity 统计gc时,metaspace区大小(JDK8及其以后版本)
-gcnew 统计gc时,新生代内对象的信息
-gcnewcapacity 统计gc时,新生代大小
-gcold 统计gc时,老年代内对象的信息
-gcoldcapacity 统计gc时,老年代大小
-gcutil 统计gc时,最近一次GC的信息
-printcompilation hotspot编译方法统计
常用命令
垃圾回收统计,查看gc的统计信息,已使用/总空间的占比情况。
> jstat -gcutil 23766
S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
0.00 0.00 100.00 100.00 95.49 93.77 22256 2012.576 1843 5430.080 7442.657
| 参数 | 描述 |
|---|---|
| S0 | 年轻代中第一个survivor(幸存区)已使用的占当前容量百分比 |
| s1 | 年轻代中第二个survivor(幸存区)已使用的占当前容量百分比 |
| E | 年轻代中Eden已使用的占当前容量百分比 |
| O | old代已使用的占当前容量百分比 |
| M | 元空间(MetaspaceSize)已使用的占当前容量百分比 |
| CCS | 压缩使用比例 |
| YGC | 年轻代垃圾回收次数 |
| FGC | 老年代垃圾回收次数 |
| FGCT | 老年代垃圾回收消耗时间 |
| GCT | 垃圾回收消耗总时间 |
堆内存使用情况统计,单位KB
> jstat -gccapacity 23766
NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC MCMN MCMX MC CCSMN CCSMX CCSC YGC FGC
698880.0 10484736.0 10484736.0 3494912.0 3494912.0 3494912.0 1398272.0 20970496.0 20970496.0 20970496.0 0.0 1099776.0 57128.0 0.0 1048576.0 6952.0 22256 1881
| 参数 | 描述 |
|---|---|
| NGCMN | 新生代最小容量 |
| NGCMX | 新生代最大容量 |
| NGC | 当前新生代容量 |
| S0C | 第一个幸存区大小 |
| S1C | 第二个幸存区的大小 |
| EC | 伊甸园区的大小 |
| OGCMN | 老年代最小容量 |
| OGCMX | 老年代最大容量 |
| OGC | 当前老年代大小 |
| OC | 当前老年代大小 |
| MCMN | 最小元数据容量 |
| MCMX | 最大元数据容量 |
| MC | 当前元数据空间大小 |
| CCSMN | 最小压缩类空间大小 |
| CCSMX | 最大压缩类空间大小 |
| CCSC | 当前压缩类空间大小 |
| YGC | 年轻代gc次数 |
| FGC | 老年代GC次数 |
类加载统计
> jstat -class 23766
Loaded Bytes Unloaded Bytes Time
9193 17909.9 51 70.4 3821.14
| 参数 | 描述 |
|---|---|
| Loaded | 加载class的数量 |
| Bytes | 所占用空间大小 |
| Unloaded | 未加载数量 |
| Bytes | 未加载占用空间 |
| Time | 时间 |
查看编译任务状态
> jstat -compiler 23766
Compiled Failed Invalid Time FailedType FailedMethod
8491 3 0 1305.48 1 com/alibaba/druid/pool/DruidDataSource shrink
| 参数 | 描述 |
|---|---|
| Compiled | 编译任务执行数量 |
| Failed | 编译任务执行失败数量 |
| Invalid | 编译任务执行失效数量 |
| Time | 编译任务消耗时间 |
| FailedType | 最后一个编译失败任务的类型 |
| FailedMethod | 最后一个编译失败任务所在的类及方法 |
查看编译任务
> jstat -printcompilation 23766
Compiled Size Type Method
8492 80 1 sun/text/resources/FormatData <init>
| 参数 | 描述 |
|---|---|
| Compiled | 编译任务的数目 |
| Size | 方法生成的字节码的大小 |
| Type | 编译类型 |
| Method | 类名和方法名用来标识编译的方法 |
边栏推荐
- puzzle(019.1)Hook、Gear
- SAP实施项目上的内部顾问与外部顾问,相互为难还是相互成就?【英文版】
- C语言学生管理系统——可检查用户输入合法性,双向带头循环链表
- Go excel export tool encapsulation
- typescript vscode /bin/sh: ts-node: command not found
- In the middle of the year, I have prepared a small number of automated interview questions. Welcome to the self-test
- [binary number learning] - Introduction to trees
- Spark累加器和广播变量
- Programmers use personalized Wallpapers
- Deploy DNS server using dnsmasq
猜你喜欢

Arduino raised $32million to enter the enterprise market
![Jumping game ii[greedy practice]](/img/e4/f59bb1f5137495ea357462100e2b38.png)
Jumping game ii[greedy practice]

MAUI使用Masa blazor组件库

RealNetworks vs. Microsoft: the battle in the early streaming media industry

Interpreting top-level design of AI robot industry development

.NET7之MiniAPI(特别篇) :Preview5优化了JWT验证(上)

Nine unique skills of Huawei cloud low latency Technology

setInterval里面的函数不能有括号

【愚公系列】2022年6月 ASP.NET Core下CellReport报表工具基本介绍和使用

Virtual file system
随机推荐
Challenges brought by maker education to teacher development
How to operate the little red book account: making good use of the theory of long tail words
Application configuration management, basic principle analysis
With a goal of 50million days' living, pwnk wants to build a "Disneyland" for the next generation of young people
Interpreting top-level design of AI robot industry development
What are the easy-to-use character recognition software? Which are the mobile terminal and PC terminal respectively
开源与创新
LuChen technology was invited to join NVIDIA startup acceleration program
Accumulateur Spark et variables de diffusion
JSON online parsing and the structure of JSON
What is domain name resolution? What if the domain name cannot be resolved?
Basic knowledge of wechat applet cloud development literacy chapter (I) document structure
浅谈如何运营好小红书账号:利用好长尾词理论
Do you know about Statistics?
应用配置管理,基础原理分析
NVIDIA control panel does not open what is NVIDIA control panel
About Stacked Generalization
System design: partition or data partition
Easy car Interviewer: talk about MySQL memory structure, index, cluster and underlying principle!
【问题解决】虚拟机配置静态ip