On 28/12/2012 20:01, Ewald wrote:

Xeon:#max threads sharing caches: 16
Atom:#max threads sharing caches: 2

On Xeon cpuid 00000004 returns 0x1c004121 in rax ,  on Atom 0x4121 in
eax. So both report 2 threads per cache. The cores per package (bits
31..26) is not coherent. Don't know how to solve that.
Well, it is as you say, the `max cores per packge` just doesn't make any
sense at all. How can a processor hav  e a maximum of one core per
physical package, while in reality it has two threads sharing the same
cache? Either I'm missing something here, or the behaviour of CPUID has
changed over the years.
Atom 230 is one of the first atoms. http://www.intel.com/content/www/us/en/processors/atom/atom-200-specification-update.html lists a few bugs with cpuid but not this one.
Either way: it leaves me with a method that is not 100% reliable.

This uses libc but on the Xeon and Atom it gives the correct result using debian and ubuntu:

program cpucount;

{$mode objfpc}{$H+}

function sysconf (__name : longint) : longint; cdecl; external 'c' name 'sysconf';
const
  _SC_UIO_MAXIOV = 60;
  _SC_NPROCESSORS_CONF = (_SC_UIO_MAXIOV)+23;

begin
  writeln('Number of processors: ',sysconf(_SC_NPROCESSORS_CONF));
end.

_SC_NPROCESSORS_CONF is defined in POSIX.2:
http://www.kernel.org/doc/man-pages/online/pages/man3/sysconf.3.html

Ludo





_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to