Jump to content
Sign in to follow this  
Ugochukwu Mmaduekwe

NumCPULib4Pascal

Recommended Posts

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

 

 

  • Like 3
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×