java 将 VisualVM 与 IntelliJ 结合使用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42044688/
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
Using VisualVM with IntelliJ
提问by Nathan Bierema
I'm trying to use VisualVMwith IntelliJ to profile a Java application. I have the VisualVM Launcher plugin installed inside of IntelliJ. I press the play button with the orange circle in IntelliJ that launches VisualVM and opens the process when I start the run. However, when I try to profile the CPU, it doesn't seem to profile the methods in my program. I've tried with several different programs and can't seem to get any of them to work with VisualVM. This is what VisualVM looks like this:
我正在尝试将VisualVM与 IntelliJ结合使用来分析 Java 应用程序。我在 IntelliJ 中安装了 VisualVM Launcher 插件。我按下 IntelliJ 中带有橙色圆圈的播放按钮,启动 VisualVM 并在我开始运行时打开该进程。但是,当我尝试分析 CPU 时,它似乎没有分析我程序中的方法。我已经尝试了几个不同的程序,但似乎无法让它们与 VisualVM 一起工作。这是 VisualVM 的样子:
The profiler seems to think that the total time is 857 ms or 6.21 ms when in reality my program takes about a minute to run. It seems to be capturing "DestroyJavaVM" which is not my program. I'm using VisualVM because it is the only free Java profiler I could find. Any suggestions? Here are my VisualVM settings:
分析器似乎认为总时间是 857 毫秒或 6.21 毫秒,而实际上我的程序需要大约一分钟才能运行。它似乎正在捕获不是我的程序的“DestroyJavaVM”。我正在使用 VisualVM,因为它是我能找到的唯一免费的 Java 分析器。有什么建议?这是我的 VisualVM 设置:
回答by Melanie B.
As others have suggested, take a look at your "Start profiling from class" setting.
正如其他人所建议的,请查看您的“从课堂开始分析”设置。
But you might want to consider it being a timing issue. As you can see in the background, the process you want to debug is already finished.
但您可能希望将其视为时间问题。正如您在后台看到的,您要调试的进程已经完成。
Check in the call tree and in the list of processes to the left what you are debugging. In your screenshot you are debugging the destruction of the JVM. That does not include your code, so you should not see it there.
在调用树和左侧的进程列表中检查您正在调试的内容。在您的屏幕截图中,您正在调试 JVM 的破坏。这不包括您的代码,因此您不应在那里看到它。