Linux 上的 Java 分析

发布于 2024-08-23 18:38:17 字数 108 浏览 7 评论 0原文

我有一个相当复杂的 Java 应用程序,它占用了大量的 CPU,并且想知道是否有任何关于配置文件工具的建议,我可以使用它来确定 CPU 使用率的原因。我的目标是查明代码中使用大部分 CPU 时间的位置。

I have a fairly complex Java application that is utilizing a lot of CPU, and would like to know if there is any recommendation on a profile tool that I could use to determine the cause of the CPU utilization. My goal is to pinpoint the location in the code where it is using most of the CPU time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

亣腦蒛氧 2024-08-30 18:38:17

我在 Linux 上使用过 jProfiler 和 YourKit。但是,您可以通过运行最新 JDK 附带的 jconsole 来找到所需的信息。有关如何使用它的良好信息: http://java.sun.com/开发人员/technicalArticles/J2SE/jconsole.html

I've used jProfiler and YourKit on Linux. But you might find the information you're looking for by running the jconsole that comes with recent JDKs. Good information on how to use it: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

霞映澄塘 2024-08-30 18:38:17

Netbeans 有很好的内置分析器。 NB 在 Ubuntu 9.10 上运行得很好

如果在开发中无法观察到您的问题,您可以将分析器附加到远程 JVM(您的生产环境)。您必须配置主机 JVM 以接受来自探查器的 JMS/JConsole 连接。 JMS/JConsole实时监控可视化图表看起来非常棒。

Netbeans has good built-in profiler. NB runs quite well on Ubuntu 9.10

If your issue cannot be observed in developement, you can attach the profiler to a remote JVM (your production environment). You have to configure the host JVM to accept the JMS/JConsole connections from the profilers. The JMS/JConsole realtime monitoring visualization charts look pretty awesome.

知你几分 2024-08-30 18:38:17

我在eclipse IDE中使用了Visual VM。如果您没有使用 IDE,jhat 和 jconsole 会有所帮助。谷歌 jhat 获取更多信息

I have used Visual VM in the eclipse IDE. If you are not on an IDE, jhat and jconsole will help. Google jhat for more info

友欢 2024-08-30 18:38:17

如果您熟悉 Eclipse,我推荐 TPTP

If you are comfortable with Eclipse, I'd recommend TPTP.

停滞 2024-08-30 18:38:17

如果您使用 Sun Java 6,那么请学习在运行麻烦程序的机器上的 JDK 中使用 jvisualvm。

它将回答您的大部分问题,可以轻松地附加到已经运行的程序,并且是免费的。

If you use Sun Java 6 then learn to use jvisualvm in the JDK on the machine running the troublesome program.

It will answer most of your questions, can attach effortlessly to an already running program and is gratis.

花开半夏魅人心 2024-08-30 18:38:17

这个方法技术含量较低,但效果最好。这是简短解释原因。

由于您不是在 IDE 下运行,因此您可以使用 pstacklsstack 来获取堆栈示例。如果应用程序使用的时间比应有的多,那么问题很可能是一个或几个恶意函数调用,这在大多数堆栈示例中都清晰可见。

This method is low-tech but works best. Here's a short explanation why.

Since you are not running under an IDE, you can use pstack or lsstack to get stack samples. If the app is using lots more time than it should, then most likely the problem is one or a few rogue function calls, which will be clearly visible on most of the stack samples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文