omni::platforminfo::ICpuInfo
Defined in omni/platforminfo/ICpuInfo.h
-
class ICpuInfo : public omni::core::Generated<omni::platforminfo::ICpuInfo_abi>
Interface to collect information about the CPUs installed in the calling system.
This can provide some basic information about the CPU(s) and get access to features that are supported by them.
Public Functions
-
inline size_t getCpuPackageCount() noexcept
Retrieves the total number of CPU packages installed on the system.
Remark
A system may have multiple CPUs installed if the motherboard supports it. At least in the Intel (and compatible) case, there are some restrictions to doing this - all CPUs must be in the same family, share the same core count, feature set, and bus speed. Outside of that, the CPUs do not need to be identical.
- Thread Safety
This call is thread safe.
- Returns
The total number of CPU packages installed in the system. A CPU package is a single physical CPU chip that is connected to a physical socket on the motherboard.
-
inline size_t getTotalPhysicalCoreCount() noexcept
Retrieves the total number of physical cores across all CPUs in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of physical cores across all CPUs in the system. This includes the sum of all physical cores on all CPU packages. This will not be zero.
-
inline size_t getTotalLogicalCoreCount() noexcept
Retrieves the total number of logical cores across all CPUs in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of logical cores across all CPUs in the system. This includes the sum of all logical cores on all CPU packages.
-
inline size_t getPhysicalCoresPerPackage() noexcept
Retrieves the number of physical cores per CPU package in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of physical cores per CPU package. Since all CPU packages must have the same core counts, this is a common value to all packages.
-
inline size_t getLogicalCoresPerPackage() noexcept
Retrieves the number of logical cores per CPU package in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of logical cores per CPU package. Since all CPU packages must have the same core counts, this is a common value to all packages.
-
inline bool isFeatureSupported(omni::platforminfo::CpuFeature feature) noexcept
Checks if a requested feature is supported by the CPU(s) in the system.
Remark
See omni::platforminfo::CpuFeature for more information on the features that can be queried.
- Thread Safety
This call is thread safe.
- Returns
true
if the requested feature is supported. Returnsfalse
otherwise.
-
inline const char *getPrettyName(size_t cpuIndex) noexcept
Retrieves the friendly name of a CPU in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the name for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The friendly name of the requested CPU package. This string should be suitable for display to the user. This will contain a rough outline of the processor model and architecture. It may or may not contain the clock speed.
-
inline const char *getIdentifier(size_t cpuIndex) noexcept
Retrieves the identifier of a CPU in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the identifier for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The identifier string of the requested CPU package. This string should be suitable for display to the user. This will contain information about the processor family, vendor, and architecture.
-
inline const char *getVendor(size_t cpuIndex) noexcept
Retrieves the vendor string for a CPU package in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the vendor for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The name of the vendor as reported by the CPU itself. This may be something along the lines of “GenuineIntel” or “AuthenticAMD” for x86_64 architectures, or the name of the CPU implementer for ARM architectures.
-
inline uint64_t getProcessorMask(size_t cpuIndex) noexcept
Note: the mask may be 0 if out of range of 64 bits.
Retrieves a bit mask for the processor cores in a CPU package in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the identifier for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
A mask identifying which CPU cores the given CPU covers. A set bit indicates a core that belongs to the given CPU. A 0 bit indicates either a core from another package or a non-existent core. This may also be 0 if more than 64 cores are present in the system or they are out of range of a single 64-bit value.
-
inline void *cast(omni::core::TypeId id) noexcept
Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.
Objects can support multiple interfaces, even interfaces that are in different inheritance chains.
The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.
The returned pointer can be safely
reinterpret_cast<>
to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast toomni::windowing::IWindow
.Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().
- Thread Safety
This method is thread safe.
-
inline void acquire() noexcept
Increments the object’s reference count.
Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().
Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.
- Thread Safety
This method is thread safe.
-
inline void release() noexcept
Decrements the objects reference count.
Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).
Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().
Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.
- Thread Safety
This method is thread safe.
Protected Functions
-
virtual size_t getCpuPackageCount_abi() noexcept = 0
Retrieves the total number of CPU packages installed on the system.
Remark
A system may have multiple CPUs installed if the motherboard supports it. At least in the Intel (and compatible) case, there are some restrictions to doing this - all CPUs must be in the same family, share the same core count, feature set, and bus speed. Outside of that, the CPUs do not need to be identical.
- Thread Safety
This call is thread safe.
- Returns
The total number of CPU packages installed in the system. A CPU package is a single physical CPU chip that is connected to a physical socket on the motherboard.
-
virtual size_t getTotalPhysicalCoreCount_abi() noexcept = 0
Retrieves the total number of physical cores across all CPUs in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of physical cores across all CPUs in the system. This includes the sum of all physical cores on all CPU packages. This will not be zero.
-
virtual size_t getTotalLogicalCoreCount_abi() noexcept = 0
Retrieves the total number of logical cores across all CPUs in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of logical cores across all CPUs in the system. This includes the sum of all logical cores on all CPU packages.
-
virtual size_t getPhysicalCoresPerPackage_abi() noexcept = 0
Retrieves the number of physical cores per CPU package in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of physical cores per CPU package. Since all CPU packages must have the same core counts, this is a common value to all packages.
-
virtual size_t getLogicalCoresPerPackage_abi() noexcept = 0
Retrieves the number of logical cores per CPU package in the system.
- Thread Safety
This call is thread safe.
- Returns
The total number of logical cores per CPU package. Since all CPU packages must have the same core counts, this is a common value to all packages.
-
virtual bool isFeatureSupported_abi(CpuFeature feature) noexcept = 0
Checks if a requested feature is supported by the CPU(s) in the system.
Remark
See omni::platforminfo::CpuFeature for more information on the features that can be queried.
- Thread Safety
This call is thread safe.
- Returns
true
if the requested feature is supported. Returnsfalse
otherwise.
-
virtual const char *getPrettyName_abi(size_t cpuIndex) noexcept = 0
Retrieves the friendly name of a CPU in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the name for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The friendly name of the requested CPU package. This string should be suitable for display to the user. This will contain a rough outline of the processor model and architecture. It may or may not contain the clock speed.
-
virtual const char *getIdentifier_abi(size_t cpuIndex) noexcept = 0
Retrieves the identifier of a CPU in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the identifier for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The identifier string of the requested CPU package. This string should be suitable for display to the user. This will contain information about the processor family, vendor, and architecture.
-
virtual const char *getVendor_abi(size_t cpuIndex) noexcept = 0
Retrieves the vendor string for a CPU package in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the vendor for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
The name of the vendor as reported by the CPU itself. This may be something along the lines of “GenuineIntel” or “AuthenticAMD” for x86_64 architectures, or the name of the CPU implementer for ARM architectures.
-
virtual uint64_t getProcessorMask_abi(size_t cpuIndex) noexcept = 0
Note: the mask may be 0 if out of range of 64 bits.
Retrieves a bit mask for the processor cores in a CPU package in the system.
- Thread Safety
This call is thread safe.
- Parameters
cpuIndex – [in] The zero based index of the CPU package to retrieve the identifier for. This should be less than the return value of ICpuInfo::getCpuPackageCount().
- Returns
A mask identifying which CPU cores the given CPU covers. A set bit indicates a core that belongs to the given CPU. A 0 bit indicates either a core from another package or a non-existent core. This may also be 0 if more than 64 cores are present in the system or they are out of range of a single 64-bit value.
-
virtual void *cast_abi(TypeId id) noexcept = 0
Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.
Objects can support multiple interfaces, even interfaces that are in different inheritance chains.
The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.
The returned pointer can be safely
reinterpret_cast<>
to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast toomni::windowing::IWindow
.Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().
- Thread Safety
This method is thread safe.
-
virtual void acquire_abi() noexcept = 0
Increments the object’s reference count.
Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().
Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.
- Thread Safety
This method is thread safe.
-
virtual void release_abi() noexcept = 0
Decrements the objects reference count.
Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).
Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().
Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.
- Thread Safety
This method is thread safe.
-
inline size_t getCpuPackageCount() noexcept