可视化GC日志工具 - Baekhyunne
1.GC日志输出参数
1.1 编写测试代码
public static void main(String[] args) throws InterruptedException { List<Object> list = new ArrayList<Object>(); while (true) { int sleep = new Random().nextInt(100); if (System.currentTimeMillis() % 2 == 0) { list.clear(); } else { for (int i = 0; i < 10000; i++) { Properties properties = new Properties(); properties.put("key_" + i, "value_" + System.currentTimeMillis() + i); list.add(properties); } } Thread.sleep(sleep); } }
1.2 修改VM options参数 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -Xloggc:F://gc.log
参数分析
1.3 查看 生成日志
1.4 查看日志 内容
2. GC可视化工具
GC Easy是一款在线的可视化工具,易用、功能强大,网站: http://gceasy.io/
点击Analye后可查看日志文件报告
上传的文件名 可下载 可分享
关键绩效指标
交互式图标