码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-06-02 13:33:19      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:

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.


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

标签:

原文地址:http://my.oschina.net/phacks/blog/423785

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!