A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Memory/CPU/timing resources from Java Program
Joined: Jan 20, 2002
Aug 29, 2005 10:40:00
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,
Joined: Jan 29, 2003
Aug 29, 2005 12:33:00
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:
set arg=-Dcom.sun.management.jmxremote set arg=%arg% -Dcom.sun.management.jmxremote.port=9001 set arg=%arg% -Dcom.sun.management.jmxremote.authenticate=false set arg=%arg% -Dcom.sun.management.jmxremote.ssl=false set arg=%arg% sswiki.SSWiki java.exe %arg%
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
Joined: Jan 20, 2002
Aug 29, 2005 19:01:00
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?
Joined: Aug 09, 2005
Aug 30, 2005 07:01:00
There is another free profiler which might be useful to trace objects usage and method timings.
It is sorta covered in the
JavaRanch Style Guide
subject: Memory/CPU/timing resources from Java Program
java program problem
Running external executable from java
load factor/load balancing
Java mechanism to get remote server details
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014