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 suggestions 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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With