开发者

Does VisualVM CPU profiling work on a Mac?

开发者 https://www.devze.com 2023-01-23 08:06 出处:网络
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 fr

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" me开发者_StackOverflow社区ssage. 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消