This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory/CPU/timing resources from Java Program

 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to add some diagnostics details in a Java program.

What details are available from the Runtime environment, as well as the Java class. The goal is to have as much details about the context of the process when an exception occurs.

My understanding is that Memory/CPU usage is not available.

Is there a way to get number of threads running? Other details to diagnoze the issue.

Please share your experience,
- Avi
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using JDK 5 look at JConsole. It's a freebie with the JDK that can examine another running Java program. I put the following options on my Wiki program so I can connect JConsole to it:

JConsole is pretty cool as it is, and it is using documented APIs so you do some of the same things yourself.
 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is helpful. Thanks. Additionally what I am also trying to do is record as much additional state information when an exception occurs.
What else can be accessable at Runtime?
 
fdafd fdafda
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is another free profiler which might be useful to trace objects usage and method timings.
http://java-source.net/open-source/profilers/jmp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic