|
nfx-cpu 0.1.3
Cross-platform C++ CPU feature detection and system identification library
|
CPU core topology detection. More...
#include <cstdint>#include "nfx/detail/cpu/CoreTopology.inl"

Go to the source code of this file.
Functions | |
| uint32_t | nfx::cpu::physicalCoreCount () noexcept |
| Gets the number of physical CPU cores. | |
| uint32_t | nfx::cpu::logicalCoreCount () noexcept |
| Gets the number of logical processors (threads). | |
| bool | nfx::cpu::hasHyperThreading () noexcept |
| Detects if Hyper-Threading (or SMT) is enabled. | |
| float | nfx::cpu::hyperThreadingRatio () noexcept |
| Gets the Hyper-Threading ratio (logical cores / physical cores). | |
CPU core topology detection.
Runtime detection of physical cores, logical processors, and hyper-threading using CPUID and OS APIs with static caching for zero overhead
Definition in file CoreTopology.h.
|
inlinenodiscardnoexcept |
Detects if Hyper-Threading (or SMT) is enabled.
Compares logical processor count to physical core count. If logical > physical, hyper-threading is enabled. Result is cached via static initialization for zero runtime overhead.
|
inlinenodiscardnoexcept |
Gets the Hyper-Threading ratio (logical cores / physical cores).
Calculates the ratio of logical processors to physical cores. For traditional HT: 2.0 (2 threads per core) For hybrid architectures: varies (e.g., 1.43 for 6P+8E cores = 20/14) For no HT: 1.0 (1 thread per core) Result is cached via static initialization for zero runtime overhead.
|
inlinenodiscardnoexcept |
Gets the number of logical processors (threads).
Queries the operating system to retrieve the total number of logical processors. This includes both physical cores and hyper-threaded logical cores. Result is cached via static initialization for zero runtime overhead.
|
inlinenodiscardnoexcept |
Gets the number of physical CPU cores.
Queries the operating system to retrieve the actual number of physical cores. This excludes logical processors created by Hyper-Threading/SMT. Result is cached via static initialization for zero runtime overhead.