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

Re: Number of processors



On Tue, 5 Dec 2000, Harry Henry Gebel wrote:

-|On Tue, Dec 05, 2000 at 02:01:05PM -0500, 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?
-|
-|There's probably can easier way using system calls, but I quick and sloppy
-|way would be to read /proc/cpuinfo or /proc/stat . Here are the contents
-|from one machine I administer:
-|
-|[root@power-hosting hgebel]# cat /proc/cpuinfo 
-|processor	: 0
-|vendor_id	: GenuineIntel
-|cpu family	: 6
-|model		: 7
-|model name	: Pentium III (Katmai)
-|stepping	: 3
-|cpu MHz		: 498.759223
-|cache size	: 512 KB

<SNIP>

Nope.  We have to use some "C" or "C++" system/function
call.  Our programmers don't want to depend on the
/proc file system being available.

Thanks...


Any other takers on this one?

---                                   
Christopher W. Aiken, Scenery Hill, Pa, USA
chris at cwaiken dot com,   www.cwaiken.com
Current O/S: Debian 2.2 GNU/Linux




Reply to: