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.

jstat用法的更多相关文章

  1. jstack jstat 简易使用教程

    jstack – 用来查看堆栈信息 jstat – 用来查看JVM相关信息 jstack用法 找到CPU使用最高的进程:top命令,然后按P,CPU使用率排序,就可以看到对应的pid 先说一种暴力的方 ...

  2. jvm 性能调优工具之 jstat

    概述 Jstat是JDK自带的一个轻量级小工具.全称“Java Virtual Machine statistics monitoring tool”,它位于java的bin目录下,主要利用JVM内建 ...

  3. Java常用命令:jps、jstack、jmap、jstat(带有实例教程)

      版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u013310517/article/details/80990924 查看Java进程:jps ...

  4. JVM内存结构与GC

    JVM内存模型总体架构图 程序计数器多线程时,当线程数超过CPU数量或CPU内核数量,线程之间就要根据时间片轮询抢夺CPU时间资源.因此每个线程有要有一个独立的程序计数器,记录下一条要运行的指令.线程 ...

  5. JVM系列(2)- jmap+mat实战内存溢出

    熟悉几个监控JVM的常用命令 1. jps -l 查出当前服务器运行的java进程 --- 2. jinfo用法(结合jps -l查到进程ID) 1).查看最大堆内存:jinfo -flag MaxH ...

  6. JDK之jstat的用法

    http://www.51testing.com/html/92/77492-203728.html jstat的用法 用以判断JVM是否存在内存问题呢?如何判断JVM垃圾回收是否正常?一般的top指 ...

  7. jvm性能调优---jstat的用法

    Jstat是JDK自带的一个轻量级小工具.全称“Java Virtual Machine statistics monitoring tool”,它位于java的bin目录下,主要利用JVM内建的指令 ...

  8. jstat的用法

    转载:http://www.51testing.com/html/92/77492-203728.html 用以判断JVM是否存在内存问题呢?如何判断JVM垃圾回收是否正常?一般的top指令基本上满足 ...

  9. Java命令行实用工具jps和jstat

    在Linux或其他UNIX和类UNIX环境下,ps命令想必大家都不陌生,我相信也有不少同学写过 ps aux | grep java | grep -v grep | awk '{print $2}' ...

随机推荐

  1. 删除 GPT 保护分区

    问题: 将内置和/或外置硬盘连接到 Windows XP 32 位操作系统时,将无法访问硬盘,“磁盘管理”将会报告该硬盘包含 GPT 保护分区.在此状态下,将无法对硬盘进行重新分区和格式化. 原因: ...

  2. LA 4127 - The Sky is the Limit (离散化 扫描线 几何模板)

    题目链接 非原创 原创地址:http://blog.csdn.net/jingqi814/article/details/26117241 题意:输入n座山的信息(山的横坐标,高度,山底宽度),计算他 ...

  3. ImageView的属性android:scaleType,即ImageView.setScaleType(ImageView.ScaleType)

    1 imageView.setScaleType(ImageView.ScaleType.FIT_XY ); 1 这里我们重点理解ImageView的属性android:scaleType,即Imag ...

  4. Codeforces 383A - Milking cows

    原题地址:http://codeforces.com/problemset/problem/383/A 题目大意:有 n 头奶牛,全部看着左边或者右边,现在开始给奶牛挤奶,给一头奶牛挤奶时,所有能看到 ...

  5. JAVA调用易信接口向指定好友推送消息(一)背景需求

    众所周知,中国电信内部一直使用易信群进行交流 各种工作交流都在易信群里面沟通 包括投诉处理,障碍报修,拍照上传 最重要的就是每天甚至每个时点的指标完成情况的通报 所以只能用4个字来形容 String ...

  6. bzoj1797: [Ahoi2009]Mincut 最小割

    最大流+tarjan.然后因为原来那样写如果图不连通的话就会出错,WA了很久. jcvb: 在残余网络上跑tarjan求出所有SCC,记id[u]为点u所在SCC的编号.显然有id[s]!=id[t] ...

  7. Android中Java反射技术的使用示例

    import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Metho ...

  8. 在PHP中如何获取用户的真实IP

    /** * 获得用户的真实IP地址 * * @access public * @return string */ function real_ip() { static $realip = NULL; ...

  9. How to easily create popup menu for DevExpress treelist z

    http://www.itjungles.com/how-to-easily-create-popup-menu-for-devexpress-treelist.html Adding popup m ...

  10. XCode修改工程名注意

    以下文字转载过来,在使用的过程中遇到几个问题 1.需要在 Build phases 里面,检查下 Link Binary With Libraries 以及Compline Sources 2.Bul ...