jstat用法
jstat(JVM Statistics Monitoring Tool)是用于监视虚拟机各种运行状态信息的命令行工具。它可以显示本地或者远程虚拟机进程中的类装载、内存、垃圾收集、JIT编译等运行数据,在没有GUI图形界面,只提供了纯文本控制台环境的服务器上,它将是运行期定位虚拟机性能问题的首选工具。
jstat命令格式为:
jstat [ option vmid [interval[s|ms] [count]] ]
对于命令格式中的VMID与LVMID需要特别说明一下:如果是本地虚拟机进程,VMID与LVMID是一致的,如果是远程虚拟机进程,那VMID的格式应当是:
[protocol:][//]lvmid[@hostname[:port]/servername]
参数interval和count代表查询间隔和次数,如果省略这两个参数,说明只查询一次。假设需要每250毫秒查询一次进程2764垃圾收集状况,一共查询20次,那命令应当是:
jstat -gc 2764 250 20
选项option代表着用户希望查询的虚拟机信息,主要分为3类:类装载、垃圾收集、运行期编译状况,其参数如下:
Option | Displays... |
---|---|
class | Statistics on the behavior of the class loader |
compiler | Statistics on the behavior of the HotSpot Just-In-Time compiler |
gc | Statistics on the behavior of the garbage collected heap |
gccapacity | Statistics of the capacities of the generations and their corresponding spaces. |
gccause | Summary of garbage collection statistics (same as -gcutil), with the cause of the last and current (if applicable) garbage collection events. |
gcnew | Statistics of the behavior of the new generation. |
gcnewcapacity | Statistics of the sizes of the new generations and its corresponding spaces. |
gcold | Statistics of the behavior of the old and permanent generations. |
gcoldcapacity | Statistics of the sizes of the old generation. |
gcpermcapacity | Statistics of the sizes of the permanent generation. |
gcutil | Summary of garbage collection statistics. |
printcompilation | Summary of garbage collection statistics. |
jstat执行样例:
IvydeMacBook-Air% jstat -gc 536
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
2560.0 2560.0 0.0 0.0 16896.0 5070.7 43520.0 0.0 21504.0 2901.1 0 0.000 0 0.000 0.000
显示 | 说明 |
---|---|
S0C | Current survivor space 0 capacity(KB). |
S1C | Current survivor space 1 capacity(KB). |
S0U | Survivor space 0 utilization(KB). |
S1U | Survivor space 1 utilization(KB). |
EC | Current eden space capacity(KB). |
EU | Eden space utilization(KB). |
OC | Current oldpace capacity(KB). |
OU | Old space utilization(KB). |
PC | Current permanet space capacity(KB). |
PU | Permanent space utilization(KB). |
YGC | Number of young generation GC Events. |
YGCT | Young generation garbage collection time. |
FGC | Number of full GC events |
FGCT | Full garbage collection time. |
GCT | Total garbage collection time. |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· C# 深度学习:对抗生成网络(GAN)训练头像生成模型
· .NET 适配 HarmonyOS 进展
· 手把手教你更优雅的享受 DeepSeek
· 腾讯元宝接入 DeepSeek R1 模型,支持深度思考 + 联网搜索,好用不卡机!
· AI工具推荐:领先的开源 AI 代码助手——Continue
· 探秘Transformer系列之(2)---总体架构
· V-Control:一个基于 .NET MAUI 的开箱即用的UI组件库