Java: does GarbageCollectorMBean.getCollectionTime return pause time or something else?(Java:GarbageCollectorMBean.getCollectionTime 是否返回暂停时间或其他?)
问题描述
Oracle 的 javadoc for GarbageCollectorMBean.getCollectionTime 说,以毫秒为单位返回近似的累积收集经过时间."这是任何垃圾收集器线程所花费的具体暂停时间还是一般时间?
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() 返回特定算法的累积挂钟时间,以毫秒为单位.
GarbageCollectorMBean.getCollectionTime() return cumulative wall clock time in milliseconds for specific algorithm.
对于 Stop-the-World 算法(通常是年轻的集合),这可以解释为时间应用程序暂停.
For Stop-the-World algorithms (young collections usually) this could be interpreted as time application was paused.
对于并发算法,该值完全无用,因为它不是 STW 时间,也不是 CPU 时间(算法可能使用多个线程,但会计算挂钟时间).
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).
GC 算法消耗的正确 CPU 时间可以从性能计数器(这里是读取这些计数器的代码示例).
Correct CPU time consumed by GC algorithm could be retrieved from performance counters (here is example of code reading these counters).
这篇关于Java:GarbageCollectorMBean.getCollectionTime 是否返回暂停时间或其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java:GarbageCollectorMBean.getCollectionTime 是否返回暂停时间或其他?


- C++ 和 Java 进程之间的共享内存 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01