lkml.org 
[lkml]   [2002]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: system call for finding the number of cpus??
* Mark Hahn (hahn@physics.mcmaster.ca) wrote:
> > See http://people.nl.linux.org/~hch/cpuinfo/ for details.
>
> egads. "grep -ci bogo /proc/cpuinfo" then.

Hmm, cpuinfo is a very human readable file, I wouldn't use it to do
things like that.

I suggest /proc/stat whose format appears to be designed for machine
reading and which has a 'cpu0' and 'cpu1' line on this here dual
processor box; and from 2.4.x on it seems to have a cpu0 even on
uniprocessor; so I suggest:

grep "^cpu[0-9][0-9]* " /proc/stat

But I'd actually go and ask the CPU hotswap guys - they must have a way
of getting a handle on this (hey does that mean you might have cpu0,
cpu1, cpu3 .... ?)

Me thinks the format of these /proc files needs documenting - is there
anything already?

Dave

---------------- Have a happy GNU millennium! ----------------------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \
\ gro.gilbert @ treblig.org | MIPS,x86,ARM, SPARC and HP-PA | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.091 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site