asmjit::CpuInfo Class Reference

CPU information.

Public Members

Members

Member Functions

Construction & Destruction
Overloaded Operators
Initialization & Reset
Accessors

Static Functions

CPU Information Detection

Constructor & Destructor Documentation

CpuInfo::CpuInfo()noexcept[1/3]◆ 

Creates a new CpuInfo instance.

CpuInfo::CpuInfo(const CpuInfo& other)defaultnoexcept[2/3]◆ 

Creates a copy of other instance.

CpuInfo::CpuInfo(Globals::NoInit_)explicitnoexcept[3/3]◆ 

Creates an unitialized CpuInfo instance.

Member Function Documentation

const CpuInfo& CpuInfo::host()staticnoexcept◆ 

Returns the host CPU information.

Note
The returned reference is global - it's setup only once and then shared.

CpuInfo& CpuInfo::operator=(const CpuInfo& other)defaultnoexcept◆ 

Copy assignment.

void CpuInfo::initArch(Arch arch, SubArch subArch = SubArch::kUnknown)noexcept◆ 

Initializes CpuInfo architecture and sub-architecture members to arch and subArch, respectively.

void CpuInfo::reset()noexcept◆ 

Resets this CpuInfo to a default constructed state.

Arch CpuInfo::arch() constnoexcept◆ 

Returns the CPU architecture this information relates to.

SubArch CpuInfo::subArch() constnoexcept◆ 

Returns the CPU sub-architecture this information relates to.

bool CpuInfo::wasDetected() constnoexcept◆ 

Returns whether the CPU was detected successfully.

If the returned value is false it means that AsmJit either failed to detect the CPU or it doesn't have implementation targeting the host architecture and operating system.

uint32_t CpuInfo::familyId() constnoexcept◆ 

Returns the CPU family ID.

The information provided depends on architecture and OS:

  • X86:
    • Family identifier matches the FamilyId read by using CPUID.
  • ARM:
    • Apple - returns Apple Family identifier returned by sysctlbyname("hw.cpufamily").

uint32_t CpuInfo::modelId() constnoexcept◆ 

Returns the CPU model ID.

The information provided depends on architecture and OS:

  • X86:
    • Model identifier matches the ModelId read by using CPUID.

uint32_t CpuInfo::brandId() constnoexcept◆ 

Returns the CPU brand id.

The information provided depends on architecture and OS:

  • X86:
    • Brand identifier matches the BrandId read by using CPUID.

uint32_t CpuInfo::stepping() constnoexcept◆ 

Returns the CPU stepping.

The information provided depends on architecture and OS:

  • X86:
    • Stepping identifier matches the Stepping information read by using CPUID.

uint32_t CpuInfo::processorType() constnoexcept◆ 

Returns the processor type.

The information provided depends on architecture and OS:

  • X86:
    • Processor type identifier matches the ProcessorType read by using CPUID.

uint32_t CpuInfo::maxLogicalProcessors() constnoexcept◆ 

Returns the maximum number of logical processors.

uint32_t CpuInfo::cacheLineSize() constnoexcept◆ 

Returns the size of a CPU cache line.

On a multi-architecture system this should return the smallest cache line of all CPUs.

uint32_t CpuInfo::hwThreadCount() constnoexcept◆ 

Returns number of hardware threads available.

const char* CpuInfo::vendor() constnoexcept◆ 

Returns a CPU vendor string.

bool CpuInfo::isVendor(const char* s) constnoexcept◆ 

Tests whether the CPU vendor string is equal to s.

const char* CpuInfo::brand() constnoexcept◆ 

Returns a CPU brand string.

CpuFeatures& CpuInfo::features()noexcept[1/2]◆ 

Returns CPU features.

const CpuFeatures& CpuInfo::features() constnoexcept[2/2]◆ 

Returns CPU features (const).

template<typename FeatureId>
bool CpuInfo::hasFeature(const FeatureId& featureId) constnoexcept◆ 

Tests whether the CPU has the given feature.

template<typename... Args>
void CpuInfo::addFeature(Args&&... args)noexcept◆ 

Adds the given CPU featureId to the list of features.

template<typename... Args>
void CpuInfo::removeFeature(Args&&... args)noexcept◆ 

Removes the given CPU featureId from the list of features.

Member Data Documentation

Arch CpuInfo::_arch {}◆ 

Architecture.

SubArch CpuInfo::_subArch {}◆ 

Sub-architecture.

bool CpuInfo::_wasDetected {}◆ 

True if the CPU was detected, false if the detection failed or it's not available.

uint8_t CpuInfo::_reserved {}◆ 

Reserved for future use.

uint32_t CpuInfo::_familyId {}◆ 

CPU family ID.

uint32_t CpuInfo::_modelId {}◆ 

CPU model ID.

uint32_t CpuInfo::_brandId {}◆ 

CPU brand ID.

uint32_t CpuInfo::_stepping {}◆ 

CPU stepping.

uint32_t CpuInfo::_processorType {}◆ 

Processor type.

uint32_t CpuInfo::_maxLogicalProcessors {}◆ 

Maximum number of addressable IDs for logical processors.

uint32_t CpuInfo::_cacheLineSize {}◆ 

Cache line size (in bytes).

uint32_t CpuInfo::_hwThreadCount {}◆ 

Number of hardware threads.

FixedString<16>CpuInfo::_vendor {}◆ 

CPU vendor string.

FixedString<64>CpuInfo::_brand {}◆ 

CPU brand string.

CpuFeatures CpuInfo::_features {}◆ 

CPU features.