是否有 IntelliJ Java Profiler

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21147642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 06:55:50  来源:igfitidea点击:

Is there an IntelliJ Java Profiler

javaintellij-ideaprofiler

提问by GavriYashar

Is there a Profiler for IntelliJ like the one for Matlab?

有没有像 Matlab 一样的 IntelliJ 分析器?

Let's say you have this code

假设你有这个代码

a = true;
i = 0;
while(a)
{
   if(a)
      i++
   // some fancy stuff which takes 1 second each loop
   if(i > 1e6) break;
}  

Now I run the code

现在我运行代码

In Matlab it would look like this after I opened the Profiler

在 Matlab 中,我打开 Profiler 后看起来像这样

calls  time
     1  0.0      a = true;
     1  0.0      i = 0;
     1  0.0      while(a)
                 {
   1e3  1.0        if(a)
   1e3  0.4         i++
   1e3  1e3         // some fancy stuff which takes 1 second each loop
   1e3  1.2         if(i > 1e3) break;
                 }  

采纳答案by Jakub Kubrynski

All profilers that are available for Java, which can be used in IntelliJ will show invocation times only aggregated on method level. You can use for example VisualVM, JProfiler or YourKit, but only summary time will be shown.

所有可用于 Java 的分析器(可在 IntelliJ 中使用)将显示仅在方法级别聚合的调用时间。例如,您可以使用 VisualVM、JProfiler 或 YourKit,但只会显示摘要时间。

回答by Ingo Kegel

JProfiler has a plugin for IntelliJ IDEA.

JProfiler 有一个IntelliJ IDEA 插件

It adds "Profile" actions to IntelliJ IDEA, similar to the "Run" and "Debug" actions. The profiler UI is not embedded in IDEA but started as a separate process. However, you can use your existing run configurations for profiling and source code navigations goes back to IDEA.

它将“配置文件”操作添加到 IntelliJ IDEA,类似于“运行”和“调试”操作。探查器 UI 未嵌入到 IDEA 中,而是作为单独的进程启动。但是,您可以使用现有的运行配置进行分析,源代码导航可返回 IDEA。

You have to install JProfileras a standalone product, the plugin will ask you about the installation directory of JProfiler when you profile something for the first time.

您必须将JProfiler作为独立产品安装,当您第一次分析某些东西时,插件会询问您 JProfiler 的安装目录。

Disclaimer: My company develops JProfiler.

免责声明:我公司开发 JProfiler。