Catalog · How the catalog works
NumCPULib4Pascal
Get the number of CPUs in Pascal
- ★ 37 on GitHub
- ✦ 1 finds this interesting
Anyone may press Interesting, signed in or not. It helps others find this project.
README

NumCPULib4Pascal
CPU count detection for Object PascalNumCPULib4Pascal is a library for detecting the number of logical and physical CPUs on the current machine in Object Pascal, compatible with both Delphi and FreePascal across multiple operating systems, released under the permissive MIT License.
Table of Contents
Features
- Logical CPU count -- detect the number of logical processors (hardware threads)
- Physical CPU count -- detect the number of physical cores
- Cross-platform -- Windows, Linux, macOS, Solaris, and BSD variants
- Cross-compiler -- Delphi and FreePascal
Getting Started
Prerequisites
| Compiler | Minimum Version |
|---|---|
| Delphi | 2010 or later |
| FreePascal | 3.0.0 or later |
Installation
Delphi
- Open package:
NumCPULib/src/Packages/Delphi/NumCPULib4PascalPackage.dpk
- Build and install the package in the IDE.
- Add
NumCPULib/srcsubfolders to your project search path if needed.
FreePascal / Lazarus
- Open package:
NumCPULib/src/Packages/FPC/NumCPULib4PascalPackage.lpk
- Build/install package in Lazarus, or add
NumCPULib/srcpaths to your FPC project.
Quick Examples
Get CPU Counts
uses
NumCPULib;
var
LLogicalCount, LPhysicalCount: Int32;
begin
// Count logical CPUs (hardware threads)
LLogicalCount := TNumCPULib.GetLogicalCPUCount();
// Count physical CPUs (cores)
LPhysicalCount := TNumCPULib.GetPhysicalCPUCount();
WriteLn(Format('Logical CPUs: %d', [LLogicalCount]));
WriteLn(Format('Physical CPUs: %d', [LPhysicalCount]));
end;Additional samples can be found in the NumCPULib.Samples folder.
Contributing
Contributions are welcome. Please open an issue for bug reports or feature requests, and submit pull requests.
Tip Jar
If you find this library useful and would like to support its continued development, tips are greatly appreciated! 🙏
| Cryptocurrency | Wallet Address |
|---|---|
Bitcoin (BTC) |
bc1quqhe342vw4ml909g334w9ygade64szqupqulmu |
Ethereum (ETH) |
0x53651185b7467c27facab542da5868bfebe2bb69 |
Solana (SOL) |
BPZHjY1eYCdQjLecumvrTJRi5TXj3Yz1vAWcmyEB9Miu |
License
This project is licensed under the MIT License.


Bitcoin (BTC)
Ethereum (ETH)
Solana (SOL)