[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Number of processors



Christopher W. Aiken wrote:
> Does anyone know how to get the number of CPU's that a machine has
> using the "C" programming language?    Any URL's on the subject?

This is specific to the kernel you are talking to.  DOS has different
API than Linux for retrieving this information.  Of course, you could
write ASSEMBLY to figure it out, but that'd be a waste of time.
Instead, why don't you download the source code for any number of CPU
and Memory tracker applets/epplets/widgets available for X.  Perhaps
look at the source code for top, or even in the kernel itself at how
it writes out /proc/cpuinfo, then call those directly.

TTBOMK, I don't know of any ANSI C or C++ call to get this
information.  If there is, it's in a separate API library that may be
written in an ANSI style, but not necessarily classified as an ANSI
library.

If you on a UNIX machine, remember to install the manpages-dev, or
manpages for the developers.

-- 
Chad "^chewie, gunnarr" Walstrom <chewie@wookimus.net>
             http://www.wookimus.net/

Attachment: pgp7LNF4WZIkN.pgp
Description: PGP signature


Reply to: