[英]Garbage Collection
垃圾回收(GC)信息的日志记录选项可帮助您调整堆大小或诊断与内存有关的任何其他问题,它是由什么完成的?
In short 简而言之
-XX:PrintGCDetails
- timings and space sizes for each GC phase -XX:PrintGCDetails
每个GC阶段的时间和空间大小 -XX:+PrintGCDateStamps
- add timestamps to gC logs -XX:+PrintGCDateStamps
向gC日志添加时间戳 -XX:+PrintReferenceGC
- helps to find reference abuse -XX:+PrintReferenceGC
帮助查找参考滥用 -XX:+PrintPromotionFailure
-XX:+PrintGCApplicationStoppedTime
- report all safe points not just GC -XX:+PrintGCApplicationStoppedTime
报告所有安全点而不仅仅是GC The garbage collection logging depends on the type of JVM you are using. 垃圾收集日志记录取决于您使用的JVM的类型。 There are different parameters to enable GC logging depending on the JVM being used.
根据所使用的JVM,有不同的参数可启用GC日志记录。 Below are parameters that need to be included to enable GC logging:
以下是启用GC日志记录所需包含的参数:
SUN JVM : -XX:+PrintGCDetails -XX:+PrintGCDateStamps (It will print both time and date) -verbose:gc -Xloggc:/path/gc.log SUN JVM :-XX:+ PrintGCDetails -XX:+ PrintGCDateStamps(它将同时打印时间和日期)-verbose:gc -Xloggc:/path/gc.log
Note- -XX:+PrintGCTimeStamps (It will print the time after JVM restart in seconds and not the time stamp in hh:mm:ss format. This is somewhat difficult to interpret so it is recommended to use PrintGCDateStamps instead) 注--XX:+ PrintGCTimeStamps(它将以秒为单位打印JVM重新启动后的时间,而不是以hh:mm:ss格式显示时间戳。这有点难以解释,因此建议改用PrintGCDateStamps)
JRockit -Xverbose -XverboseTimeStamp -Xverboselog:/path/gc.log JRockit -Xverbose -XverboseTimeStamp -Xverboselog:/path/gc.log
IBMJ9 -verbose:gc IBMJ9-详细 :gc
You may want to look at Java Flight Recorder, which gives you complete GC statistics with very less overhead. 您可能需要查看Java Flight Recorder,它为您提供了完整的GC统计信息,而其开销却很小。 You can start JFR recording while the Application is running.
您可以在应用程序运行时开始JFR记录。 The output file generated will have detailed info on the GC statistics.
生成的输出文件将具有有关GC统计信息的详细信息。 You have to open the output jfr file using Java Mission Control.
您必须使用Java Mission Control打开输出的jfr文件。
I used to work with these options to analyze GC performance for Sun/OpenJDK JVM: 我曾经使用以下选项来分析Sun / OpenJDK JVM的GC性能:
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintHeapAtGC
-XX:+PrintReferenceGC
-XX:+PrintAdaptiveSizePolicy
-XX:+PrintGCCause
-XX:+PrintPromotionFailure
-XX:+PrintTenuringDistribution
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.