how to get the processor speed info using Java? for example, one can get the processor info by the 'set' command as:
PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 15 Model 1 Stepping 2, GenuineIntel PROCESSOR_LEVEL=15 PROCESSOR_REVISION=0102
but two problems here:
(1) does the PROCESSOR_LEVEL=15 really reflect the processor speed and hence a good criteria to calculate/evaluate the CPU speed? (2) it is a pity that the info got via System.getProperties() does notinclude these PROCESSOR_* info
so, how can I get the processor speed info programmically using Java?
BTW: I am using JDK1.4.1_01, and the potential platforms include: Win98,Win2K,and XP.
Thanks.
my email: depender@yahoo.com
Adam
Posted at bbs.xjtu java
On Dec 16, 2003
Posted at Java Technology Forums
in : *Forum: New To Java Technology *Forum: Java Programming * No A *Forum: Advanced Language Topics
Retreiving hardware informations Author: 0102030400 Jul 16, 2002 8:17 AM
Hi all,
Is there any way to retrieve informations about the hardware in java, e.g. the processor (type, speed...), harddisks (capacity, freemem...) etc.
Thanks in advance, Mathias
Re: Retreiving hardware informations Author: DrClap In Reply To: Retreiving hardware informations Jul 16, 2002 10:15 AM
Reply 1 of 2
Yes, use JNI.
Re: Retreiving hardware informations Author: Mordan In Reply To: Retreiving hardware informations Jul 16, 2002 12:39 PM
Reply 2 of 2
> Hi all, > > Is there any way to retrieve informations about the > hardware in java, e.g. the processor (type, speed...), > harddisks (capacity, freemem...) etc. > > Thanks in advance, Mathias
well I think he is talking about pure,100% Java.
I also wanted to do so, but i have never found a solution that is pure Java.
I know though that they are commercial profiling packages. Look up on google.com
You can find some info about the RAM, but that's all.
Runtime rt = Runtime.getRuntime(); System.out.println("the maximum amount of memory that the virtual machine will attempt to use, measured in MegaBytes:"+rt.maxMemory()/1048576); System.out.println("the total amount of memory currently available for current and future objects, measured in KiloBytes :"+rt.totalMemory()/1024); System.out.println("an approximation to the total amount of memory currently available for future allocated objects, measured in KiloBytes:"+rt.freeMemory()/1024); System.out.println("Number of processors:"+rt.availableProcessors());