Detection#
#include <hpk/detection.hpp>
This header declares functions for detecting system properties at runtime.
Note that these functions respect the process’s CPU affinity. For example,
if the application myapp
is run with the following command:
taskset --cpu-list 0 myapp
then, in that application, detectCpus()
, detectCores()
, etc. will return 1,
as only a single cpu is available to the process.
- See Also:
- Example source file: ncpu.cppLinux man pages: taskset(1), sched_getaffinity(2)
FUNCTIONS
-
Architecture hpk::detectArchitecture()#
Returns the instruction set architecture available to the current process.
-
int hpk::detectCpus()#
Returns the number of CPUs (i.e., hardware threads) available to the current process.
-
int hpk::detectCores()#
Returns the number of cores available to the current process.
-
int hpk::detectDies()#
Returns the number of dies available to the current process.
-
int hpk::detectPackages()#
Returns the number of packages available to the current process.
-
CacheInfo hpk::detectDataCache(int cacheLevel)#
Returns information describing the hardware data cache at the specified level for the CPU running the current process.
CLASS
-
struct CacheInfo#
Provides processor cache information.