-verbose:gc
-XX:+printGC
可以打印GC的简要信息
1
2
3
4
|
[GC 4790K->374K(15872K),
0.0001606
secs]
[GC 4790K->374K(15872K),
0.0001474
secs]
[GC 4790K->374K(15872K),
0.0001563
secs]
[GC 4790K->374K(15872K),
0.0001682
secs]
|
-XX:+PrintGCDetails 打印GC详细信息
1
|
例 [GC[DefNew: 4416K->0K(4928K),
0.0001897
secs] 4790K->374K(15872K),
0.0002232
secs] [Times: user=
0.00
sys=
0.00
, real=
0.00
secs]
|
-XX:+PrintGCTimeStamps 打印CG发生的时间戳,这个时间是相对于JVM启动时间的一个相对时间.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
0.346
: [GC0.
346
: [DefNew: 4416K->512K(4928K),
0.0047316
secs] 4416K->1189K(15872K),
0.0050057
secs] [Times: user=
0.00
sys=
0.02
, real=
0.02
secs]
0.604
: [GC0.
604
: [DefNew: 4928K->512K(4928K),
0.0047917
secs] 5605K->2042K(15872K),
0.0049892
secs] [Times: user=
0.00
sys=
0.00
, real=
0.00
secs]
0.862
: [GC0.
862
: [DefNew: 4928K->512K(4928K),
0.0043302
secs] 6458K->2547K(15872K),
0.0045277
secs] [Times: user=
0.02
sys=
0.00
, real=
0.02
secs]
1.097
: [GC1.
097
: [DefNew: 4928K->511K(4928K),
0.0035988
secs] 6963K->2942K(15872K),
0.0037924
secs] [Times: user=
0.00
sys=
0.02
, real=
0.02
secs]
1.332
: [GC1.
332
: [DefNew: 4927K->511K(4928K),
0.0036309
secs] 7358K->3295K(15872K),
0.0038239
secs] [Times: user=
0.01
sys=
0.00
, real=
0.01
secs]
1.501
: [Full GC1.
501
: [Tenured: 2783K->2593K(10944K),
0.0277544
secs] 6493K->2593K(15872K), [Perm : 4095K->4095K(4096K)],
0.0279980
secs] [Times: user=
0.03
sys=
0.00
, real=
0.03
secs]
1.529
: [Full GC1.
529
: [Tenured: 2593K->2593K(10944K),
0.0228733
secs] 2593K->2593K(15936K), [Perm : 4095K->4095K(4096K)],
0.0229870
secs] [Times: user=
0.02
sys=
0.00
, real=
0.02
secs]
1.555
: [Full GC1.
555
: [Tenured: 2593K->999K(10944K),
0.0235103
secs] 2678K->999K(15936K), [Perm : 4095K->4095K(4096K)],
0.0236762
secs] [Times: user=
0.02
sys=
0.00
, real=
0.02
secs]
1.579
: [Full GC1.
579
: [Tenured: 999K->983K(10944K),
0.0265414
secs] 1045K->983K(15936K), [Perm : 4095K->4092K(4096K)],
0.0267126
secs] [Times: user=
0.01
sys=
0.00
, real=
0.03
secs]
Heap
def
new
generation total 4992K, used 175K [
0x26720000
,
0x26c80000
,
0x2bc70000
)
eden space 4480K,
3
% used [
0x26720000
,
0x2674bd48
,
0x26b80000
)
from space 512K,
0
% used [
0x26b80000
,
0x26b80000
,
0x26c00000
)
to space 512K,
0
% used [
0x26c00000
,
0x26c00000
,
0x26c80000
)
tenured generation total 10944K, used 983K [
0x2bc70000
,
0x2c720000
,
0x36720000
)
the space 10944K,
8
% used [
0x2bc70000
,
0x2bd65ce0
,
0x2bd65e00
,
0x2c720000
)
compacting perm gen total 4096K, used 4094K [
0x36720000
,
0x36b20000
,
0x36b20000
)
the space 4096K,
99
% used [
0x36720000
,
0x36b1f948
,
0x36b1fa00
,
0x36b20000
)
ro space 10240K,
44
% used [
0x36b20000
,
0x36f97e30
,
0x36f98000
,
0x37520000
)
rw space 12288K,
52
% used [
0x37520000
,
0x37b6eb58
,
0x37b6ec00
,
0x38120000
)
|
-XX:+PrintGCDateStamps 打印CG发生的时间戳,是一个阅读性好的,普通的日期时间.
1
2
3
4
5
6
7
8
9
10
11
12
13
|
java -jar -XX:+PrintGCDateStamps -XX:+PrintGCDetails -verbose:gc yed.jar
2011
-
05
-11T17:
49
:
43.959
+
0800
: [GC [PSYoungGen: 15360K->2464K(17856K)] 15360K->8417K(58688K),
0.0260480
secs] [Times: user=
0.05
sys=
0.00
, real=
0.02
secs]
2011
-
05
-11T17:
49
:
44.612
+
0800
: [GC [PSYoungGen: 17824K->2484K(33216K)] 23777K->10471K(74048K),
0.0156130
secs] [Times: user=
0.03
sys=
0.00
, real=
0.02
secs]
2011
-
05
-11T17:
49
:
44.724
+
0800
: [GC [PSYoungGen: 33204K->2466K(33216K)] 41191K->10509K(74048K),
0.0088430
secs] [Times: user=
0.02
sys=
0.00
, real=
0.01
secs]
2011
-
05
-11T17:
49
:
44.771
+
0800
: [GC [PSYoungGen: 33186K->2466K(63936K)] 41229K->10509K(104768K),
0.0069690
secs] [Times: user=
0.02
sys=
0.00
, real=
0.01
secs]
2011
-
05
-11T17:
49
:
44.911
+
0800
: [GC [PSYoungGen: 63906K->2482K(63936K)] 71949K->10525K(104768K),
0.0071580
secs] [Times: user=
0.02
sys=
0.00
, real=
0.01
secs]
2011
-
05
-11T17:
49
:
47.282
+
0800
: [GC [PSYoungGen: 63922K->8765K(130048K)] 71965K->16807K(170880K),
0.0409860
secs] [Times: user=
0.07
sys=
0.01
, real=
0.04
secs]
|
-XX:+PrintGCDetails的输出
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
Heap 12288K+ 1536K [低边界 当前边界 最高边界]
def
new
generation total 13824K, used 11223K [
0x27e80000
,
0x28d80000
,
0x28d80000
) (
0x28d80000
-
0x27e80000
)/
1024
/
1024
=15M
eden space 12288K,
91
% used [
0x27e80000
,
0x28975f20
,
0x28a80000
)
from space 1536K,
0
% used [
0x28a80000
,
0x28a80000
,
0x28c00000
)
to space 1536K,
0
% used [
0x28c00000
,
0x28c00000
,
0x28d80000
)
tenured generation total 5120K, used 0K [
0x28d80000
,
0x29280000
,
0x34680000
)
the space 5120K,
0
% used [
0x28d80000
,
0x28d80000
,
0x28d80200
,
0x29280000
)
compacting perm gen total 12288K, used 142K [
0x34680000
,
0x35280000
,
0x38680000
)
the space 12288K,
1
% used [
0x34680000
,
0x346a3a90
,
0x346a3c00
,
0x35280000
)
ro space 10240K,
44
% used [
0x38680000
,
0x38af73f0
,
0x38af7400
,
0x39080000
)
rw space 12288K,
52
% used [
0x39080000
,
0x396cdd28
,
0x396cde00
,
0x39c80000
)
|
-Xloggc:log/gc.log 指定GC log的位置,以文件输出 帮助开发人员分析问题
目录可以是一个相对当前目录的相对地址,但是目录要存在,否则没有输出文件.