jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Macros | Functions
cpuid.cpp File Reference
#include <cstring>
#include <string>
#include <cstdint>
#include <cstdlib>
#include <thread>
#include <new>
#include <jau/cpuid.hpp>
#include <jau/byte_util.hpp>
#include <jau/debug.hpp>
#include <jau/os/os_support.hpp>
#include <unistd.h>
Include dependency graph for cpuid.cpp:

Go to the source code of this file.

Macros

#define APPEND_BITSTR(U, V, M)   append_bitstr(out, M, U::V, #V, comma);
 
#define ARM32HWCAP1_ENUM(X, M)
 
#define ARM32HWCAP2_ENUM(X, M)
 
#define ARM64HWCAP_ENUM(X, M)
 
#define CASE_TO_STRING(U, V)   case U::V: return #V;
 
#define CPUFAMILY_ENUM(X)
 

Functions

template<typename T >
static void append_bitstr (std::string &out, T mask, T bit, const std::string &bitstr, bool &comma)
 
static bool get_arm32_hwcap (arm32_hwcap1_t &hwcap1, arm32_hwcap2_t &hwcap2) noexcept
 
static bool get_arm64_hwcap (arm64_hwcap_t &hwcap) noexcept
 
static bool get_cache_line_size (size_t &l1_share_max, size_t &l1_apart_min) noexcept
 
static size_t get_concurrent_thread_count () noexcept
 
static cpu_family_t get_cpu_family () noexcept
 Returns cpu_family derived from Architectures predefined compiler macros. More...
 
static size_t get_page_size () noexcept
 
static size_t get_sys_max_core_count () noexcept
 
static size_t get_sys_online_core_count () noexcept
 

Macro Definition Documentation

◆ APPEND_BITSTR

#define APPEND_BITSTR (   U,
  V,
 
)    append_bitstr(out, M, U::V, #V, comma);

Definition at line 127 of file cpuid.cpp.

◆ CASE_TO_STRING

#define CASE_TO_STRING (   U,
 
)    case U::V: return #V;

Definition at line 129 of file cpuid.cpp.

◆ CPUFAMILY_ENUM

#define CPUFAMILY_ENUM (   X)
Value:
X(cpu_family_t,none) \
X(cpu_family_t,arm32) \
X(cpu_family_t,arm64) \
X(cpu_family_t,x86_32) \
X(cpu_family_t,x86_64) \
X(cpu_family_t,ia64) \
X(cpu_family_t,ppc32) \
X(cpu_family_t,ppc64) \
X(cpu_family_t,sparc32) \
X(cpu_family_t,sparc64) \
X(cpu_family_t,mips32) \
X(cpu_family_t,mips64) \
X(cpu_family_t,superh32) \
X(cpu_family_t,superh64) \
X(cpu_family_t,wasm32) \
X(cpu_family_t,wasm64)
cpu_family_t
Definition: cpuid.hpp:47

Definition at line 131 of file cpuid.cpp.

◆ ARM32HWCAP1_ENUM

#define ARM32HWCAP1_ENUM (   X,
 
)
Value:
X(arm32_hwcap1_t,swp,M) \
X(arm32_hwcap1_t,half,M) \
X(arm32_hwcap1_t,thumb,M) \
X(arm32_hwcap1_t,bits26,M) \
X(arm32_hwcap1_t,fmult,M) \
X(arm32_hwcap1_t,fpa,M) \
X(arm32_hwcap1_t,vfp,M) \
X(arm32_hwcap1_t,edsp,M) \
X(arm32_hwcap1_t,java,M) \
X(arm32_hwcap1_t,iwmmxt,M) \
X(arm32_hwcap1_t,crunch,M) \
X(arm32_hwcap1_t,thumbee,M) \
X(arm32_hwcap1_t,neon,M) \
X(arm32_hwcap1_t,vfp_v3,M) \
X(arm32_hwcap1_t,vfp_v3_d16,M) \
X(arm32_hwcap1_t,tls,M) \
X(arm32_hwcap1_t,vfp_v4,M) \
X(arm32_hwcap1_t,idiva,M) \
X(arm32_hwcap1_t,idivt,M) \
X(arm32_hwcap1_t,vfp_d32,M) \
X(arm32_hwcap1_t,lpae,M) \
X(arm32_hwcap1_t,evtstrm,M)
arm32_hwcap1_t
Definition: cpuid.hpp:127

Definition at line 158 of file cpuid.cpp.

◆ ARM32HWCAP2_ENUM

#define ARM32HWCAP2_ENUM (   X,
 
)
Value:
X(arm32_hwcap2_t,aes,M) \
X(arm32_hwcap2_t,pmull,M) \
X(arm32_hwcap2_t,sha1,M) \
X(arm32_hwcap2_t,sha2,M) \
X(arm32_hwcap2_t,crc32,M)
arm32_hwcap2_t
Definition: cpuid.hpp:192

Definition at line 189 of file cpuid.cpp.

◆ ARM64HWCAP_ENUM

#define ARM64HWCAP_ENUM (   X,
 
)

Definition at line 203 of file cpuid.cpp.

Function Documentation

◆ get_cache_line_size()

static bool get_cache_line_size ( size_t &  l1_share_max,
size_t &  l1_apart_min 
)
staticnoexcept

Definition at line 51 of file cpuid.cpp.

◆ get_page_size()

static size_t get_page_size ( )
staticnoexcept

Definition at line 63 of file cpuid.cpp.

◆ get_concurrent_thread_count()

static size_t get_concurrent_thread_count ( )
staticnoexcept

Definition at line 74 of file cpuid.cpp.

◆ get_sys_online_core_count()

static size_t get_sys_online_core_count ( )
staticnoexcept

Definition at line 78 of file cpuid.cpp.

◆ get_sys_max_core_count()

static size_t get_sys_max_core_count ( )
staticnoexcept

Definition at line 99 of file cpuid.cpp.

◆ append_bitstr()

template<typename T >
static void append_bitstr ( std::string &  out,
mask,
bit,
const std::string &  bitstr,
bool &  comma 
)
static

Definition at line 121 of file cpuid.cpp.

◆ get_cpu_family()

static cpu_family_t get_cpu_family ( )
staticnoexcept

Returns cpu_family derived from Architectures predefined compiler macros.

Consider using singleton CpuInfo.

Definition at line 245 of file cpuid.cpp.

Here is the caller graph for this function:

◆ get_arm32_hwcap()

static bool get_arm32_hwcap ( arm32_hwcap1_t hwcap1,
arm32_hwcap2_t hwcap2 
)
staticnoexcept

Definition at line 342 of file cpuid.cpp.

◆ get_arm64_hwcap()

static bool get_arm64_hwcap ( arm64_hwcap_t hwcap)
staticnoexcept

Definition at line 364 of file cpuid.cpp.