aspose file tools*
The moose likes Java in General and the fly likes Memory/CPU/timing resources from Java Program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Memory/CPU/timing resources from Java Program" Watch "Memory/CPU/timing resources from Java Program" New topic
Author

Memory/CPU/timing resources from Java Program

Avianu Sud
Ranch Hand

Joined: Jan 20, 2002
Posts: 55
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

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Avianu Sud
Ranch Hand

Joined: Jan 20, 2002
Posts: 55
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

Joined: Aug 09, 2005
Posts: 6
There is another free profiler which might be useful to trace objects usage and method timings.
http://java-source.net/open-source/profilers/jmp
 
Don't get me started about those stupid light bulbs.
 
subject: Memory/CPU/timing resources from Java Program