java 命令简单查看jvm内存使用状况

1、jps 虚拟机进程状况工具

语法  jsp [option] [hostid]

选项

作用

-q

只显示lvmid

-m

输出虚拟机启用时传入main方法参数

-l

输出主类全名

-v

输出jvm参数

注意:

如果在linux环境中jps命令不能输出vmid数据(jdk1.6.0.23/24 bug),需要修改catalina.sh文件

if [ -z "$CATALINA_TMPDIR" ] ; then?# Define the java.io.tmpdir to use for Catalina?# CATALINA_TMPDIR="$CATALINA_BASE"/temp?CATALINA_TMPDIR=/tmp?fi

修改CATALINA_TMPDIR路径

2、jstat 虚拟机统计信息监控工具

语法:

jstat [option vmid [interval[s|ms]] [count]]

option选项

class

统计class loader行为信息

compiler

统计编译行为信息

gc

统计jdk gc时heap信息

gccapacity

统计堆内存不同代的heap容量信息

gccause

统计gc的情况(同-gcutil)和引起gc的事件

gcnew

统计gc时新生代的信息(相比gcutil更详细)

gcnewcapacity

统计gc时新生代heap容量

gcold

统计gc时,老年区的情况

gcoldcapacity

统计gc时,老年区heap容量

gcpermcapacity

统计gc时,permanent区heap容量

gcutil

统计gc时,heap情况

printcompilation

统计编译行为信息

例如:

jstat -gc 1111 250 2

查看vmid为1111的虚拟机每个250毫秒执行一次,共执行两次

结果分析

-class option:Class Loader Statistics

ColumnDescription

Loaded

Number of classes loaded.

Bytes

Number of Kbytes loaded.

Unloaded

Number of classes unloaded.

Bytes

Number of Kbytes unloaded.

Time

Time spent performing class load and unload operations.

-compiler:HotSpot Just-In-Time Compiler Statistics

ColumnDescription

Compiled

Number of compilation tasks performed.

Failed

Number of compilation tasks that failed.

Invalid

Number of compilation tasks that were invalidated.

Time

Time spent performing compilation tasks.

FailedType

Compile type of the last failed compilation.

FailedMethod

Class name and method for the last failed compilation.

-gc Option:Garbage-collected heap statistics

ColumnDescription

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 old space capacity (KB).

OU

Old space utilization (KB).

PC

Current permanent 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.

-gccapacity Option:Memory Pool Generation and Space Capacities

ColumnDescription

NGCMN

Minimum new generation capacity (KB).

NGCMX

Maximum new generation capacity (KB).

NGC

Current new generation capacity (KB).

S0C

Current survivor space 0 capacity (KB).

S1C

Current survivor space 1 capacity (KB).

EC

Current eden space capacity (KB).

OGCMN

Minimum old generation capacity (KB).

OGCMX

Maximum old generation capacity (KB).

OGC

Current old generation capacity (KB).

OC

Current old space capacity (KB).

PGCMN

Minimum permanent generation capacity (KB).

PGCMX

Maximum Permanent generation capacity (KB).

PGC

Current Permanent generation capacity (KB).

PC

Current Permanent space capacity (KB).

YGC

Number of Young generation GC Events.

FGC

Number of Full GC Events.

-gccause Option:Garbage Collection Statistics, Including GC Events

ColumnDescription

LGCC

Cause of last Garbage Collection.

GCC

Cause of current Garbage Collection.

前面的字段与gcutil相同.

-gcnew Option:New Generation Statistics

ColumnDescription

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).

TT

Tenuring threshold.

MTT

Maximum tenuring threshold.

DSS

Desired survivor size (KB).

EC

Current eden space capacity (KB).

EU

Eden space utilization (KB).

YGC

Number of young generation GC events.

YGCT

Young generation garbage collection time.

-gcnewcapacity Option:New Generation Space Size Statistics

ColumnDescription

NGCMN

Minimum new generation capacity (KB).

NGCMX

Maximum new generation capacity (KB).

NGC

Current new generation capacity (KB).

S0CMX

Maximum survivor space 0 capacity (KB).

S0C

Current survivor space 0 capacity (KB).

S1CMX

Maximum survivor space 1 capacity (KB).

S1C

Current survivor space 1 capacity (KB).

ECMX

Maximum eden space capacity (KB).

EC

Current eden space capacity (KB).

YGC

Number of young generation GC events.

FGC

Number of Full GC Events.

-gcold Option:Old and Permanent Generation Statistics

ColumnDescription

PC

Current permanent space capacity (KB).

PU

Permanent space utilization (KB).

OC

Current old space capacity (KB).

OU

old space utilization (KB).

YGC

Number of young generation GC events.

FGC

Number of full GC events.

FGCT

Full garbage collection time.

GCT

Total garbage collection time.

-gcoldcapacity Option:Old Generation Statistics

ColumnDescription

OGCMN

Minimum old generation capacity (KB).

OGCMX

Maximum old generation capacity (KB).

OGC

Current old generation capacity (KB).

OC

Current old space capacity (KB).

YGC

Number of young generation GC events.

FGC

Number of full GC events.

FGCT

Full garbage collection time.

GCT

Total garbage collection time.

-gcpermcapacity Option: Permanent Generation Statistics

ColumnDescription

PGCMN

Minimum permanent generation capacity (KB).

PGCMX

Maximum permanent generation capacity (KB).

PGC

Current permanent generation capacity (KB).

PC

Current permanent space capacity (KB).

YGC

Number of young generation GC events.

FGC

Number of full GC events.

FGCT

Full garbage collection time.

GCT

Total garbage collection time.

-gcutil Option:Summary of Garbage Collection Statistics

ColumnDescription

S0

Survivor space 0 utilization as a percentage of the space‘s current capacity.

S1

Survivor space 1 utilization as a percentage of the space‘s current capacity.

E

Eden space utilization as a percentage of the space‘s current capacity.

O

Old space utilization as a percentage of the space‘s current capacity.

P

Permanent space utilization as a percentage of the space‘s current capacity.

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.

-printcompilation Option: HotSpot Compiler Method Statistics

ColumnDescription

Compiled

Number of compilation tasks performed.

Size

Number of bytes of bytecode for the method.

Type

Compilation type.

Method

Class name and method name identifying the compiled method. Class name uses "/" instead of "." as namespace separator. Method name is the method within the given class. The format for these two fields is consistent with the HotSpot -XX:+PrintComplation option.

时间: 2024-10-08 21:23:42

java 命令简单查看jvm内存使用状况的相关文章

查看JVM内存

你知道如何进行JVM内存查看,这里和大家分享几个JVM内存查看方法,希望对你的学习有所帮助,通常情况下可以用代码查看,也可以在eclipse中增添相关信息后直接查看. JVM内存查看方法 可以用代码查看,也可以在eclipse中增添相关信息后直接查看. 1.用下面的代码进行JVM内存查看 1 memory.java 2 3 importjava.lang.Runtime; 4 5 publicclassmemory{ 6 publicstaticvoidmain(Stringargs[]){ 7

【JVM】【linux】linux上执行jmap命令查看JVM内存使用情况,报错:sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypes" in any of the known library name

运行命令: jmap -heap 6709 报错如下: Attaching to process ID 6709, please wait... sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypes" in any of the known library names (libjvm.so, libjvm_g.so, gamma_g) at sun.jvm.hotsp

Java学习之:JVM内存模型

一.文章来由 开始实习啦,实习转战Java开发工程师... 二.JVM内存模型总图 Java中通过多线程机制使得多个任务同时执行处理,所有的线程共享JVM内存区域main memory,而每个线程又单独的有自己的工作内存,当线程与内存区域进行交互时,数据从主存拷贝到工作内存,进而交由线程处理(操作码+操作数). 在之前,我们也已经提到,JVM的逻辑内存模型如下: 三.JVM内存模型详解 1.程序计数器 程序计数器(Program Counter Register)是一块较小的内存空间,它的作用可

java复习基础篇—-JVM内存结构(转)

主要内容如下: JVM启动流程 JVM基本结构 内存模型 编译和解释运行的概念 一.JVM启动流程: JVM启动时,是由java命令/javaw命令来启动的. 二.JVM基本结构: JVM基本结构图: <深入理解Java虚拟机(第二版)>中的描述是下面这个样子的: Java中的内存分配: Java程序在运行时,需要在内存中的分配空间.为了提高运算效率,就对数据进行了不同空间的划分,因为每一片区域都有特定的处理数据方式和内存管理方式. 具体划分为如下5个内存空间:(非常重要) 栈:存放局部变量

java中OutofMemoryError和JVM内存结构

OutOfMemoryError在开发过程中是司空见惯的,遇到这个错误,新手程序员都知道从两个方面入手来解决: 1:是排查程序是否有BUG导致内存泄漏: 2:是调整JVM启动参数增大内存. OutOfMemoryError有好几种情况,每次遇到这个错误时,观察OutOfMemoryError后面的提示信息,就可以发现不同之处,如: 引用 java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: unable t

Java性能剖析]Sun JVM内存管理和垃圾回收

内存管理和垃圾回收是JVM非常关键的点,对Java性能的剖析而言,了解内存管理和垃圾回收的基本策略非常重要.本篇对Sun JVM 6.0的内存管理和垃圾回收做大概的描述. 1.内存管理      在程序运行过程当中,会创建大量的对象,这些对象,大部分是短周期的对象,小部分是长周期的对象,对于短周期的对象,需要频繁地进行垃圾回收以保证无用对象尽早被释放掉,对于长周期对象,则不需要频率垃圾回收以确保无谓地垃圾扫描检测.为解决这种矛盾,Sun JVM的内存管理采用分代的策略.      1)年轻代(Y

【转】jstat命令查看jvm的GC情况 (以Linux为例)

[From]https://www.cnblogs.com/yjd_hycf_space/p/7755633.html jstat命令可以查看堆内存各部分的使用量,以及加载类的数量.命令的格式如下: jstat [-命令选项] [vmid] [间隔时间/毫秒] [查询次数]  注意!!!:使用的jdk版本是jdk8. 类加载统计: Loaded:加载class的数量 Bytes:所占用空间大小 Unloaded:未加载数量 Bytes:未加载占用空间 Time:时间 编译统计 Compiled:

jstat命令查看jvm的GC情况 (以Linux为例)

jstat命令可以查看堆内存各部分的使用量,以及加载类的数量.命令的格式如下: jstat [-命令选项] [vmid] [间隔时间/毫秒] [查询次数]  注意!!!:使用的jdk版本是jdk8. 类加载统计: Loaded:加载class的数量 Bytes:所占用空间大小 Unloaded:未加载数量 Bytes:未加载占用空间 Time:时间 编译统计 Compiled:编译数量. Failed:失败数量 Invalid:不可用数量 Time:时间 FailedType:失败类型 Fail

java笔记--关于多线程如何查看JVM中运行的线程

查看JVM中的线程 --如果朋友您想转载本文章请注明转载地址"http://www.cnblogs.com/XHJT/p/3890280.html "谢谢-- ThreadGroup(线程组)1.一个线程的集合,也可包含其他线程组2.线程组构成一棵树,除了初始化线程组外,每一个线程组都有一个父线程组3.允许线程访问有关自己的线程组的信息,但不能访问其父线程组或其他线程组的信息 常用方法:activeCount() 返回线程组中活动线程的估计数activeGroupCount() 返回线