pub struct CpuId<R: CpuIdReader> { /* private fields */ }
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.
Implementations§
source§impl<R: CpuIdReader> CpuId<R>
impl<R: CpuIdReader> CpuId<R>
sourcepub fn with_cpuid_reader(cpuid_fn: R) -> Self
pub fn with_cpuid_reader(cpuid_fn: R) -> Self
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.
sourcepub fn with_cpuid_fn(cpuid_fn: R) -> Self
pub fn with_cpuid_fn(cpuid_fn: R) -> Self
§Note
This function will likely be deprecated in the future. Use the identical
with_cpuid_reader
function instead.
sourcepub 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
sourcepub fn get_feature_info(&self) -> Option<FeatureInfo>
pub fn get_feature_info(&self) -> Option<FeatureInfo>
sourcepub fn get_cache_info(&self) -> Option<CacheInfoIter>
pub fn get_cache_info(&self) -> Option<CacheInfoIter>
sourcepub fn get_processor_serial(&self) -> Option<ProcessorSerial>
pub fn get_processor_serial(&self) -> Option<ProcessorSerial>
sourcepub fn get_cache_parameters(&self) -> Option<CacheParametersIter<R>>
pub fn get_cache_parameters(&self) -> Option<CacheParametersIter<R>>
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
sourcepub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
pub fn get_monitor_mwait_info(&self) -> Option<MonitorMwaitInfo>
sourcepub 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
sourcepub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
pub fn get_extended_feature_info(&self) -> Option<ExtendedFeatures>
sourcepub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
pub fn get_direct_cache_access_info(&self) -> Option<DirectCacheAccessInfo>
sourcepub fn get_performance_monitoring_info(
&self,
) -> Option<PerformanceMonitoringInfo>
pub fn get_performance_monitoring_info( &self, ) -> Option<PerformanceMonitoringInfo>
sourcepub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter<R>>
pub fn get_extended_topology_info(&self) -> Option<ExtendedTopologyIter<R>>
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
sourcepub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter<R>>
pub fn get_extended_topology_info_v2(&self) -> Option<ExtendedTopologyIter<R>>
sourcepub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo<R>>
pub fn get_extended_state_info(&self) -> Option<ExtendedStateInfo<R>>
sourcepub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo<R>>
pub fn get_rdt_monitoring_info(&self) -> Option<RdtMonitoringInfo<R>>
sourcepub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo<R>>
pub fn get_rdt_allocation_info(&self) -> Option<RdtAllocationInfo<R>>
sourcepub fn get_sgx_info(&self) -> Option<SgxInfo<R>>
pub fn get_sgx_info(&self) -> Option<SgxInfo<R>>
sourcepub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
pub fn get_processor_trace_info(&self) -> Option<ProcessorTraceInfo>
sourcepub fn get_tsc_info(&self) -> Option<TscInfo>
pub fn get_tsc_info(&self) -> Option<TscInfo>
sourcepub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
pub fn get_processor_frequency_info(&self) -> Option<ProcessorFrequencyInfo>
sourcepub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo<R>>
pub fn get_soc_vendor_info(&self) -> Option<SoCVendorInfo<R>>
sourcepub fn get_deterministic_address_translation_info(&self) -> Option<DatIter<R>>
pub fn get_deterministic_address_translation_info(&self) -> Option<DatIter<R>>
sourcepub fn get_hypervisor_info(&self) -> Option<HypervisorInfo<R>>
pub fn get_hypervisor_info(&self) -> Option<HypervisorInfo<R>>
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.
sourcepub fn get_extended_processor_and_feature_identifiers(
&self,
) -> Option<ExtendedProcessorFeatureIdentifiers>
pub fn get_extended_processor_and_feature_identifiers( &self, ) -> Option<ExtendedProcessorFeatureIdentifiers>
sourcepub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
pub fn get_processor_brand_string(&self) -> Option<ProcessorBrandString>
sourcepub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
pub fn get_l1_cache_and_tlb_info(&self) -> Option<L1CacheTlbInfo>
sourcepub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
pub fn get_l2_l3_cache_and_tlb_info(&self) -> Option<L2And3CacheTlbInfo>
sourcepub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
pub fn get_advanced_power_mgmt_info(&self) -> Option<ApmInfo>
sourcepub 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
sourcepub 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
sourcepub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo>
pub fn get_tlb_1gb_page_info(&self) -> Option<Tlb1gbPageInfo>
sourcepub fn get_performance_optimization_info(
&self,
) -> Option<PerformanceOptimizationInfo>
pub fn get_performance_optimization_info( &self, ) -> Option<PerformanceOptimizationInfo>
sourcepub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo>
pub fn get_processor_topology_info(&self) -> Option<ProcessorTopologyInfo>
sourcepub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo>
pub fn get_memory_encryption_info(&self) -> Option<MemoryEncryptionInfo>
Trait Implementations§
source§impl<R: Clone + CpuIdReader> Clone for CpuId<R>
impl<R: Clone + CpuIdReader> Clone for CpuId<R>
source§impl<R: CpuIdReader> Debug for CpuId<R>
impl<R: CpuIdReader> Debug for CpuId<R>
impl<R: Copy + CpuIdReader> Copy for CpuId<R>
Auto Trait Implementations§
impl<R> Freeze for CpuId<R>where
R: Freeze,
impl<R> RefUnwindSafe for CpuId<R>where
R: RefUnwindSafe,
impl<R> Send for CpuId<R>where
R: Send,
impl<R> Sync for CpuId<R>where
R: Sync,
impl<R> Unpin for CpuId<R>where
R: Unpin,
impl<R> UnwindSafe for CpuId<R>where
R: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)