简体   繁体   English

这些GC日志是什么意思?

[英]What these GC logs mean?

I just have got information on performance improvemet using GC tuning. 我刚刚获得了有关使用GC调优性能提高的信息。

I am trying to print GC logs like below, Test is my class file. 我正在尝试打印GC日志,如下所示,Test是我的类文件。

java -Xms2m -Xmx64m -XX:+PrintGCDetails Test java -Xms2m -Xmx64m -XX:+ PrintGCDetails测试
and
java -Xms2m -Xmx64m -XX:+UseSerialGC -XX:+PrintGCDetails Test java -Xms2m -Xmx64m -XX:+ UseSerialGC -XX:+ PrintGCDetails测试

every time i am getting GC logs in below format 每次我以以下格式获取GC日志时

Heap
 def new generation   total 1152K, used 347K [0x00000000f6e00000, 0x00000000f6f40000, 0x00000000f8350000)
  eden space 1024K,  33% used [0x00000000f6e00000, 0x00000000f6e56f68, 0x00000000f6f00000)
  from space 128K,   0% used [0x00000000f6f00000, 0x00000000f6f00000, 0x00000000f6f20000)
  to   space 128K,   0% used [0x00000000f6f20000, 0x00000000f6f20000, 0x00000000f6f40000)
 tenured generation   total 768K, used 0K [0x00000000f8350000, 0x00000000f8410000, 0x00000000fae00000)
   the space 768K,   0% used [0x00000000f8350000, 0x00000000f8350000, 0x00000000f8350200, 0x00000000f8410000)
 compacting perm gen  total 21248K, used 2345K [0x00000000fae00000, 0x00000000fc2c0000, 0x0000000100000000)
   the space 21248K,  11% used [0x00000000fae00000, 0x00000000fb04a620, 0x00000000fb04a800, 0x00000000fc2c0000)
No shared spaces configured.

I also tried with -XX:+PrintGCTimeStamps vm argument but it prints same output. 我也尝试了-XX:+ PrintGCTimeStamps vm参数,但是它输出相同的输出。

I am already trying to understand these logs in google since days now. 从现在开始,我已经在尝试了解Google中的这些日志。

Format explained in google is 谷歌解释的格式是

8109.128: [GC [PSYoungGen: 109884K->14201K(139904K)] 691015K->595332K(1119040K), 0.0454530 secs]

which i can understand. 我能理解的。

Questions 问题
1) how can i print GC logs in format i mentioned later. 1)如何以我稍后提到的格式打印GC日志。
2) can any one explain me logs i got? 2)谁能解释我得到的日志?

yes.... I got it by myself 是的....我一个人得到的

I was under misconception that GC is at all happening, but was not happening so it showed me spaces used in different generations, 我误以为GC确实在发生,但没有发生,因此它向我展示了不同代使用的空间,

As I was running a test application my application is small enough to not cause GC. 在运行测试应用程序时,我的应用程序足够小,不会引起GC。 I inserted System.gc() in code for some condition and got expected GC logs. 在某些情况下,我在代码中插入了System.gc()并获得了预期的GC日志。

[GC 645K->288K(121344K), 0.0042354 secs]
[Full GC 288K->238K(121344K), 0.0219605 secs]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM