简体   繁体   English

了解Java的GC日志

[英]Understanding Java's GC logs

I turned on verbose GC options on my JDK, and now I'm seeing lines such as 我在我的JDK上打开了详细的GC选项,现在我看到了诸如此类的行

25.598: [CMS-concurrent-sweep-start]
25.622: [CMS-concurrent-sweep: 0.023/0.024 secs] [Times: user=0.02 sys=0.00, real=0.03 secs]
25.623: [CMS-concurrent-reset-start]
25.629: [CMS-concurrent-reset: 0.007/0.007 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]

Anyone care to tell me exactly what all the parameters there mean? 有人想告诉我究竟是什么参数意味着什么?

  1. What's the difference between sys+user and real times? sys +用户和实际时间有什么区别?
  2. What does "0.023/0.024 secs" mean? “0.023 / 0.024秒”是什么意思?

I think it's just related to CPU usage.. 我认为这只与CPU使用情况有关..

  1. real is the absolute difference of time between end and start (not excluding context switches) real是结束和开始之间的绝对时间差(不包括上下文切换)
  2. user is how much time is spent while executing code in user space user是在用户空间中执行代码所花费的时间
  3. sys is how much time is spent while execting system code (eg. system calls or everything else that moves control from user code to kernel code) sys是在执行系统代码时花费了多少时间(例如,系统调用或将控制从用户代码移动到内核代码的所有其他内容)

A note: while real doesn't represent effective time (because of including also time in which GC goes away from CPU to let it to something else) sys+user does. 注意:虽然真实并不代表有效时间(因为还包括GC离开CPU以让它变成其他东西的时间) sys +用户

EDIT 编辑

CMS-concurrent-sweep is the phase in which GC actually cleans useless objects (it's done after the marking phase). CMS-concurrent-sweep是GC实际清理无用对象的阶段(在标记阶段之后完成)。 In this case it's concurrent because GC works together with application without pausing it and time should be time used (maybe time-start / time-end , not sure about that) 在这种情况下,它是并发的,因为GC与应用程序一起工作而不会暂停它,时间应该是时间使用(可能是time-start / time-end ,不确定)

根据http://www.sun.com/bigadmin/content/submitted/cms_gc_logs.html ,两个数字0.023/0.024是CPU /墙壁时间。

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

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