VisualVM CPU 分析可以在 Mac 上运行吗?

发布于 2024-10-01 01:32:06 字数 576 浏览 2 评论 0原文

我正在尝试使用 VisualVM 在具有 64 位 VM 的 Mac 上进行分析,但没有成功。

它似乎只以很长的间隔更新(我以为它根本不会分析,直到我离开键盘十分钟,回来发现一个更新。我相信应该每 2 秒运行一次)。

大多数时候,它只是显示“尚无可用的分析信息”消息。第一次运行时,总共发现了 4 个方法调用。在那个时间范围内将会发生数百万次。

应用程序退出时的快照显示了一些系统线程,但没有显示我的代码。

我没有更改任何默认设置。我已经检查过它不排除我的代码。

VisualVM 是否可以在 Mac 上运行以分析 64 位 JVM?

我尝试过最新 JDK 中的 jvisualvm 和 java.net 中稍晚版本的 jvisualvm。

java版本“1.6.0_22” Java(TM) SE 运行时环境(内部版本 1.6.0_22-b04-307-10M3261) Java HotSpot(TM) 64 位服务器 VM(内部版本 17.1-b03-307,混合模式)

系统版本:Mac OS X 10.6.4 (10F569)

有什么想法吗?它对你有用吗?

谢谢!

I'm trying to use VisualVM to profile on a Mac,with a 64 bit VM, but am having no success.

It appears to update only at LONG intervals (I thought it wouldn't profile at all, until I walked away from the keyboard for ten minutes, and came back and found ONE update. Should run every 2 seconds, I believe).

Most of the time, it just sits with the "No profiling information is available yet" message. The one time it worked, it found 4 method invocations, total. Millions would have occurred in that time frame.

The snapshot when the app exits shows some system threads, but none of my code.

I have not changed any of the settings from the default. I've checked it's not excluding my code.

Does VisualVM work on a Mac for profiling a 64 bit JVM?

I've tried both jvisualvm from the latest JDK, and the slightly later version from java.net.

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)

System Version: Mac OS X 10.6.4 (10F569)

Any thoughts? Does it work for you?

Thanks!

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

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

发布评论

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

评论(1

清晨说晚安 2024-10-08 01:32:06

飞行员失误,某种程度的。

我正在对一个测试应用程序进行基准测试,该应用程序创建了一个线程,并在线程的 run 方法中循环旋转。它执行了一个紧密循环来使用 cpu、sleep() 和 println()。

但问题是这一切都在一种方法中。看来 VisualVM 仅在退出方法时跟踪它们。因此,由于我有一个方法循环,​​它从未退出该方法,也从未生成跟踪事件。

我将代码从 run() 方法移动到另一个从 run() 重复调用的方法中,现在它可以工作了。

Pilot error, of a sort.

I was benchmarking a test app, that created a thread, and spun in a loop in the thread's run method. It did a tight loop to use cpu, and a sleep(), and a println().

But the problem is that it was ALL in one method. It appears that VisualVM only tracks methods when you exit them. So, since I had one method looping, it never exited the method, and never generated a tracking event.

I moved the code from the run() method, into another method called repeatedly from run(), and now it works.

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