idea 启用火焰图功能

开源项目 async-profiler 是一个Java 的低开销采样分析器,能够生成火焰图。idea集成了它的功能,使用起来更加的简单。java

开启火焰图

  • 按下快捷键 shift alt command + /
  • 选择 4 Experimental features
  • 勾选 idea.profiler.enbaled

这就开启了火焰图功能。git

启动程序

随便写一点代码github

package me.deweixu;
public class App 
{
    public static void main( String[] args ) {
        for(int i = 0; i < 10000000; i++) {
            System.out.println(produceString());
        }
    }

    private static String produceString() {
        return "Hello World";
    }
}

使用下图中红色标注的方式启动jvm

图片描述

火焰图

图片描述

黄色的部分是 Java 调用栈,其余的则是系统调用。async

相关文章
相关标签/搜索