GCViewer
簡介:GCViewer是一個小工具,可以可視化展示 生成的詳細GC輸出。支持Sun / Oracle,IBM,HP和BEA的Java虛擬機。它是GNU LGPL下發布的免費軟件。
下載:https://sourceforge.net/projects/gcviewer/
使用:https://github.com/chewiebug/GCViewer
使用簡介:雙擊jar文件可運行gui,打開gc的日誌文件,即可查看(需要java1.8vm)
如何生成gc日誌文件?在啓動你的程序前需要添加一些啓動參數
Supported verbose:gc formats are:
some support for OpenJDK 9 / 10 unified logging format -Xlog:gc:, the following configurations will work
-Xlog:gc:file="path-to-file" (uses defaults)
-Xlog:gc=info:file="path-to-file":tags,uptime,level (minimum configuration needed)
-Xlog:gc*=trace:file="path-to-file":tags,time,uptime,level (maximum configuration supported, additional tags ok, but ignored; additional decorations will break parsing)
Oracle JDK 1.8 -Xloggc: [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
Sun / Oracle JDK 1.7 with option -Xloggc: [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
Sun / Oracle JDK 1.6 with option -Xloggc: [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
Sun JDK 1.4/1.5 with the option -Xloggc: [-XX:+PrintGCDetails]
Sun JDK 1.2.2/1.3.1/1.4 with the option -verbose:gc
IBM JDK 1.3.1/1.3.0/1.2.2 with the option -verbose:gc
IBM iSeries Classic JVM 1.4.2 with option -verbose:gc
HP-UX JDK 1.2/1.3/1.4.x with the option -Xverbosegc
BEA JRockit 1.4.2/1.5/1.6 with the option -verbose:memory [-Xverbose:gcpause,gcreport] [-Xverbosetimestamp]
例如Oracle JDK1.8,爲了生成gc日誌,我是這樣啓動的:日誌輸出到mylog.txt中
java -Xmx32m -Xss256k -verbose:gc -Xloggc:"mylog.txt" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -jar .\demo-0.0.1-SNAPSHOT.jar