gpt4 book ai didi

java - GC 日志 - VM 操作事件 - 如何跟踪它们

转载 作者:行者123 更新时间:2023-11-30 08:05:50 25 4
gpt4 key购买 nike

我正在使用 GCViewer 检查一些 GC 日志。 (请检查下面的屏幕截图)

我收到很多暂停(红色矩形),这似乎与“vm 操作事件(应用程序已停止...)”有关。这些似乎与常规和完整的 GC 停止不同。

  • 我如何才能知道哪些操作触发了停止事件? (是否有用于此的 JVM 标志?)

  • 它们与垃圾回收有什么不同?就 GCViewer 而言,Full GC Pauses + GC Pauses != Total Pause

enter image description here

最佳答案

添加 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1 将提供有关触发停止事件的操作的信息。

发件人:this link

When safepoints are used?

Below are few reasons for HotSpot JVM to initiate a safepoint:

  • Garbage collection pauses
  • Code deoptimization
  • Flushing code cache
  • Class redefinition (e.g. hot swap or instrumentation)
  • Biased lock revocation
  • Various debug operation (e.g. deadlock check or stacktrace dump)

要将日志写入文件,这取决于您使用的 VM 版本。

对于所有 Java 版本: Java 8 Docs .

-Xloggc:filename

Sets the file to which verbose GC events information should be redirected for logging. The information written to this file is similar to the output of -verbose:gc with the time elapsed since the first GC event preceding each logged event. The -Xloggc option overrides -verbose:gc if both are given with the same java command.

来自 Java 版本 8:

-XX:LogFile=path

Sets the path and file name where log data is written. By default, the file is created in the current working directory, and it is named hotspot.log.

关于java - GC 日志 - VM 操作事件 - 如何跟踪它们,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34789313/

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