[fpc-devel] Feature announcement: Extension of TThread's interface

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Thu Dec 27 20:01:08 CET 2012

Ewald wrote:

> Now, for the implementation of ProcessorCount I've got code here that
> reads the amount of processor cores from `/proc/cpuinfo` (linux only I
> think) and some assembly code [asmmode att] (tested on x86_64 and i386)
> that *tries* to get the amount of cpu cores by the use of CPUID. The

In the general case, you have to be careful with this since (a) every 
architecture puts different info in /proc/cpuinfo and (b) the processor 
numbering and affinity vectors can have gaps.

type            : sun4u
ncpus probed    : 12
ncpus active    : 12
CPU0:           online
CPU1:           online
CPU4:           online
CPU5:           online
CPU8:           online
CPU9:           online
CPU10:          online
CPU11:          online
CPU12:          online
CPU13:          online
CPU14:          online
CPU15:          online

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-devel mailing list