Struct CpuId
pub struct CpuId {
pub(crate) read: CpuIdReader,
pub(crate) vendor: Vendor,
pub(crate) supported_leafs: u32,
pub(crate) supported_extended_leafs: u32,
}
Expand description
The main type used to query information about the CPU we’re running on.
Other structs can be accessed by going through this type.
Fields§
§read: CpuIdReader
§vendor: Vendor
§supported_leafs: u32
§supported_extended_leafs: u32
Implementations§
§impl CpuId
impl CpuId
pub fn with_cpuid_fn(cpuid_fn: fn(_: u32, _: u32) -> CpuIdResult) -> CpuId
pub fn with_cpuid_fn(cpuid_fn: fn(_: u32, _: u32) -> CpuIdResult) -> CpuId
Return new CpuId struct with custom reader function.
This is useful for example when testing code or if we want to interpose on the CPUID calls this library makes.
pub fn get_vendor_info(&self) -> Option<VendorInfo>
pub fn get_vendor_info(&self) -> Option<VendorInfo>
Return information about the vendor (LEAF=0x00).
This leaf will contain a ASCII readable string such as “GenuineIntel” for Intel CPUs or “AuthenticAMD” for AMD CPUs.
§Platforms
✅ AMD ✅ Intel
pub fn get_feature_info(&self) -> Option<FeatureInfo>
pub fn get_feature_info(&self) -> Option<FeatureInfo>
pub fn get_cache_info(&self) -> Option<CacheInfoIter>
pub fn get_cache_info(&self) -> Option<CacheInfoIter>
pub fn get_processor_serial(&self) -> Option<ProcessorSerial>
pub fn get_processor_serial(&self) -> Option<ProcessorSerial>
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter>
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter>
Retrieve more elaborate information about caches (LEAF=0x04 or 0x8000_001D).
As opposed to get_cache_info, this will tell us about associativity, set size, line size of each level in the cache hierarchy.
§Platforms
🟡 AMD ✅ Intel
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
pub fn get_thermal_power_info(&self) -> Option<ThermalPowerInfo>
pub fn get_thermal_power_info(&self) -> Option<ThermalPowerInfo>
Query information about thermal and power management features of the CPU (LEAF=0x06).
§Platforms
🟡 AMD ✅ Intel
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
pub fn get_performance_monitoring_info(
&self,
) -> Option<PerformanceMonitoringInfo>
pub fn get_performance_monitoring_info( &self, ) -> Option<PerformanceMonitoringInfo>
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter>
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter>
Information about topology (LEAF=0x0B).
Intel SDM suggests software should check support for leaf 0x1F
(CpuId::get_extended_topology_info_v2
), and if supported, enumerate
that leaf instead.
§Platforms
✅ AMD ✅ Intel
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter>
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter>
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo>
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo>
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo>
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo>
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo>
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo>
pub fn get_sgx_info(&self) -> Option<SgxInfo>
pub fn get_sgx_info(&self) -> Option<SgxInfo>
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
pub fn get_tsc_info(&self) -> Option<TscInfo>
pub fn get_tsc_info(&self) -> Option<TscInfo>
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo>
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo>
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter>
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter>
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo>
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo>
Returns information provided by the hypervisor, if running in a virtual environment (LEAF=0x4000_00xx).
§Platform
Needs to be a virtual CPU to be supported.
pub fn get_extended_processor_and_feature_identifiers(
&self,
) -> Option<ExtendedProcessorFeatureIdentifiers>
pub fn get_extended_processor_and_feature_identifiers( &self, ) -> Option<ExtendedProcessorFeatureIdentifiers>
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
pub fn get_processor_capacity_feature_info(
&self,
) -> Option<ProcessorCapacityAndFeatureInfo>
pub fn get_processor_capacity_feature_info( &self, ) -> Option<ProcessorCapacityAndFeatureInfo>
Processor Capacity Parameters and Extended Feature Identification (LEAF=0x8000_0008).
§Platforms
✅ AMD 🟡 Intel
pub fn get_svm_info(&self) -> Option<SvmFeatures>
pub fn get_svm_info(&self) -> Option<SvmFeatures>
This function provides information about the SVM features that the processory supports. (LEAF=0x8000_000A)
If SVM is not supported if ExtendedProcessorFeatureIdentifiers::has_svm is false, this function is reserved then.
§Platforms
✅ AMD ❌ Intel
pub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo>
pub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo>
pub fn get_performance_optimization_info(
&self,
) -> Option<PerformanceOptimizationInfo>
pub fn get_performance_optimization_info( &self, ) -> Option<PerformanceOptimizationInfo>
pub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo>
pub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo>
pub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo>
pub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CpuId
impl RefUnwindSafe for CpuId
impl Send for CpuId
impl Sync for CpuId
impl Unpin for CpuId
impl UnwindSafe for CpuId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointee for T
impl<T> Pointee for T
Source§impl<T> SingleInstructionLoad for Twhere
T: Copy,
impl<T> SingleInstructionLoad for Twhere
T: Copy,
Source§impl<T> SingleInstructionStore for Twhere
T: Copy,
impl<T> SingleInstructionStore for Twhere
T: Copy,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.