如何解释 JProfiler 中的 GC Activity 图?

How to interpret GC Activity graph in JProfiler?

最近我一直致力于优化一些代码(在计算时间和所需的最大内存方面)。为了解优化内存成本是否有潜在收益,我使用了 JProfiler。 通常

现在,我处于第二种情况,GC Activity 图表显示尖峰,但都小于 2%(见下图)。我该如何理解?

默认情况下,我的理解是 GC Activity 曲线的 sum/integrale 是对用于收集数据的 cpu 总百分比的估计。所以这里意味着比最大值 2%

少得多

对吗?我错过了什么吗?

By default, my understanding is that the sum/integrale of the GC Activity curve is an estimate of the total percent of cpu used to collect data.

应该是吧

So here that would mean much less than the max 2%

max 在这里是骗人的。如果您将采样间隔设置得足够小,则最大值将是花在 GC 上的时间片的 100%。即当该切片小于 GC 暂停持续时间时。所以这些峰值已经是一些较大时间片的平均值。

How should I understand that ?

您的应用程序可能没有在 GC 上花费太多时间。但是您的图表只涵盖了相对较少的时间,因此它可能无法反映主要的集合或并发周期。如果您关心延迟而不仅仅是吞吐量,那么解释 JVM 的 GC 日志将提供更多详细信息。

By default, my understanding is that the sum/integrale of the GC Activity curve is an estimate of the total percent of cpu used to collect data. So here that would mean much less than the max 2%

Is that correct?

是的,没错。如果您想找出临时对象的分配位置,请转到 Live Memory->Allocation Call Tree 并选择 "Garbage collected objects" 作为 liveness mode

要查看任何分配点或分配热点中的分类,请使用 "Show classes" 调用树分析。