打印gc.log 观察gc情况

在catalina.sh加入 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:log/gc.log(具体位置应该都知道,set java_opts那里)

可以在/home/log下生产一个gc.log的文件 可以将此文件sz下来或者直接tail观看gc的情况。

以下是我gc.log中的一个片段

{Heap before GC invocations=1 (full 0): PSYoungGen total 917504K, used 31458K [0x00000007c0000000, 0x0000000800000000, 0x0000000800000000) eden space 786432K, 4% used [0x00000007c0000000,0x00000007c1eb8858,0x00000007f0000000) from space 131072K, 0% used [0x00000007f8000000,0x00000007f8000000,0x0000000800000000) to space 131072K, 0% used [0x00000007f0000000,0x00000007f0000000,0x00000007f8000000) ParOldGen total 1048576K, used 0K [0x0000000700000000, 0x0000000740000000, 0x00000007c0000000) object space 1048576K, 0% used [0x0000000700000000,0x0000000700000000,0x0000000740000000) PSPermGen total 131072K, used 10488K [0x00000006f0000000, 0x00000006f8000000, 0x0000000700000000) object space 131072K, 8% used [0x00000006f0000000,0x00000006f0a3e3a8,0x00000006f8000000) 0.793: [GC [PSYoungGen: 31458K->4293K(917504K)] 31458K->4301K(1966080K), 0.0087090 secs] [Times: user=0.03 sys=0.00, real=0.01 secs] Heap after GC invocations=1 (full 0): PSYoungGen total 917504K, used 4293K [0x00000007c0000000, 0x0000000800000000, 0x0000000800000000) eden space 786432K, 0% used [0x00000007c0000000,0x00000007c0000000,0x00000007f0000000) from space 131072K, 3% used [0x00000007f0000000,0x00000007f04316a0,0x00000007f8000000) to space 131072K, 0% used [0x00000007f8000000,0x00000007f8000000,0x0000000800000000) ParOldGen total 1048576K, used 8K [0x0000000700000000, 0x0000000740000000, 0x00000007c0000000) object space 1048576K, 0% used [0x0000000700000000,0x0000000700002000,0x0000000740000000) PSPermGen total 131072K, used 10488K [0x00000006f0000000, 0x00000006f8000000, 0x0000000700000000) object space 131072K, 8% used [0x00000006f0000000,0x00000006f0a3e3a8,0x00000006f8000000) }

ps:附上一张gc log的解释图 ![gc log解释][1] [1]: http://static.oschina.net/uploads/space/2013/0422/160249_llZB_617343.jpg

转载于:https://my.oschina.net/hyp3/blog/124453

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值