Java:GarbageCollectorMBean.getCollectionTime返回暂停时间还是别的什么? [英] Java: does GarbageCollectorMBean.getCollectionTime return pause time or something else?

查看:647
本文介绍了Java:GarbageCollectorMBean.getCollectionTime返回暂停时间还是别的什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Oracle的 javadoc

a> for GarbageCollectorMBean.getCollectionTime说,返回以毫秒为单位的近似累积集合已用时间。这是特别的暂停时间还是一般垃圾收集器线程花费的时间?

解决方案

GarbageCollectorMBean.getCollectionTime()返回累积墙时钟时间以毫秒为单位。



对于Stop-the-World算法(通常是年轻集合),这可以解释为时间应用程序已暂停。 b
$ b

对于值为perty的并发算法是无用的,因为它不是STW时间,它不是CPU时间(算法可能使用多个线程,但挂钟时间将被计算)。 >

可以从性能计数器中检索GC算法消耗的正确CPU时间(这里是读取这些计数器的代码示例)。


Oracle's javadoc for GarbageCollectorMBean.getCollectionTime says, "Returns the approximate accumulated collection elapsed time in milliseconds." Is that specifically pause time or generally time spent by any of the garbage collector threads?

解决方案

GarbageCollectorMBean.getCollectionTime() return cumulative wall clock time in milliseconds for specific algorithm.

For Stop-the-World algorithms (young collections usually) this could be interpreted as time application was paused.

For concurrent algorithms that value is perty useless, because it is not STW time and it is not CPU time (algorithm may use multiple threads, but wall clock time would be calculated).

Correct CPU time consumed by GC algorithm could be retrieved from performance counters (here is example of code reading these counters).

这篇关于Java:GarbageCollectorMBean.getCollectionTime返回暂停时间还是别的什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆