[TriLUG] Dual core question

Brian Henning brian at strutmasters.com
Fri May 20 15:04:33 EDT 2005


Hiho,
   On a properly-kerneled multiprocessor machine, top will list each 
CPU's load individually (if you press "1"), allowing one to see how many 
CPUs are installed.  Or do you mean a way for a program to know, for its 
own use?

I'm not sure your program works as intended..  I run a Dual Xeon HT box, 
which appears as four CPUs to my custom-built 2.6.10 SMP kernel and 
shows as four CPUs to top, but the program you have here says "CPU 
count: 1".

HTH,
~Brian


Charles Fischer wrote:
> I would like to get a CPU core count from a Linux box.  Does anybody 
> have a dual core box running a 2.6 kernel?  If so would you run the 
> following short program and let me know what it output?  I would also 
> like to know which version of Linux you are running and how many CPU 
> sockets are filled and the CPU model numbers.  The program compiles with 
> the following command line:
> 
>   cc cpu_core_check.c
> 
> and runs with the following:
> 
>   ./a.out
> 
> I am assuming that you copy the program from this e-mail and call it 
> cpu_core_check.c.
> 
> If somebody knows a better way to get a CPU and core count please let me 
> know.
> 
> Thanks
> Charles Fischer
> 
<snip>



More information about the TriLUG mailing list