Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

help: find CPU,memeory parameters from java programs

Thread view: 
pira - 18 Jun 2005 08:47 GMT
Hi,
I'd like to know if it is possible to collect information about the use of
the CPU,
the use of the memory and other parameters of the PC from a java program.
I've heard about JVMPI-JVMTI, but it would make me write code in C/C++.
Does it exist a strategy in java?
Thanks!
Simon OUALID - 18 Jun 2005 10:52 GMT
> Hi,
> I'd like to know if it is possible to collect information about the use of
[quoted text clipped - 3 lines]
> Does it exist a strategy in java?
> Thanks!

Runtime.getRuntime().freeMemory();
Runtime.getRuntime().totalMemory();
Runtime.getRuntime().maxMemory();
Runtime.getRuntime().availableProcessors();

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#freeMemory()

But it will only give you stats informations the JVM's memory (heap size).
wazary - 19 Jun 2005 15:20 GMT
> Runtime.getRuntime().freeMemory();
> Runtime.getRuntime().totalMemory();
> Runtime.getRuntime().maxMemory();
> Runtime.getRuntime().availableProcessors();

I know these methods, but they can't tell me
any information about the CPU in term of
charge, business, etc.
Andrew Thompson - 19 Jun 2005 15:32 GMT
>> Runtime.getRuntime().freeMemory();
>> Runtime.getRuntime().totalMemory();
[quoted text clipped - 4 lines]
> any information about the CPU in term of
> charge,

Charge?

>..business,

Business??  What the heck are you on about?

Do you mean - 'CPU chip takes +5 Volts and is made by AMD'?

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Ingo R. Homann - 20 Jun 2005 08:07 GMT
Hi pira,

> Hi,
> I'd like to know if it is possible to collect information about the use of
[quoted text clipped - 3 lines]
> Does it exist a strategy in java?
> Thanks!

Using Java5, take a look at the java.lang.management-package. The
ThreadMBean provides some information on CPU usage, IIRC. There are some
ohter interesting classes, although I didn't work with them...

Hth,
Ingo


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.