开发者

Java CPU resource hog, 100%

I have written a program which when it starts up runs about 96% CPU and then very quickly tips the CPU to 100% before crashing. I need to trace what is constantly being done by the CPU whether it is the program running though or a particular method or call being worked on.

Any suggestion开发者_开发百科s or links?

Thanks.


Java VisualVM should help. It is a tool that is included in the standard JDK. It allows you to profile and inspect a running Java program. It should be in the same directory as your javac executable.

Here is a quick synopsis of the command line to use to invoke the tool.


you can start with profiling your application.

As you have not mentioned the Java version therefore i am safely assuming SUN JDK 1.5.

For a starter you can use:

  1. http://jrat.sourceforge.net/ OR
  2. NetBeans IDE profiler for checking the bottle necks in your program.

Secondly, you can use JConsole for monitoring the memory usage in your application. Its in your <JDK HOME>\bin.

If you are using SUN JDK 1.6 then as A. Levy mentioned, use jvisualvm for CPU and Heap profiling.

And possible then post your code snippet.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜