gpt4 book ai didi

java - JMH 中 hs_gc 分析器计数器的含义

转载 作者:搜寻专家 更新时间:2023-11-01 01:16:56 27 4
gpt4 key购买 nike

我将 JMH 基准测试工具与 hs_gc 热点分析器结合使用。

我遇到的问题是我不确定输出计数器值的含义并且无法在网上找到引用。

谁能给我指出规范的方向或解释这些值?

我在下面粘贴了一个示例输出:

HS(GC) | difference: {

sun.gc.collector.0.invocations=16,
sun.gc.collector.0.lastEntryTime=37106821,
sun.gc.collector.0.lastExitTime=37109336,
sun.gc.collector.0.time=1528884,

sun.gc.collector.1.invocations=6,
sun.gc.collector.1.lastEntryTime=34419368,
sun.gc.collector.1.lastExitTime=35532892,
sun.gc.collector.1.time=6721387,

sun.gc.generation.0.space.0.used=872712984,
sun.gc.generation.1.space.0.used=5721334504,
sun.gc.generation.2.space.0.used=4848,

sun.gc.policy.avgBaseFootprint=5312,

sun.gc.policy.avgMajorIntervalTime=-667,
sun.gc.policy.avgMajorPauseTime=-41,

sun.gc.policy.avgMinorIntervalTime=-557,
sun.gc.policy.avgMinorPauseTime=1,

sun.gc.policy.avgOldLive=88064,
sun.gc.policy.avgPromotedAvg=421184,
sun.gc.policy.avgPromotedDev=364832,
sun.gc.policy.avgPromotedPaddedAvg=1515648,
sun.gc.policy.avgSurvivedAvg=1056640,
sun.gc.policy.avgSurvivedDev=-189440,
sun.gc.policy.avgSurvivedPaddedAvg=488320,
sun.gc.policy.avgYoungLive=2708352,

sun.gc.policy.liveAtLastFullGc=5721334504,
sun.gc.policy.liveSpace=2801664,

sun.gc.policy.majorGcCost=5,
sun.gc.policy.majorPauseYoungSlope=-3,

sun.gc.policy.minorGcCost=2,
sun.gc.policy.minorPauseTime=3,
sun.gc.policy.minorPauseYoungSlope=1,

sun.gc.policy.mutatorCost=-7,

sun.gc.policy.oldEdenSize=11534336,
sun.gc.policy.promoted=4584928,
sun.gc.policy.survived=6194624,

sun.gc.tlab.alloc=12852845,
sun.gc.tlab.fills=-15,

sun.gc.tlab.gcWaste=-100979,
sun.gc.tlab.maxFills=-22,
sun.gc.tlab.maxGcWaste=-100859,
sun.gc.tlab.maxSlowAlloc=-5,
sun.gc.tlab.maxSlowWaste=8826,

sun.gc.tlab.slowAlloc=-5,
sun.gc.tlab.slowWaste=8849}

最佳答案

Serviceability in HotSpot: HotSpot Jvmstat Performance Counters对此有以下警告:

The counters have structured names such as sun.gc.generation.1.name, java.threads.live, java.cls.loadedClasses. The names of these counters and the data structures used to represent them are considered private, uncommitted interfaces to the HotSpot JVM. Users should not become dependent on any counter names, particularly those that start with prefixes other than "java.".

附加警告:下面的所有源代码链接都指向特定的 hg.openjdk.java.net/jdk7u/jdk7u60分支和特定的文件修订。链接本身应该永远有效,但随着 JVM 的发展,新文件版本可能会使这篇文章中的信息过时。

第一个信息来源是 jstat 文档(jstat 8 unix docsjstat 8 windows docsjstat 7 docs)。它为许多性能计数器提供了人类可读但简短的描述,例如:

FGC: Number of full GC events.

第二个信息源是 jstat 源代码 ( jstat source code, jdk7u60 branch ),特别是它的资源文件:jstat_optionsjstat_unsupported_options .例如,在 jstat_options 中搜索 FGC 会得到以下代码段:

column {
header "^FGC^" /* Full Collections */
data sun.gc.collector.1.invocations
align center
width 5
scale raw
format "0"
}

使用 jstat_options 源代码和 jstat 文档可以将大多数内部计数器名称映射到前缀 sun.gc.collectorsun.gc.generation 到人类可读的描述,或者至少从 jstat_options 文件中的注释中获取一些额外信息。

大多数带有sun.gc.policy前缀的计数器都定义在gcPolicyCounters.cpp中和 gcAdaptivePolicyCounters.cpp以及特定于 GC 的实现(在与共享文件夹位于同一级别的特定于 GC 的文件夹中查找 somethingCounters.cpp 文件),但我无法为它们找到人类可读的描述。

我无法找到带有 sun.gc.tlab 前缀的计数器的定义位置。检查完整的 JDK 源代码并从中搜索相关的计数器名称应该可以帮助那些倾向于找到所有内容的人。

关于java - JMH 中 hs_gc 分析器计数器的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23938699/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com