You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/02/11 23:06:32 UTC

Fresh in CVS: SystemUtil

I have freshly checked in a SystemUtil class and mini-framework for determining the
number and type of processors on an installed system.  This is important for automated
Thread management that bases its calculations on the number of CPUs in a system.

The solution is to have all the CPUParser instances in one package:
"org.apache.avalon.excalibur.util.system", and the Class name is the same as the
Operating System name returned by System.getProperty("os.name") with all spaces
removed.

Therefore "Windows 2000" becomes "Windows2000".  If the SystemUtil cannot guess the
number of processors and info, it looks for the information in the System.getProperty
values of "os.arch.cpus" and "os.arch.info" for that information.  If it is not
available ther, then it defaults to 1 CPU, and an appropriate default string for
the info.

For those of you who have immediate access to other architectures, feel free to
add CPUParser implementations for your architecture.  For instance, you would find
this information in Linux in "/proc/cpuinfo".  You would have to parse the value
there.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>