NumCPULib4Pascal is a Cross Platform Pascal library to query the number of CPUs (Logical (logical processors) and Physical (cores)) on a machine.
Usage
Add NumCPULib to uses clause:
uses
NumCPULib;
var
lcc, pcc: Int32;
begin
// count logical cpus (aka logical processors)
lcc := TNumCPULib.GetLogicalCPUCount();
// count physical cpus (aka cores)
pcc := TNumCPULib.GetPhysicalCPUCount();
end;
What is the difference between the existing System.CPUCount and NumCPULib4Pascal?
1. System.CPUCount only reports the LogicalCPU Count (aka logical processors), it has no option to report the PhysicalCPU Count (cores).
2. System.CPUCount will not report the correct value on windows systems with more than 64 logical processors. NumCPULib4Pascal fixes this by querying GetLogicalProcessorInformationEx on these OSes.
GitHub Repository
NumCPULib4Pascal